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 | |
public abstract class RegistrationModule { | |
@ActivityScoped | |
@Binds | |
public abstract RegistrationPresenter provideRegPresenter (RegistrationPresenter presenter); | |
@ActivityScoped | |
@Provides | |
static String provideActivityId(RegistrationActivity activity) { | |
return activity.getIntent().getStringExtra(ID); |
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(includes = ServletRequestAbstractModule.class) | |
final class ServletRequestModule { | |
private final HttpServletRequest httpRequest; | |
@Provides | |
HttpServletRequestModule(HttpServletRequest httpRequest) { | |
this.httpRequest = httpRequest; | |
} | |
@Module |
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
android { | |
... | |
} | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
} | |
dependencies { |
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 class MessageActivity extends DaggerAppCompatActivity { | |
@Inject | |
MessageFragment mInjectedFragment; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_message); | |
// Set up fragment |
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 class Application extends DaggerApplication { | |
@Override | |
protected AndroidInjector<? extends DaggerApplication> applicationInjector() { | |
return DaggerAppComponent.builder().application(this).build(); | |
} | |
} |
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 | |
public abstract class AppModule { | |
// expose Application as an injectable context | |
@Binds | |
abstract Context bindContext(Application application); | |
} |
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
@AppScoped | |
@Component(modules = {ViewModelModule.class, | |
AppModule.class, | |
ActivityBindingModule.class, | |
AndroidSupportInjectionModule.class}) | |
public interface AppComponent extends AndroidInjector<Application> { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance |
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
@Documented | |
@Scope | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface AppScoped { | |
} |
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 | |
public abstract class ActivityBindingModule { | |
@ActivityScoped | |
@ContributesAndroidInjector(modules = {MessageModule.class}) | |
abstract MessageActivity messageActivity(); | |
} |
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 interface BaseView { | |
void bindViewModel(); | |
void unbindViewModel(); | |
} |