mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
fix fragment handling in ViewKeyActivity
Conflicts: OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
This commit is contained in:
parent
8c97bee14c
commit
022fde29ae
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user