From 636c74bc98a9b02434265bdd9dde91be6e05667f Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 14 Apr 2018 17:30:16 +0200 Subject: [PATCH] Fixed an issue with the login activity. --- .../client/ui/activities/LoginActivity.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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 *