aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2016-02-15 16:29:23 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2016-02-22 15:06:45 +0100
commit15488c544584f5515c83c9fbcf4d09055ba7af3d (patch)
treeaaa7bb2dce4580dbacbda84344bba7eb6bbfe01d /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui
parenteef27a544f5101d4fa46e9246d74b2b7db65ce73 (diff)
downloadopen-keychain-15488c544584f5515c83c9fbcf4d09055ba7af3d.tar.gz
open-keychain-15488c544584f5515c83c9fbcf4d09055ba7af3d.tar.bz2
open-keychain-15488c544584f5515c83c9fbcf4d09055ba7af3d.zip
Split remote methods from activities for better seperation
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteImportKeysActivity.java47
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemotePassphraseDialogActivity.java46
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityTokenOperationActivity.java13
3 files changed, 100 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteImportKeysActivity.java
new file mode 100644
index 000000000..b57c50790
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteImportKeysActivity.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.sufficientlysecure.keychain.remote.ui;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
+import org.sufficientlysecure.keychain.remote.CryptoInputParcelCacheService;
+import org.sufficientlysecure.keychain.ui.ImportKeysActivity;
+import org.sufficientlysecure.keychain.ui.SecurityTokenOperationActivity;
+
+public class RemoteImportKeysActivity extends ImportKeysActivity {
+
+ public static final String EXTRA_DATA = "data";
+
+ private Intent mPendingIntentData;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mPendingIntentData = getIntent().getParcelableExtra(EXTRA_DATA);
+ }
+
+ @Override
+ public void handleResult(ImportKeyResult result) {
+ setResult(RESULT_OK, mPendingIntentData);
+ finish();
+ }
+
+}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemotePassphraseDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemotePassphraseDialogActivity.java
new file mode 100644
index 000000000..645146c8d
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemotePassphraseDialogActivity.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.sufficientlysecure.keychain.remote.ui;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+import org.sufficientlysecure.keychain.remote.CryptoInputParcelCacheService;
+import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
+import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
+
+public class RemotePassphraseDialogActivity extends PassphraseDialogActivity {
+
+ public static final String EXTRA_DATA = "data";
+
+ private Intent mPendingIntentData;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mPendingIntentData = getIntent().getParcelableExtra(EXTRA_DATA);
+ }
+
+ @Override
+ protected void handleResult(CryptoInputParcel inputParcel) {
+ CryptoInputParcelCacheService.addCryptoInputParcel(this, mPendingIntentData, inputParcel);
+ setResult(RESULT_OK, mPendingIntentData);
+ }
+
+}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityTokenOperationActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityTokenOperationActivity.java
index 1231f890b..a9aa35da1 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityTokenOperationActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityTokenOperationActivity.java
@@ -21,13 +21,14 @@ import android.content.Intent;
import android.os.Bundle;
import org.sufficientlysecure.keychain.remote.CryptoInputParcelCacheService;
+import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.SecurityTokenOperationActivity;
public class RemoteSecurityTokenOperationActivity extends SecurityTokenOperationActivity {
- public static final String EXTRA_SERVICE_INTENT = "data";
+ public static final String EXTRA_DATA = "data";
- private Intent mServiceIntent;
+ private Intent mPendingIntentData;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -35,14 +36,14 @@ public class RemoteSecurityTokenOperationActivity extends SecurityTokenOperation
Intent intent = getIntent();
Bundle data = intent.getExtras();
- mServiceIntent = data.getParcelable(EXTRA_SERVICE_INTENT);
+ mPendingIntentData = data.getParcelable(EXTRA_DATA);
}
@Override
- protected void returnResult() {
+ protected void handleResult(CryptoInputParcel inputParcel) {
// save updated cryptoInputParcel in cache
- CryptoInputParcelCacheService.addCryptoInputParcel(this, mServiceIntent, mInputParcel);
- setResult(RESULT_OK, mServiceIntent);
+ CryptoInputParcelCacheService.addCryptoInputParcel(this, mPendingIntentData, inputParcel);
+ setResult(RESULT_OK, mPendingIntentData);
}
}