Skip to content

Instantly share code, notes, and snippets.

@theapache64
Created December 24, 2018 13:24
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 theapache64/b0f3c9b51404e0f5f33dcbd0fee5118f to your computer and use it in GitHub Desktop.
Save theapache64/b0f3c9b51404e0f5f33dcbd0fee5118f to your computer and use it in GitHub Desktop.
public class SplashActivityViewModel extends BaseViewModel<SplashActivityNavigator> {
private static final int SPLASH_DURATION_IN_MILLIS = 1500;
public SplashActivityViewModel(@NonNull Application application, SplashActivityNavigator navigator) {
super(application, navigator);
}
void startWorking() {
final LogInResponse.User user = PreferenceManager.getInstance(getApplication()).getUser();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (user == null) {
getNavigator().openLogInActivity();
} else {
getNavigator().openMainActivity();
}
}
}, SPLASH_DURATION_IN_MILLIS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment