From d21ced30ba2978e02bbea8f7508e2ec8f7d63eb2 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Wed, 26 Feb 2014 22:45:07 +0000 Subject: [PATCH] Don't create duplicate PasswordActivity when screen is rotated. Bug #43 --- .../briarproject/android/BriarActivity.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/briar-android/src/org/briarproject/android/BriarActivity.java b/briar-android/src/org/briarproject/android/BriarActivity.java index c2692b613e..162660d8f6 100644 --- a/briar-android/src/org/briarproject/android/BriarActivity.java +++ b/briar-android/src/org/briarproject/android/BriarActivity.java @@ -33,14 +33,7 @@ public class BriarActivity extends RoboFragmentActivity { @Override public void onCreate(Bundle state) { super.onCreate(state); - if(databaseConfig.getEncryptionKey() == null) { - if(LOG.isLoggable(INFO)) LOG.info("No password"); - Intent i = new Intent(this, PasswordActivity.class); - i.setFlags(FLAG_ACTIVITY_NO_ANIMATION | FLAG_ACTIVITY_SINGLE_TOP); - startActivityForResult(i, REQUEST_PASSWORD); - } else { - startAndBindService(); - } + if(databaseConfig.getEncryptionKey() != null) startAndBindService(); } @Override @@ -52,6 +45,16 @@ public class BriarActivity extends RoboFragmentActivity { } } + @Override + public void onResume() { + super.onResume(); + if(databaseConfig.getEncryptionKey() == null && !isFinishing()) { + Intent i = new Intent(this, PasswordActivity.class); + i.setFlags(FLAG_ACTIVITY_NO_ANIMATION | FLAG_ACTIVITY_SINGLE_TOP); + startActivityForResult(i, REQUEST_PASSWORD); + } + } + @Override public void onDestroy() { super.onDestroy(); -- GitLab