Automatically copy password to clipboard after decryption
This commit is contained in:
parent
9aea6560b0
commit
9822c097cb
1 changed files with 10 additions and 7 deletions
|
@ -145,14 +145,18 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.copy_password:
|
case R.id.copy_password:
|
||||||
|
copyToClipBoard();
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void copyToClipBoard() {
|
||||||
ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", ((TextView) findViewById(R.id.crypto_password_show)).getText());
|
ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", ((TextView) findViewById(R.id.crypto_password_show)).getText());
|
||||||
clipboard.setPrimaryClip(clip);
|
clipboard.setPrimaryClip(clip);
|
||||||
showToast("Password copied to clipboard, you have "
|
showToast("Password copied to clipboard, you have "
|
||||||
+ Integer.parseInt(settings.getString("general_show_time", "45"))
|
+ Integer.parseInt(settings.getString("general_show_time", "45"))
|
||||||
+ " seconds to paste it somewhere.");
|
+ " seconds to paste it somewhere.");
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleClick(View view) {
|
public void handleClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
|
@ -313,8 +317,6 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne
|
||||||
|
|
||||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||||
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
||||||
showToast("SUCCESS");
|
|
||||||
|
|
||||||
// encrypt/decrypt/sign/verify
|
// encrypt/decrypt/sign/verify
|
||||||
if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) {
|
if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -336,6 +338,7 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne
|
||||||
.setText(extraContent);
|
.setText(extraContent);
|
||||||
}
|
}
|
||||||
new DelayShow().execute();
|
new DelayShow().execute();
|
||||||
|
copyToClipBoard();
|
||||||
} else {
|
} else {
|
||||||
showToast(os.toString());
|
showToast(os.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue