This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OurAppInjectionScopes(private val appComponent: AppComponent) : AppInjectionScopes { | |
override val isInUserScope: Boolean | |
get() = userScope != null | |
override var userScope: UserScopeSubcomponent? = null | |
private set | |
override fun openUserScope() { | |
userScope = appComponent.getUserScopeSubcomponentFactory().create() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class InjectedBaseActivity : HasInjectorsBaseActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
AndroidInjection.inject(this) | |
super.onCreate(savedInstanceState) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Component(modules = [ | |
AppModule::class, | |
AndroidSupportInjectionModule::class, | |
ActivityScopeBuilderModule::class, | |
UserScopeSubcomponentModule::class | |
]) | |
interface AppComponent : AndroidInjector<OurApp> { | |
fun getUserScopeSubcomponentFactory() : UserScopeSubcomponent.Factory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AuthenticatedBaseActivity | |
extends ConnectedBaseActivity | |
implements SlidingDrawer.OnDrawerOpenListener, SlidingDrawer.OnDrawerCloseListener { | |
@Inject | |
protected InjectionScopes injectionScopes; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
UserScopeSubcomponent userScope = ((OurApp) getApplication()).getAppScopes().getUserScope(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
abstract class TextToSpeechModule { | |
@Binds | |
@UserScope | |
abstract fun bindsSpeechNotifier(textToSpeechNotificationManager: TextToSpeechNotificationManager): Notifier | |
@Binds | |
@UserScope | |
abstract fun bindsTextToSpeechTextSynthetizer(androidTextToSpeechSynthesizer: AndroidTextToSpeechSynthesizer): TextToSpeechSynthesizer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
abstract class UserScopeActivityBuilderModule { | |
@UserActivityScope | |
@ContributesAndroidInjector(modules = [DebugActivityModule::class]) | |
abstract fun contributeDebugActivity(): DebugActivity | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UserScope | |
@Subcomponent(modules = [ | |
AndroidSupportInjectionModule::class, | |
UserScopeActivityBuilderModule::class, | |
TextToSpeechModule::class | |
]) | |
interface UserScopeSubcomponent { | |
val userScopeActivitiesAndroidInjectorFactories: Map<Class<*>, Provider<AndroidInjector.Factory<*>>> |