From 426d17bd0aba478e52770449e0adb46d9dc33780 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 27 May 2015 23:03:04 +0200 Subject: [PATCH] correctly preserve state in EncryptTextFragment --- .../keychain/ui/EncryptTextFragment.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java index 7ca2bbb92..09f2365f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java @@ -56,9 +56,10 @@ import java.util.Set; public class EncryptTextFragment extends CryptoOperationFragment { public static final String ARG_TEXT = "text"; + public static final String ARG_USE_COMPRESSION = "use_compression"; - private boolean mShareAfterEncrypt = false; - private boolean mUseCompression = true; + private boolean mShareAfterEncrypt; + private boolean mUseCompression; private boolean mHiddenRecipients = false; private String mMessage = ""; @@ -117,10 +118,21 @@ public class EncryptTextFragment extends CryptoOperationFragment { return view; } + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean(ARG_USE_COMPRESSION, mUseCompression); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mMessage = getArguments().getString(ARG_TEXT); + if (savedInstanceState == null) { + mMessage = getArguments().getString(ARG_TEXT); + } + + Bundle args = savedInstanceState == null ? getArguments() : savedInstanceState; + mUseCompression = args.getBoolean(ARG_USE_COMPRESSION, true); setHasOptionsMenu(true); }