Added warning dialog for importing keys
This commit is contained in:
parent
f43edcdd7a
commit
9d35dcb0e9
|
@ -18,6 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -38,6 +39,7 @@ import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
|||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
@ -342,6 +344,31 @@ public class ImportKeysActivity extends BaseActivity
|
|||
return;
|
||||
}
|
||||
|
||||
showWarningDialog();
|
||||
}
|
||||
|
||||
private void showWarningDialog() {
|
||||
CustomAlertDialogBuilder warningDialog = new CustomAlertDialogBuilder(this);
|
||||
warningDialog.setTitle(R.string.import_warning_title).
|
||||
setMessage(R.string.import_warning).setCancelable(true);
|
||||
warningDialog.setPositiveButton(R.string.btn_import, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
executeImport();
|
||||
}
|
||||
});
|
||||
warningDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
});
|
||||
warningDialog.show();
|
||||
}
|
||||
|
||||
private void executeImport() {
|
||||
FragmentManager fragMan = getSupportFragmentManager();
|
||||
ImportKeysListFragment keyListFragment = (ImportKeysListFragment) fragMan.findFragmentByTag(TAG_FRAG_LIST);
|
||||
|
||||
mOperationHelper = new CryptoOperationHelper<>(
|
||||
1, this, this, R.string.progress_importing
|
||||
);
|
||||
|
|
|
@ -526,6 +526,8 @@
|
|||
<string name="import_qr_code_too_short_fingerprint">"Fingerprint is too short!"</string>
|
||||
<string name="import_qr_code_button">"Scan QR Code"</string>
|
||||
<string name="import_qr_code_text">"Place your camera over the QR Code!"</string>
|
||||
<string name="import_warning_title">"Warning"</string>
|
||||
<string name="import_warning">"Imported keys will overwrite existing keys that have the same IDs!"</string>
|
||||
|
||||
<!-- Import from URL -->
|
||||
<string name="import_url_warn_no_search_parameter">"No search query defined. You can still manually search on this keyserver."</string>
|
||||
|
|
Loading…
Reference in a new issue