diff options
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/crypto')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index 9be1f170..9828f43a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -612,8 +612,6 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { if (findViewById<TextView>(R.id.crypto_password_show) == null) return - setTimer() - val clip = ClipData.newPlainText("pgp_handler_result_pm", passwordEntry?.password) clipboard.primaryClip = clip @@ -624,7 +622,13 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { // ignore and keep default } - showToast(this.resources.getString(R.string.clipboard_password_toast_text, clearAfter)) + if (settings.getBoolean("clear_after_copy", true) && clearAfter != 0) { + setTimer() + showToast(this.resources.getString(R.string.clipboard_password_toast_text, clearAfter)) + } else { + showToast(this.resources.getString(R.string.clipboard_password_no_clear_toast_text)) + } + } private fun copyUsernameToClipBoard(username: String) { @@ -743,20 +747,18 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { if (skip) return checkAndIncrementHotp() - // only clear the clipboard if we automatically copied the password to it - if (settings.getBoolean("copy_on_decrypt", true)) { - Log.d("DELAY_SHOW", "Clearing the clipboard") - val clip = ClipData.newPlainText("pgp_handler_result_pm", "") - clipboard.primaryClip = clip - if (settings.getBoolean("clear_clipboard_20x", false)) { - val handler = Handler() - for (i in 0..18) { - val count = i.toString() - handler.postDelayed( - { clipboard.primaryClip = ClipData.newPlainText(count, count) }, - (i * 500).toLong() - ) - } + // No need to validate clear_after_copy. It was validated in copyPasswordToClipBoard() + Log.d("DELAY_SHOW", "Clearing the clipboard") + val clip = ClipData.newPlainText("pgp_handler_result_pm", "") + clipboard.primaryClip = clip + if (settings.getBoolean("clear_clipboard_20x", false)) { + val handler = Handler() + for (i in 0..18) { + val count = i.toString() + handler.postDelayed( + { clipboard.primaryClip = ClipData.newPlainText(count, count) }, + (i * 500).toLong() + ) } } |
