Fix compile errors

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-06-07 12:21:49 +05:30
parent 5fe2c74cc7
commit 1fd5f202b0
No known key found for this signature in database
GPG key ID: C2E74282C2133D62
2 changed files with 10 additions and 10 deletions

View file

@ -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)
}
}
}

View file

@ -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()
)
}