aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorAdithya Abraham Philip <adithyaphilip@gmail.com>2016-01-09 03:00:26 +0530
committerAdithya Abraham Philip <adithyaphilip@gmail.com>2016-01-09 03:00:26 +0530
commitd30a7d8b81d1c063d66441bd953c49f34fbf08f4 (patch)
tree4c07dea7d78147a002e438b411b1ef9dc957c87f /OpenKeychain
parent9163b93a907a29dab04e1ca99b175b097d1e9d91 (diff)
downloadopen-keychain-d30a7d8b81d1c063d66441bd953c49f34fbf08f4.tar.gz
open-keychain-d30a7d8b81d1c063d66441bd953c49f34fbf08f4.tar.bz2
open-keychain-d30a7d8b81d1c063d66441bd953c49f34fbf08f4.zip
fixed file import issue due to onResumeFragments
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
index c54f55b6f..1fe3df869 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
@@ -21,6 +21,7 @@ import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
@@ -89,10 +90,15 @@ public class ImportKeysActivity extends BaseNfcActivity
private CryptoOperationHelper<ImportKeyringParcel, ImportKeyResult> mOperationHelper;
+ private boolean mFreshIntent;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ // we're started with a new Intent that needs to be handled by onResumeFragments
+ mFreshIntent = true;
+
setFullScreenDialogClose(Activity.RESULT_CANCELED, true);
findViewById(R.id.import_import).setOnClickListener(new OnClickListener() {
@Override
@@ -116,15 +122,22 @@ public class ImportKeysActivity extends BaseNfcActivity
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
+ // new Intent, so onResumeFragments needs to handle it with handleActions(Intent)
+ mFreshIntent = true;
}
@Override
protected void onResumeFragments() {
super.onResumeFragments();
- handleActions(getIntent());
+ if (mFreshIntent) {
+ handleActions(getIntent());
+ // we've consumed this Intent, we don't want to repeat the action it represents
+ // every time the activity is resumed
+ mFreshIntent = false;
+ }
}
- protected void handleActions(Intent intent) {
+ protected void handleActions(@NonNull Intent intent) {
String action = intent.getAction();
Bundle extras = intent.getExtras();
Uri dataUri = intent.getData();