From 5b6c04cbfb08b021864c70478a25b13543e86206 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 29 Sep 2015 05:29:10 +0200 Subject: enc-export: handle onSaveInstanceState, add nicer layout for landscape --- OpenKeychain/src/main/AndroidManifest.xml | 2 +- .../keychain/ui/BackupCodeFragment.java | 105 +++++++++++++-------- .../keychain/ui/widget/ToolableViewAnimator.java | 19 ++++ .../main/res/layout-land/backup_code_fragment.xml | 12 +-- 4 files changed, 93 insertions(+), 45 deletions(-) diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 11e86b28b..2f31d6d63 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -440,7 +440,7 @@ android:windowSoftInputMode="stateHidden" /> = 0) { + mBackStackLevel = savedBackStack; + // unchecked use, we know that this one is available in onViewCreated + getFragmentManager().addOnBackStackChangedListener(this); + } + BackupCodeState savedState = BackupCodeState.values()[savedInstanceState.getInt(ARG_CURRENT_STATE)]; + switchState(savedState, false); + } else if (mCurrentState == BackupCodeState.STATE_UNINITIALIZED) { + switchState(BackupCodeState.STATE_DISPLAY, true); } } + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(ARG_CURRENT_STATE, mCurrentState.ordinal()); + outState.putInt(ARG_BACK_STACK, mBackStackLevel == null ? -1 : mBackStackLevel); + } + private void setupEditTextSuccessListener(final EditText[] backupCodes) { for (EditText backupCode : backupCodes) { @@ -301,17 +332,17 @@ public class BackupCodeFragment extends CryptoOperationFragment + android:paddingTop="20dp"> + custom:initialView="1">