aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java40
1 files changed, 12 insertions, 28 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
index 5466c0b9a..7d57538b6 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -274,9 +274,19 @@ public class ViewKeyActivity extends BaseNfcActivity implements
result.createNotify(this).show();
}
- startFragment(savedInstanceState, mDataUri);
+ // Fragments are stored, no need to recreate those
+ if (savedInstanceState != null) {
+ return;
+ }
- if (savedInstanceState == null && getIntent().hasExtra(EXTRA_NFC_AID)) {
+ FragmentManager manager = getSupportFragmentManager();
+ // Create an instance of the fragment
+ final ViewKeyFragment frag = ViewKeyFragment.newInstance(mDataUri);
+ manager.beginTransaction()
+ .replace(R.id.view_key_fragment, frag)
+ .commit();
+
+ if (getIntent().hasExtra(EXTRA_NFC_AID)) {
Intent intent = getIntent();
byte[] nfcFingerprints = intent.getByteArrayExtra(EXTRA_NFC_FINGERPRINTS);
String nfcUserId = intent.getStringExtra(EXTRA_NFC_USER_ID);
@@ -291,26 +301,6 @@ public class ViewKeyActivity extends BaseNfcActivity implements
setContentView(R.layout.view_key_activity);
}
- private void startFragment(Bundle savedInstanceState, Uri dataUri) {
- // However, if we're being restored from a previous state,
- // then we don't need to do anything and should return or else
- // we could end up with overlapping fragments.
- if (savedInstanceState != null) {
- return;
- }
-
- // Create an instance of the fragment
- ViewKeyFragment frag = ViewKeyFragment.newInstance(dataUri);
-
- // Add the fragment to the 'fragment_container' FrameLayout
- // NOTE: We use commitAllowingStateLoss() to prevent weird crashes!
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.view_key_fragment, frag)
- .commitAllowingStateLoss();
- // do it immediately!
- getSupportFragmentManager().executePendingTransactions();
- }
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
@@ -435,12 +425,6 @@ public class ViewKeyActivity extends BaseNfcActivity implements
startActivityForResult(intent, 0);
}
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- //Note:-Done due to the same weird crashes as for commitAllowingStateLoss()
- //super.onSaveInstanceState(outState);
- }
-
private void showQrCodeDialog() {
Intent qrCodeIntent = new Intent(this, QrCodeViewActivity.class);