use only one DeleteDialogActivity
This commit is contained in:
@@ -685,9 +685,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.DeleteKeyDialogActivity"
|
android:name=".ui.DeleteKeyDialogActivity"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
<activity
|
|
||||||
android:name=".ui.RevokeDeleteDialogActivity"
|
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.OrbotRequiredDialogActivity"
|
android:name=".ui.OrbotRequiredDialogActivity"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
|
|||||||
@@ -764,7 +764,7 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
MSG_REVOKE_ERROR_MULTI_SECRET (LogLevel.DEBUG, R.string.msg_revoke_error_multi_secret),
|
MSG_REVOKE_ERROR_MULTI_SECRET (LogLevel.DEBUG, R.string.msg_revoke_error_multi_secret),
|
||||||
MSG_REVOKE_ERROR_NOT_FOUND (LogLevel.DEBUG, R.string.msg_revoke_error_multi_secret),
|
MSG_REVOKE_ERROR_NOT_FOUND (LogLevel.DEBUG, R.string.msg_revoke_error_multi_secret),
|
||||||
MSG_REVOKE (LogLevel.DEBUG, R.string.msg_revoke_key),
|
MSG_REVOKE (LogLevel.DEBUG, R.string.msg_revoke_key),
|
||||||
MSG_REVOKE_KEY_FAIL (LogLevel.WARN, R.string.msg_revoke_key_fail),
|
MSG_REVOKE_KEY_FAIL (LogLevel.ERROR, R.string.msg_revoke_key_fail),
|
||||||
MSG_REVOKE_OK (LogLevel.OK, R.string.msg_revoke_ok),
|
MSG_REVOKE_OK (LogLevel.OK, R.string.msg_revoke_ok),
|
||||||
|
|
||||||
// keybase verification
|
// keybase verification
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -8,32 +10,40 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
|
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||||
|
import org.sufficientlysecure.keychain.operations.results.RevokeResult;
|
||||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.service.DeleteKeyringParcel;
|
import org.sufficientlysecure.keychain.service.DeleteKeyringParcel;
|
||||||
|
import org.sufficientlysecure.keychain.service.RevokeKeyringParcel;
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class DeleteKeyDialogActivity extends FragmentActivity
|
public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||||
implements CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult> {
|
|
||||||
public static final String EXTRA_DELETE_MASTER_KEY_IDS = "extra_delete_master_key_ids";
|
public static final String EXTRA_DELETE_MASTER_KEY_IDS = "extra_delete_master_key_ids";
|
||||||
|
public static final String EXTRA_HAS_SECRET = "extra_has_secret";
|
||||||
|
public static final String EXTRA_KEYSERVER = "extra_keyserver";
|
||||||
|
|
||||||
private CryptoOperationHelper<DeleteKeyringParcel, DeleteResult> mDeleteOpHelper;
|
private CryptoOperationHelper<DeleteKeyringParcel, DeleteResult> mDeleteOpHelper;
|
||||||
|
private CryptoOperationHelper<RevokeKeyringParcel, RevokeResult> mRevokeOpHelper;
|
||||||
|
|
||||||
private long[] mMasterKeyIds;
|
private long[] mMasterKeyIds;
|
||||||
private boolean mHasSecret;
|
private boolean mHasSecret;
|
||||||
@@ -42,95 +52,168 @@ public class DeleteKeyDialogActivity extends FragmentActivity
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mDeleteOpHelper = new CryptoOperationHelper<>(DeleteKeyDialogActivity.this,
|
mDeleteOpHelper = new CryptoOperationHelper<>(1, DeleteKeyDialogActivity.this,
|
||||||
DeleteKeyDialogActivity.this, R.string.progress_deleting);
|
getDeletionCallback(), R.string.progress_deleting);
|
||||||
mDeleteOpHelper.onRestoreInstanceState(savedInstanceState);
|
|
||||||
|
mRevokeOpHelper = new CryptoOperationHelper<>(2, this,
|
||||||
|
getRevocationCallback(), R.string.progress_revoking_uploading);
|
||||||
|
|
||||||
mMasterKeyIds = getIntent().getLongArrayExtra(EXTRA_DELETE_MASTER_KEY_IDS);
|
mMasterKeyIds = getIntent().getLongArrayExtra(EXTRA_DELETE_MASTER_KEY_IDS);
|
||||||
|
mHasSecret = getIntent().getBooleanExtra(EXTRA_HAS_SECRET, false);
|
||||||
|
|
||||||
Handler deleteDialogHandler = new Handler() {
|
if (mMasterKeyIds.length > 1 && mHasSecret) {
|
||||||
@Override
|
throw new AssertionError("Secret keys can be deleted only one at a time!" +
|
||||||
public void handleMessage(Message msg) {
|
" Should be checked before reaching DeleteKeyDialogActivity.");
|
||||||
if (msg.what == DeleteKeyDialogFragment.MESSAGE_PERFORM_DELETE) {
|
}
|
||||||
mHasSecret = msg.getData().getBoolean(DeleteKeyDialogFragment.MSG_HAS_SECRET);
|
|
||||||
mDeleteOpHelper.cryptoOperation();
|
if (mMasterKeyIds.length == 1 && mHasSecret) {
|
||||||
|
// if mMasterKeyIds.length == 0 we let the DeleteOperation respond
|
||||||
|
try {
|
||||||
|
HashMap<String, Object> data = new ProviderHelper(this).getUnifiedData(
|
||||||
|
mMasterKeyIds[0], new String[]{
|
||||||
|
KeychainContract.KeyRings.USER_ID,
|
||||||
|
KeychainContract.KeyRings.IS_REVOKED
|
||||||
|
}, new int[]{
|
||||||
|
ProviderHelper.FIELD_TYPE_STRING,
|
||||||
|
ProviderHelper.FIELD_TYPE_INTEGER
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if ((long) data.get(KeychainContract.KeyRings.IS_REVOKED) > 0) {
|
||||||
|
showNormalDeleteDialog();
|
||||||
|
} else {
|
||||||
|
showRevokeDeleteDialog();
|
||||||
}
|
}
|
||||||
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
|
Log.e(Constants.TAG,
|
||||||
|
"Secret key to delete not found at DeleteKeyDialogActivity for "
|
||||||
|
+ mMasterKeyIds[0], e);
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showNormalDeleteDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNormalDeleteDialog() {
|
||||||
|
|
||||||
|
DeleteKeyDialogFragment deleteKeyDialogFragment
|
||||||
|
= DeleteKeyDialogFragment.newInstance(mMasterKeyIds);
|
||||||
|
|
||||||
|
deleteKeyDialogFragment.show(getSupportFragmentManager(), "deleteKeyDialog");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showRevokeDeleteDialog() {
|
||||||
|
|
||||||
|
RevokeDeleteDialogFragment fragment = RevokeDeleteDialogFragment.newInstance();
|
||||||
|
fragment.show(getSupportFragmentManager(), "deleteRevokeDialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startRevocationOperation() {
|
||||||
|
mRevokeOpHelper.cryptoOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startDeletionOperation() {
|
||||||
|
mDeleteOpHelper.cryptoOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult> getRevocationCallback() {
|
||||||
|
|
||||||
|
CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult> callback
|
||||||
|
= new CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult>() {
|
||||||
|
@Override
|
||||||
|
public RevokeKeyringParcel createOperationInput() {
|
||||||
|
return new RevokeKeyringParcel(mMasterKeyIds[0], true,
|
||||||
|
getIntent().getStringExtra(EXTRA_KEYSERVER));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationSuccess(RevokeResult result) {
|
||||||
|
returnResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationCancelled() {
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationError(RevokeResult result) {
|
||||||
|
returnResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Messenger messenger = new Messenger(deleteDialogHandler);
|
return callback;
|
||||||
|
|
||||||
DeleteKeyDialogFragment deleteKeyDialogFragment
|
|
||||||
= DeleteKeyDialogFragment.newInstance(messenger, mMasterKeyIds);
|
|
||||||
|
|
||||||
deleteKeyDialogFragment.show(getSupportFragmentManager(), "deleteKeyDialog");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult> getDeletionCallback() {
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
mDeleteOpHelper.handleActivityResult(requestCode, resultCode, data);
|
CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult> callback
|
||||||
|
= new CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult>() {
|
||||||
|
@Override
|
||||||
|
public DeleteKeyringParcel createOperationInput() {
|
||||||
|
return new DeleteKeyringParcel(mMasterKeyIds, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationSuccess(DeleteResult result) {
|
||||||
|
returnResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationCancelled() {
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCryptoOperationError(DeleteResult result) {
|
||||||
|
returnResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void returnResult(OperationResult result) {
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
mDeleteOpHelper.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeleteKeyringParcel createOperationInput() {
|
|
||||||
return new DeleteKeyringParcel(mMasterKeyIds, mHasSecret);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationSuccess(DeleteResult result) {
|
|
||||||
handleResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationCancelled() {
|
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationError(DeleteResult result) {
|
|
||||||
handleResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleResult(DeleteResult result) {
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
mDeleteOpHelper.handleActivityResult(requestCode, resultCode, data);
|
||||||
|
mRevokeOpHelper.handleActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
public static class DeleteKeyDialogFragment extends DialogFragment {
|
public static class DeleteKeyDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
public static final String MSG_HAS_SECRET = "msg_has_secret";
|
|
||||||
|
|
||||||
private static final String ARG_MESSENGER = "messenger";
|
|
||||||
private static final String ARG_DELETE_MASTER_KEY_IDS = "delete_master_key_ids";
|
private static final String ARG_DELETE_MASTER_KEY_IDS = "delete_master_key_ids";
|
||||||
|
|
||||||
public static final int MESSAGE_PERFORM_DELETE = 1;
|
|
||||||
|
|
||||||
private TextView mMainMessage;
|
private TextView mMainMessage;
|
||||||
private View mInflateView;
|
private View mInflateView;
|
||||||
|
|
||||||
private Messenger mMessenger;
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of this delete file dialog fragment
|
* Creates new instance of this delete file dialog fragment
|
||||||
*/
|
*/
|
||||||
public static DeleteKeyDialogFragment newInstance(Messenger messenger, long[] masterKeyIds) {
|
public static DeleteKeyDialogFragment newInstance(long[] masterKeyIds) {
|
||||||
DeleteKeyDialogFragment frag = new DeleteKeyDialogFragment();
|
DeleteKeyDialogFragment frag = new DeleteKeyDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|
||||||
args.putParcelable(ARG_MESSENGER, messenger);
|
|
||||||
args.putLongArray(ARG_DELETE_MASTER_KEY_IDS, masterKeyIds);
|
args.putLongArray(ARG_DELETE_MASTER_KEY_IDS, masterKeyIds);
|
||||||
|
|
||||||
frag.setArguments(args);
|
frag.setArguments(args);
|
||||||
@@ -138,10 +221,10 @@ public class DeleteKeyDialogActivity extends FragmentActivity
|
|||||||
return frag;
|
return frag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
final FragmentActivity activity = getActivity();
|
final FragmentActivity activity = getActivity();
|
||||||
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
|
|
||||||
|
|
||||||
final long[] masterKeyIds = getArguments().getLongArray(ARG_DELETE_MASTER_KEY_IDS);
|
final long[] masterKeyIds = getArguments().getLongArray(ARG_DELETE_MASTER_KEY_IDS);
|
||||||
|
|
||||||
@@ -151,7 +234,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity
|
|||||||
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
|
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
|
||||||
|
|
||||||
// Setup custom View to display in AlertDialog
|
// Setup custom View to display in AlertDialog
|
||||||
LayoutInflater inflater = activity.getLayoutInflater();
|
LayoutInflater inflater = LayoutInflater.from(theme);
|
||||||
mInflateView = inflater.inflate(R.layout.view_key_delete_fragment, null);
|
mInflateView = inflater.inflate(R.layout.view_key_delete_fragment, null);
|
||||||
builder.setView(mInflateView);
|
builder.setView(mInflateView);
|
||||||
|
|
||||||
@@ -196,23 +279,13 @@ public class DeleteKeyDialogActivity extends FragmentActivity
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mMainMessage.setText(R.string.key_deletion_confirmation_multi);
|
mMainMessage.setText(R.string.key_deletion_confirmation_multi);
|
||||||
hasSecret = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setPositiveButton(R.string.btn_delete, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.btn_delete, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
Bundle data = new Bundle();
|
((DeleteKeyDialogActivity) getActivity()).startDeletionOperation();
|
||||||
data.putBoolean(MSG_HAS_SECRET, hasSecret);
|
|
||||||
Message msg = Message.obtain();
|
|
||||||
msg.setData(data);
|
|
||||||
msg.what = MESSAGE_PERFORM_DELETE;
|
|
||||||
try {
|
|
||||||
mMessenger.send(msg);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(Constants.TAG, "messenger error", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,4 +301,88 @@ public class DeleteKeyDialogActivity extends FragmentActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RevokeDeleteDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
public static RevokeDeleteDialogFragment newInstance() {
|
||||||
|
RevokeDeleteDialogFragment frag = new RevokeDeleteDialogFragment();
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
|
final String CHOICE_REVOKE = getString(R.string.del_rev_dialog_choice_rev_upload);
|
||||||
|
final String CHOICE_DELETE = getString(R.string.del_rev_dialog_choice_delete);
|
||||||
|
|
||||||
|
// if the dialog is displayed from the application class, design is missing
|
||||||
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
|
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
|
||||||
|
R.style.Theme_AppCompat_Light_Dialog);
|
||||||
|
|
||||||
|
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme);
|
||||||
|
alert.setTitle(R.string.del_rev_dialog_title);
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(theme);
|
||||||
|
View view = inflater.inflate(R.layout.del_rev_dialog, null);
|
||||||
|
alert.setView(view);
|
||||||
|
|
||||||
|
final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
|
||||||
|
|
||||||
|
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
activity.setResult(RESULT_CANCELED);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alert.setPositiveButton(R.string.del_rev_dialog_btn_revoke,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
|
String choice = spinner.getSelectedItem().toString();
|
||||||
|
if (choice.equals(CHOICE_REVOKE)) {
|
||||||
|
((DeleteKeyDialogActivity) activity)
|
||||||
|
.startRevocationOperation();
|
||||||
|
} else if (choice.equals(CHOICE_DELETE)) {
|
||||||
|
((DeleteKeyDialogActivity) activity)
|
||||||
|
.startDeletionOperation();
|
||||||
|
} else {
|
||||||
|
throw new AssertionError(
|
||||||
|
"Unsupported delete type in RevokeDeleteDialogFragment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final AlertDialog alertDialog = alert.show();
|
||||||
|
|
||||||
|
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
|
|
||||||
|
String choice = parent.getItemAtPosition(pos).toString();
|
||||||
|
|
||||||
|
if (choice.equals(CHOICE_REVOKE)) {
|
||||||
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||||
|
.setText(R.string.del_rev_dialog_btn_revoke);
|
||||||
|
} else if (choice.equals(CHOICE_DELETE)) {
|
||||||
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||||
|
.setText(R.string.del_rev_dialog_btn_delete);
|
||||||
|
} else {
|
||||||
|
throw new AssertionError(
|
||||||
|
"Unsupported delete type in RevokeDeleteDialogFragment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return alertDialog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,6 +366,11 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
|
|
||||||
Intent intent = new Intent(getActivity(), DeleteKeyDialogActivity.class);
|
Intent intent = new Intent(getActivity(), DeleteKeyDialogActivity.class);
|
||||||
intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS, masterKeyIds);
|
intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS, masterKeyIds);
|
||||||
|
intent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET, hasSecret);
|
||||||
|
if (hasSecret) {
|
||||||
|
intent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,
|
||||||
|
Preferences.getPreferences(getActivity()).getPreferredKeyserver());
|
||||||
|
}
|
||||||
startActivityForResult(intent, REQUEST_DELETE);
|
startActivityForResult(intent, REQUEST_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +608,9 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case REQUEST_DELETE:
|
case REQUEST_DELETE:
|
||||||
mActionMode.finish();
|
if (mActionMode != null) {
|
||||||
|
mActionMode.finish();
|
||||||
|
}
|
||||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||||
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||||
result.createNotify(getActivity()).show();
|
result.createNotify(getActivity()).show();
|
||||||
|
|||||||
@@ -1,258 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
|
|
||||||
* Copyright (C) 2015 Adithya Abraham Philip <adithyaphilip@gmail.com>
|
|
||||||
*
|
|
||||||
* 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.ui;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
|
||||||
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
|
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
|
||||||
import org.sufficientlysecure.keychain.operations.results.RevokeResult;
|
|
||||||
import org.sufficientlysecure.keychain.service.DeleteKeyringParcel;
|
|
||||||
import org.sufficientlysecure.keychain.service.RevokeKeyringParcel;
|
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
|
||||||
import org.sufficientlysecure.keychain.util.Preferences;
|
|
||||||
|
|
||||||
public class RevokeDeleteDialogActivity extends FragmentActivity {
|
|
||||||
|
|
||||||
public static final String EXTRA_MASTER_KEY_ID = "extra_master_key_id";
|
|
||||||
public static final String EXTRA_KEYSERVER = "extra_keyserver";
|
|
||||||
|
|
||||||
private final int REVOKE_OP_ID = 1;
|
|
||||||
private final int DELETE_OP_ID = 2;
|
|
||||||
private CryptoOperationHelper<RevokeKeyringParcel, RevokeResult> mRevokeOpHelper;
|
|
||||||
private CryptoOperationHelper<DeleteKeyringParcel, DeleteResult> mDeleteOpHelper;
|
|
||||||
|
|
||||||
private long mMasterKeyId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
mRevokeOpHelper = new CryptoOperationHelper<>(this,
|
|
||||||
getRevocationCallback(), R.string.progress_revoking_uploading, REVOKE_OP_ID);
|
|
||||||
mRevokeOpHelper.onRestoreInstanceState(savedInstanceState);
|
|
||||||
|
|
||||||
mDeleteOpHelper = new CryptoOperationHelper<>(this,
|
|
||||||
getDeletionCallback(), R.string.progress_deleting, DELETE_OP_ID);
|
|
||||||
mDeleteOpHelper.onRestoreInstanceState(savedInstanceState);
|
|
||||||
|
|
||||||
mMasterKeyId = getIntent().getLongExtra(EXTRA_MASTER_KEY_ID, -1);
|
|
||||||
|
|
||||||
RevokeDeleteDialogFragment fragment = RevokeDeleteDialogFragment.newInstance();
|
|
||||||
fragment.show(getSupportFragmentManager(), "deleteRevokeDialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
mDeleteOpHelper.handleActivityResult(requestCode, resultCode, data);
|
|
||||||
mRevokeOpHelper.handleActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
mRevokeOpHelper.onSaveInstanceState(outState);
|
|
||||||
mDeleteOpHelper.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void returnResult(OperationResult result) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
|
||||||
setResult(RESULT_OK, intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult> getRevocationCallback() {
|
|
||||||
|
|
||||||
CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult> callback
|
|
||||||
= new CryptoOperationHelper.Callback<RevokeKeyringParcel, RevokeResult>() {
|
|
||||||
@Override
|
|
||||||
public RevokeKeyringParcel createOperationInput() {
|
|
||||||
return new RevokeKeyringParcel(mMasterKeyId, true,
|
|
||||||
getIntent().getStringExtra(EXTRA_KEYSERVER));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationSuccess(RevokeResult result) {
|
|
||||||
returnResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationCancelled() {
|
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationError(RevokeResult result) {
|
|
||||||
returnResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult> getDeletionCallback() {
|
|
||||||
|
|
||||||
CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult> callback
|
|
||||||
= new CryptoOperationHelper.Callback<DeleteKeyringParcel, DeleteResult>() {
|
|
||||||
@Override
|
|
||||||
public DeleteKeyringParcel createOperationInput() {
|
|
||||||
return new DeleteKeyringParcel(new long[]{mMasterKeyId}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationSuccess(DeleteResult result) {
|
|
||||||
returnResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationCancelled() {
|
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCryptoOperationError(DeleteResult result) {
|
|
||||||
returnResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startRevocationOperation() {
|
|
||||||
mRevokeOpHelper.cryptoOperation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startDeletionOperation() {
|
|
||||||
mDeleteOpHelper.cryptoOperation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class RevokeDeleteDialogFragment extends DialogFragment {
|
|
||||||
|
|
||||||
public static RevokeDeleteDialogFragment newInstance() {
|
|
||||||
RevokeDeleteDialogFragment frag = new RevokeDeleteDialogFragment();
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
final Activity activity = getActivity();
|
|
||||||
|
|
||||||
final String CHOICE_REVOKE = getString(R.string.del_rev_dialog_choice_rev_upload);
|
|
||||||
final String CHOICE_DELETE = getString(R.string.del_rev_dialog_choice_delete);
|
|
||||||
|
|
||||||
// if the dialog is displayed from the application class, design is missing
|
|
||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
|
|
||||||
R.style.Theme_AppCompat_Light_Dialog);
|
|
||||||
|
|
||||||
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme);
|
|
||||||
alert.setTitle(R.string.del_rev_dialog_title);
|
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(theme);
|
|
||||||
View view = inflater.inflate(R.layout.del_rev_dialog, null);
|
|
||||||
alert.setView(view);
|
|
||||||
|
|
||||||
final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
|
|
||||||
|
|
||||||
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
dialog.cancel();
|
|
||||||
activity.setResult(RESULT_CANCELED);
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alert.setPositiveButton(R.string.del_rev_dialog_btn_revoke,
|
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
String choice = spinner.getSelectedItem().toString();
|
|
||||||
if (choice.equals(CHOICE_REVOKE)) {
|
|
||||||
((RevokeDeleteDialogActivity) activity)
|
|
||||||
.startRevocationOperation();
|
|
||||||
} else if (choice.equals(CHOICE_DELETE)) {
|
|
||||||
((RevokeDeleteDialogActivity) activity)
|
|
||||||
.startDeletionOperation();
|
|
||||||
} else {
|
|
||||||
throw new AssertionError(
|
|
||||||
"Unsupported delete type in RevokeDeleteDialogFragment");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final AlertDialog alertDialog = alert.show();
|
|
||||||
|
|
||||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
|
||||||
|
|
||||||
String choice = parent.getItemAtPosition(pos).toString();
|
|
||||||
|
|
||||||
if (choice.equals(CHOICE_REVOKE)) {
|
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
|
||||||
.setText(R.string.del_rev_dialog_btn_revoke);
|
|
||||||
} else if (choice.equals(CHOICE_DELETE)) {
|
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
|
||||||
.setText(R.string.del_rev_dialog_btn_delete);
|
|
||||||
} else {
|
|
||||||
throw new AssertionError(
|
|
||||||
"Unsupported delete type in RevokeDeleteDialogFragment");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return alertDialog;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -96,7 +96,6 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
static final int REQUEST_BACKUP = 2;
|
static final int REQUEST_BACKUP = 2;
|
||||||
static final int REQUEST_CERTIFY = 3;
|
static final int REQUEST_CERTIFY = 3;
|
||||||
static final int REQUEST_DELETE = 4;
|
static final int REQUEST_DELETE = 4;
|
||||||
static final int REQUEST_REVOKE_DELETE = 5;
|
|
||||||
|
|
||||||
public static final String EXTRA_DISPLAY_RESULT = "display_result";
|
public static final String EXTRA_DISPLAY_RESULT = "display_result";
|
||||||
|
|
||||||
@@ -419,24 +418,18 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deleteKey() {
|
private void deleteKey() {
|
||||||
if (mIsSecret && !mIsRevoked) {
|
Intent deleteIntent = new Intent(this, DeleteKeyDialogActivity.class);
|
||||||
Intent revokeDeleteIntent = new Intent(this, RevokeDeleteDialogActivity.class);
|
|
||||||
|
|
||||||
revokeDeleteIntent.putExtra(RevokeDeleteDialogActivity.EXTRA_MASTER_KEY_ID,
|
deleteIntent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,
|
||||||
mMasterKeyId);
|
new long[]{mMasterKeyId});
|
||||||
revokeDeleteIntent.putExtra(RevokeDeleteDialogActivity.EXTRA_KEYSERVER,
|
deleteIntent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET, mIsSecret);
|
||||||
|
if (mIsSecret) {
|
||||||
|
// for upload in case key is secret
|
||||||
|
deleteIntent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,
|
||||||
Preferences.getPreferences(this).getPreferredKeyserver());
|
Preferences.getPreferences(this).getPreferredKeyserver());
|
||||||
|
|
||||||
startActivityForResult(revokeDeleteIntent, REQUEST_REVOKE_DELETE);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Intent deleteIntent = new Intent(this, DeleteKeyDialogActivity.class);
|
|
||||||
|
|
||||||
deleteIntent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,
|
|
||||||
new long[]{mMasterKeyId});
|
|
||||||
|
|
||||||
startActivityForResult(deleteIntent, REQUEST_DELETE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startActivityForResult(deleteIntent, REQUEST_DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -485,7 +478,6 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case REQUEST_REVOKE_DELETE:
|
|
||||||
case REQUEST_DELETE: {
|
case REQUEST_DELETE: {
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
|||||||
import org.sufficientlysecure.keychain.ui.NfcOperationActivity;
|
import org.sufficientlysecure.keychain.ui.NfcOperationActivity;
|
||||||
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
|
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
|
||||||
import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
|
import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity;
|
||||||
import org.sufficientlysecure.keychain.ui.RevokeDeleteDialogActivity;
|
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
@@ -152,13 +151,11 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void startActivityForResult(Intent intent, int requestCode) {
|
protected void startActivityForResult(Intent intent, int requestCode) {
|
||||||
mRequestedCode = requestCode;
|
|
||||||
if (mUseFragment) {
|
if (mUseFragment) {
|
||||||
mFragment.startActivityForResult(intent, mRequestedCode);
|
mFragment.startActivityForResult(intent, mId + requestCode);
|
||||||
} else {
|
} else {
|
||||||
mActivity.startActivityForResult(intent, mRequestedCode);
|
mActivity.startActivityForResult(intent, mId + requestCode);
|
||||||
}
|
}
|
||||||
Log.e("PHILIP", "mRequestedCode: " + mRequestedCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,13 +164,13 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
|||||||
* @return true if requestCode was recognized, false otherwise
|
* @return true if requestCode was recognized, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
|
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
Log.d(Constants.TAG, "received activity result in OperationHelper with code: "
|
Log.d(Constants.TAG, "received activity result in OperationHelper");
|
||||||
+ requestCode + " while waiting for: " + mRequestedCode);
|
|
||||||
|
|
||||||
if ((requestCode & mId) != mId) {
|
if ((requestCode & mId) != mId) {
|
||||||
// this wasn't meant for us to handle
|
// this wasn't meant for us to handle
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Log.d(Constants.TAG, "handling activity result in OperationHelper");
|
||||||
// filter out mId from requestCode
|
// filter out mId from requestCode
|
||||||
requestCode ^= mId;
|
requestCode ^= mId;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/del_rev_dialog_message"
|
android:text="@string/del_rev_dialog_message"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
android:layout_marginBottom="16dp"/>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/spinner"
|
android:id="@+id/spinner"
|
||||||
@@ -19,6 +20,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawSelectorOnTop="true"
|
android:drawSelectorOnTop="true"
|
||||||
android:entries="@array/rev_del_dialog_entries"
|
android:entries="@array/rev_del_dialog_entries"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
|
android:textAppearance="?android:textAppearanceLarge"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user