summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt8
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt12
2 files changed, 10 insertions, 10 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt
index 6cb3c678..e4d1d04b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt
@@ -309,7 +309,7 @@ class AutofillService : AccessibilityService() {
val prefs: SharedPreferences = getSharedPreferences("autofill", Context.MODE_PRIVATE)
val preference: String?
- preference = prefs.getString(packageName, defValue)
+ preference = prefs.getString(packageName, defValue) ?: defValue
when (preference) {
"/first" -> {
@@ -546,15 +546,15 @@ class AutofillService : AccessibilityService() {
} else {
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
var clip = ClipData.newPlainText("autofill_pm", text)
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
node.performAction(AccessibilityNodeInfo.ACTION_PASTE)
clip = ClipData.newPlainText("autofill_pm", "")
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
if (settings!!.getBoolean("clear_clipboard_20x", false)) {
for (i in 0..19) {
clip = ClipData.newPlainText(i.toString(), i.toString())
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
}
}
}
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 d12dee78..7416945e 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
@@ -84,7 +84,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
private val relativeParentPath: String by lazy { getParentPath(fullPath, repoPath) }
val settings: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(this) }
- private val keyIDs: MutableSet<String> by lazy { settings.getStringSet("openpgp_key_ids_set", emptySet()) }
+ private val keyIDs: MutableSet<String> by lazy { settings.getStringSet("openpgp_key_ids_set", mutableSetOf()) ?: emptySet() }
private var mServiceConnection: OpenPgpServiceConnection? = null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -634,7 +634,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
return
val clip = ClipData.newPlainText("pgp_handler_result_pm", passwordEntry?.password)
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
var clearAfter = 45
try {
@@ -654,13 +654,13 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
private fun copyUsernameToClipBoard(username: String) {
val clip = ClipData.newPlainText("pgp_handler_result_pm", username)
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
showToast(resources.getString(R.string.clipboard_username_toast_text))
}
private fun copyOtpToClipBoard(code: String) {
val clip = ClipData.newPlainText("pgp_handler_result_pm", code)
- clipboard.primaryClip = clip
+ clipboard.setPrimaryClip(clip)
showToast(resources.getString(R.string.clipboard_otp_toast_text))
}
@@ -771,13 +771,13 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
// 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
+ clipboard.setPrimaryClip(clip)
if (settings.getBoolean("clear_clipboard_20x", false)) {
val handler = Handler()
for (i in 0..19) {
val count = i.toString()
handler.postDelayed(
- { clipboard.primaryClip = ClipData.newPlainText(count, count) },
+ { clipboard.setPrimaryClip(ClipData.newPlainText(count, count)) },
(i * 500).toLong()
)
}