diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-05-28 18:55:34 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-05-28 18:55:34 +0200 |
commit | 1deb5dbfda73b0fa72c132c318d9fb7a46aafeee (patch) | |
tree | da116bcdc4cee59efb77afa3f571b52c127532b0 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java | |
parent | 34c26fe5d1b0ae3b69a264d56e2b3752711410ca (diff) | |
download | open-keychain-1deb5dbfda73b0fa72c132c318d9fb7a46aafeee.tar.gz open-keychain-1deb5dbfda73b0fa72c132c318d9fb7a46aafeee.tar.bz2 open-keychain-1deb5dbfda73b0fa72c132c318d9fb7a46aafeee.zip |
preserve state in DecryptTextActivity
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java index 381da6f0d..a666c2357 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextFragment.java @@ -28,8 +28,6 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; -import android.widget.LinearLayout; import android.widget.TextView; import org.sufficientlysecure.keychain.Constants; @@ -48,17 +46,15 @@ import java.io.UnsupportedEncodingException; public class DecryptTextFragment extends DecryptFragment { public static final String ARG_CIPHERTEXT = "ciphertext"; + public static final String ARG_SHOW_MENU = "show_menu"; // view private TextView mText; // model private String mCiphertext; - private boolean mShowMenuOptions = false; + private boolean mShowMenuOptions; - /** - * Creates new instance of this fragment - */ public static DecryptTextFragment newInstance(String ciphertext) { DecryptTextFragment frag = new DecryptTextFragment(); @@ -115,11 +111,24 @@ public class DecryptTextFragment extends DecryptFragment { setHasOptionsMenu(true); - String ciphertext = getArguments().getString(ARG_CIPHERTEXT); - if (ciphertext != null) { - mCiphertext = ciphertext; + Bundle args = savedInstanceState == null ? getArguments() : savedInstanceState; + mCiphertext = args.getString(ARG_CIPHERTEXT); + mShowMenuOptions = args.getBoolean(ARG_SHOW_MENU, false); + + if (savedInstanceState == null) { cryptoOperation(new CryptoInputParcel()); } + + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + + outState.putString(ARG_CIPHERTEXT, mCiphertext); + outState.putBoolean(ARG_SHOW_MENU, mShowMenuOptions); + // no need to save the decrypted text, it's in the textview + } @Override |