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