Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created August 13, 2016 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/c22f41b80db816623fd0795d520cd683 to your computer and use it in GitHub Desktop.
Save frogermcs/c22f41b80db816623fd0795d520cd683 to your computer and use it in GitHub Desktop.
public abstract class BaseUserActivity extends BaseActivity {
@Inject
UserManager userManager;
@Override
protected void setupActivityComponent(AppComponent appComponent) {
appComponent.inject(this);
setupUserComponent();
}
private void setupUserComponent() {
isUserSessionStarted = userManager.isUserSessionStartedOrStartSessionIfPossible();
onUserComponentSetup(userManager.getUserComponent());
//This screen cannot work when user session is not started.
if (!isUserSessionStarted) {
finish();
}
}
protected abstract void onUserComponentSetup(UserComponent userComponent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment