π¨βπ»
This file contains 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 final class MainActivity extends BaseActivity implements MainFragmentListener { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main_activity); | |
if (savedInstanceState == null) { | |
addFragment(R.id.fragment_container, new MainFragment()); | |
} |
This file contains 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(includes = BaseActivityModule.class, | |
subcomponents = MainFragmentSubcomponent.class) | |
abstract class MainActivityModule { | |
// TODO (ContributesAndroidInjector) remove this in favor of @ContributesAndroidInjector | |
@Binds | |
@IntoMap | |
@FragmentKey(MainFragment.class) | |
abstract AndroidInjector.Factory<? extends Fragment> | |
mainFragmentInjectorFactory(MainFragmentSubcomponent.Builder builder); |
This file contains 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
// TODO (ContributesAndroidInjector) remove this in favor of @ContributesAndroidInjector | |
@PerActivity | |
@Subcomponent(modules = MainActivityModule.class) | |
public interface MainActivitySubcomponent extends AndroidInjector<MainActivity> { | |
@Subcomponent.Builder | |
abstract class Builder extends AndroidInjector.Builder<MainActivity> { | |
} | |
} |
This file contains 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 final class Example1Fragment extends BaseFragment implements View.OnClickListener { | |
@Inject | |
SingletonUtil singletonUtil; | |
@Inject | |
PerActivityUtil perActivityUtil; | |
@Inject | |
PerFragmentUtil perFragmentUtil; |
This file contains 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 final class Example1Activity extends BaseActivity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.example_1_activity); | |
if (savedInstanceState == null) { | |
addFragment(R.id.fragment_container, new Example1Fragment()); | |
} |
This file contains 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(includes = AndroidInjectionModule.class, | |
subcomponents = MainActivitySubcomponent.class) | |
abstract class AppModule { | |
// TODO (ContributesAndroidInjector) remove this in favor of @ContributesAndroidInjector | |
@Binds | |
@IntoMap | |
@ActivityKey(MainActivity.class) | |
abstract AndroidInjector.Factory<? extends Activity> | |
mainActivityInjectorFactory(MainActivitySubcomponent.Builder builder); |
This file contains 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(includes = AndroidInjectionModule.class, | |
subcomponents = { | |
MainActivitySubcomponent.class, | |
Example1ActivitySubcomponent.class | |
}) | |
abstract class AppModule { | |
... | |
// TODO (ContributesAndroidInjector) remove this in favor of @ContributesAndroidInjector |
This file contains 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 final class Example2Activity extends BaseActivity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.example_2_activity); | |
if (savedInstanceState == null) { | |
addFragment(R.id.fragment_a_container, new Example2AFragment()); | |
addFragment(R.id.fragment_b_container, new Example2BFragment()); |
This file contains 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(includes = BaseActivityModule.class, | |
subcomponents = { | |
Example2AFragmentSubcomponent.class, | |
Example2BFragmentSubcomponent.class | |
}) | |
abstract class Example2ActivityModule { | |
// TODO (ContributesAndroidInjector) remove this in favor of @ContributesAndroidInjector | |
@Binds | |
@IntoMap |
This file contains 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(includes = AndroidInjectionModule.class, | |
subcomponents = { | |
MainActivitySubcomponent.class, | |
Example1ActivitySubcomponent.class, | |
Example2ActivitySubcomponent.class | |
}) | |
abstract class AppModule { | |
... |