diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java | 39 |
1 files changed, 8 insertions, 31 deletions
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..130d22b37 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 @@ -33,25 +33,18 @@ 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,13 @@ 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 */ - 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 +111,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 +178,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 |