misp-bump/app/src/main/java/lu/circl/mispbump/activities/StartUpActivity.java

34 lines
996 B
Java
Raw Normal View History

2019-05-29 14:52:00 +02:00
package lu.circl.mispbump.activities;
2019-05-27 16:06:07 +02:00
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
2019-05-27 16:06:07 +02:00
import lu.circl.mispbump.auxiliary.PreferenceManager;
2019-06-19 20:01:49 +02:00
import lu.circl.mispbump.models.restModels.User;
2019-05-27 16:06:07 +02:00
public class StartUpActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isUserLoggedIn()) {
Intent home = new Intent(this, HomeActivity.class);
startActivity(home);
} else {
Intent login = new Intent(this, LoginActivity.class);
startActivity(login);
}
2019-05-29 14:52:00 +02:00
// closes the activity to prevent going back to this (empty) activity
2019-05-27 16:06:07 +02:00
finish();
}
private boolean isUserLoggedIn() {
PreferenceManager preferenceManager = PreferenceManager.getInstance(this);
User user = preferenceManager.getUserInfo();
return user != null;
}
}