aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java20
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java42
2 files changed, 20 insertions, 42 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
index 581a96e52..58dce50a7 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java
@@ -36,7 +36,7 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
-import org.sufficientlysecure.keychain.service.KeychainIntentService;
+import org.sufficientlysecure.keychain.service.KeychainService;
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
import org.sufficientlysecure.keychain.util.Log;
@@ -130,17 +130,17 @@ public class DeleteKeyDialogFragment extends DialogFragment {
public void onClick(DialogInterface dialog, int which) {
// Send all information needed to service to import key in other thread
- Intent intent = new Intent(getActivity(), KeychainIntentService.class);
+ Intent intent = new Intent(getActivity(), KeychainService.class);
- intent.setAction(KeychainIntentService.ACTION_DELETE);
+ intent.setAction(KeychainService.ACTION_DELETE);
- // Message is received after importing is done in KeychainIntentService
+ // Message is received after importing is done in KeychainService
ServiceProgressHandler saveHandler = new ServiceProgressHandler(
getActivity(),
getString(R.string.progress_deleting),
ProgressDialog.STYLE_HORIZONTAL,
- true,
- ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
+ true
+ ) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
@@ -159,13 +159,13 @@ public class DeleteKeyDialogFragment extends DialogFragment {
// fill values for this action
Bundle data = new Bundle();
- data.putLongArray(KeychainIntentService.DELETE_KEY_LIST, masterKeyIds);
- data.putBoolean(KeychainIntentService.DELETE_IS_SECRET, hasSecret);
- intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
+ data.putLongArray(KeychainService.DELETE_KEY_LIST, masterKeyIds);
+ data.putBoolean(KeychainService.DELETE_IS_SECRET, hasSecret);
+ intent.putExtra(KeychainService.EXTRA_DATA, data);
// Create a new Messenger for the communication back
Messenger messenger = new Messenger(saveHandler);
- intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
+ intent.putExtra(KeychainService.EXTRA_MESSENGER, messenger);
// show progress dialog
saveHandler.showProgressDialog(getActivity());
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
index 562517c12..52a90b323 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java
@@ -19,7 +19,6 @@ package org.sufficientlysecure.keychain.ui.dialog;
import android.app.Activity;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnKeyListener;
@@ -27,31 +26,25 @@ import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.v4.app.DialogFragment;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
-import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
-import org.sufficientlysecure.keychain.service.CloudImportService;
-import org.sufficientlysecure.keychain.service.KeychainIntentService;
-import org.sufficientlysecure.keychain.util.Log;
+import org.sufficientlysecure.keychain.service.KeychainService;
+/**
+ * meant to be used
+ */
public class ProgressDialogFragment extends DialogFragment {
private static final String ARG_MESSAGE = "message";
private static final String ARG_STYLE = "style";
private static final String ARG_CANCELABLE = "cancelable";
private static final String ARG_SERVICE_TYPE = "service_class";
- public enum ServiceType {
- KEYCHAIN_INTENT,
- CLOUD_IMPORT
- }
-
- ServiceType mServiceType;
-
boolean mCanCancel = false, mPreventCancel = false, mIsCancelled = false;
/**
@@ -59,16 +52,14 @@ public class ProgressDialogFragment extends DialogFragment {
* @param message the message to be displayed initially above the progress bar
* @param style the progress bar style, as defined in ProgressDialog (horizontal or spinner)
* @param cancelable should we let the user cancel this operation
- * @param serviceType which Service this progress dialog is meant for
+ * @return
*/
- public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable,
- ServiceType serviceType) {
+ public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable) {
ProgressDialogFragment frag = new ProgressDialogFragment();
Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
args.putInt(ARG_STYLE, style);
args.putBoolean(ARG_CANCELABLE, cancelable);
- args.putSerializable(ARG_SERVICE_TYPE, serviceType);
frag.setArguments(args);
@@ -121,7 +112,6 @@ public class ProgressDialogFragment extends DialogFragment {
String message = getArguments().getString(ARG_MESSAGE);
int style = getArguments().getInt(ARG_STYLE);
mCanCancel = getArguments().getBoolean(ARG_CANCELABLE);
- mServiceType = (ServiceType) getArguments().getSerializable(ARG_SERVICE_TYPE);
dialog.setMessage(message);
dialog.setProgressStyle(style);
@@ -189,23 +179,11 @@ public class ProgressDialogFragment extends DialogFragment {
negative.setTextColor(Color.GRAY);
// send a cancel message. note that this message will be handled by
- // KeychainIntentService.onStartCommand, which runs in this thread,
+ // KeychainService.onStartCommand, which runs in this thread,
// not the service one, and will not queue up a command.
- Intent serviceIntent = null;
-
- switch (mServiceType) {
- case CLOUD_IMPORT:
- serviceIntent = new Intent(getActivity(), CloudImportService.class);
- break;
- case KEYCHAIN_INTENT:
- serviceIntent = new Intent(getActivity(), KeychainIntentService.class);
- break;
- default:
- //should never happen, unless we forget to include a ServiceType enum case
- Log.e(Constants.TAG, "Unrecognized ServiceType at ProgressDialogFragment");
- }
+ Intent serviceIntent = new Intent(getActivity(), KeychainService.class);
- serviceIntent.setAction(KeychainIntentService.ACTION_CANCEL);
+ serviceIntent.setAction(KeychainService.ACTION_CANCEL);
getActivity().startService(serviceIntent);
// Set the progress bar accordingly