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); }