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 class MyApplication extends Application { | |
@Nullable | |
private AccountComponent accountComponent; | |
@NonNull | |
public AccountComponent getAccountComponent(String account) { // конкретный аккаунт | |
if (accountComponent == null) { | |
accountComponent = Dagger.... // init | |
} |
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 class MainActivity extends Activity { | |
@Inject | |
Presenter presenter; | |
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
MyApplication.getInstance().getAccountComponent("old account").inject(this); | |
presenter.startLoading(); |
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 class MainActivity extends Activity { | |
@Inject | |
Presenter presenter; | |
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
MyApplication.getInstance().getAccountComponent("old account").inject(this); | |
presenter.startLoading(); |
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 class MainActivity extends Activity { | |
@Inject | |
Presenter presenter; | |
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
MyApplication.getInstance().getAccountComponent("old account").inject(this); | |
presenter.startLoading(); |
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
Error: Some file crunching failed, see logs for details | |
:sample:mergeDebugResources FAILED | |
:sample:mergeDebugResources (Thread[Task worker Thread 5,5,main]) completed. Took 2.536 secs. | |
FAILURE: Build failed with an exception. | |
* What went wrong: | |
Execution failed for task ':sample:mergeDebugResources'. | |
> Error: Some file crunching failed, see logs for details |
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 class MainActivity extends AppCompatActivity { | |
@Inject RxUtilsAbs rxUtilsAbs; | |
@Inject NetworkUtils networkUtils; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
App.getComponent().inject(this); |
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
SomeSingleton.getInstance().method(); |
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
@Component(modules = {AppModule.class, UtilsModule.class, ReceiversModule.class}) | |
@Singleton | |
public interface AppComponent { | |
void inject(MainActivity mainActivity); | |
void inject(SecondActivity secondActivity); | |
} |
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
@Component(modules = {AppModule.class, UtilsModule.class, ReceiversModule.class}) | |
@Singleton | |
public interface AppComponent { | |
void inject(Object object); | |
} |
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
protected AppComponent buildComponent() { | |
return DaggerAppComponent.builder() | |
.appModule(new AppModule(this)) | |
.build(); | |
} |
OlderNewer