summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/applications
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-09-01 15:25:01 -0700
committerRoman Birg <roman@cyngn.com>2016-05-04 14:27:23 -0700
commitbdc83b4a556e5b74e6f6d3160e01adf45c29b877 (patch)
tree1563cc91a1e062464b85645f8c745e5971922290 /src/com/android/settings/applications
parenteb59535455a63ac697acbe94e7a7c8d3befdb6f2 (diff)
downloadpackages_apps_Settings-bdc83b4a556e5b74e6f6d3160e01adf45c29b877.zip
packages_apps_Settings-bdc83b4a556e5b74e6f6d3160e01adf45c29b877.tar.gz
packages_apps_Settings-bdc83b4a556e5b74e6f6d3160e01adf45c29b877.tar.bz2
LockPatternView: persist state across rotates
We need to persist and restore the activity states across rotates so the user doesn't have to restart from the beginning. Ref: CYNGNOS-141 Change-Id: I18458d55748666b439cf7b6fcecd81ee5c4c7865 Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'src/com/android/settings/applications')
-rw-r--r--src/com/android/settings/applications/LockPatternActivity.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/com/android/settings/applications/LockPatternActivity.java b/src/com/android/settings/applications/LockPatternActivity.java
index 561041d..05d30ec 100644
--- a/src/com/android/settings/applications/LockPatternActivity.java
+++ b/src/com/android/settings/applications/LockPatternActivity.java
@@ -46,6 +46,14 @@ public class LockPatternActivity extends Activity implements OnNotifyAccountRese
public static final String PATTERN_LOCK_PROTECTED_APPS = "pattern_lock_protected_apps";
public static final String RECREATE_PATTERN = "recreate_pattern_lock";
+ private static final String STATE_IS_ACCOUNT_VIEW = "isAccountView";
+ private static final String STATE_CONTINUE_ENABLED = "continueEnabled";
+ private static final String STATE_CONFIRMING = "confirming";
+ private static final String STATE_RETRY_PATTERN = "retrypattern";
+ private static final String STATE_RETRY = "retry";
+ private static final String STATE_PATTERN_HASH = "pattern_hash";
+ private static final String STATE_CREATE = "create";
+
private static String TIMEOUT_PREF_KEY = "retry_timeout";
private static final int MIN_PATTERN_SIZE = 4;
@@ -155,6 +163,35 @@ public class LockPatternActivity extends Activity implements OnNotifyAccountRese
}
@Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(STATE_IS_ACCOUNT_VIEW, mAccountView.getVisibility() == View.VISIBLE);
+ outState.putBoolean(STATE_CONTINUE_ENABLED, mContinue.isEnabled());
+ outState.putBoolean(STATE_CONFIRMING, mConfirming);
+ outState.putBoolean(STATE_RETRY_PATTERN, mRetryPattern);
+ outState.putInt(STATE_RETRY, mRetry);
+ outState.putByteArray(STATE_PATTERN_HASH, mPatternHash);
+ outState.putBoolean(STATE_CREATE, mCreate);
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ if (savedInstanceState.getBoolean(STATE_IS_ACCOUNT_VIEW)) {
+ switchToAccount();
+ } else {
+ switchToPattern(false);
+ mPatternHash = savedInstanceState.getByteArray(STATE_PATTERN_HASH);
+ mConfirming = savedInstanceState.getBoolean(STATE_CONFIRMING);
+ mRetryPattern = savedInstanceState.getBoolean(STATE_RETRY_PATTERN);
+ mRetry = savedInstanceState.getInt(STATE_RETRY);
+ mCreate = savedInstanceState.getBoolean(STATE_CREATE);
+ mContinue.setEnabled(savedInstanceState.getBoolean(STATE_CONTINUE_ENABLED,
+ mContinue.isEnabled()));
+ }
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_RESET:
@@ -224,7 +261,6 @@ public class LockPatternActivity extends Activity implements OnNotifyAccountRese
resetPatternState(false);
//Setup Pattern Lock View
- mLockPatternView.setSaveEnabled(false);
mLockPatternView.setFocusable(false);
mLockPatternView.setOnPatternListener(new UnlockPatternListener());