Extracting the anonymous classes to allow freeing references to activity in observables.

This prevents the activity being leaked.