diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java index 9b8da3d..004955f 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java @@ -69,6 +69,15 @@ public class LoginActivity extends AppCompatActivity { } + @Override + protected void onResume() { + super.onResume(); + + //If the user is signed in, open the main activity + if(new AccountHelper(this).signed_in()) + openMainActivity(); + } + /** * Handle login form submission */ @@ -186,8 +195,7 @@ public class LoginActivity extends AppCompatActivity { } else { //Redirect to the main activity - Intent redirect = new Intent(LoginActivity.this, MainActivity.class); - startActivity(redirect); + openMainActivity(); } } @@ -195,6 +203,14 @@ public class LoginActivity extends AppCompatActivity { } + /** + * Open the main activity + */ + private void openMainActivity(){ + Intent redirect = new Intent(LoginActivity.this, MainActivity.class); + startActivity(redirect); + } + /** * Switch between loading state and ready state for the login form *