From 82a9a6125473dbffa6a76f33c6ff83b4a1bd69b3 Mon Sep 17 00:00:00 2001 From: Aditya Wasan Date: Wed, 1 Jul 2020 00:00:02 +0530 Subject: Use PreferenceKeys file to manage SharedPreferences keys. (#891) * Use PreferenceKeys file to manage SharedPreferences keys. Signed-off-by: Aditya Wasan * Use PreferenceKeys in all files Signed-off-by: Aditya Wasan * Divide PreferenceKeys into multiple regions Signed-off-by: Aditya Wasan * Fix build error Signed-off-by: Aditya Wasan * Use PreferenceKeys in more files Signed-off-by: Aditya Wasan * Reformat code Signed-off-by: Aditya Wasan * Fix build error Signed-off-by: Aditya Wasan * Fix merge issues Signed-off-by: Aditya Wasan --- app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt') diff --git a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt index ceb84020..ef0cc459 100644 --- a/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt +++ b/app/src/main/java/com/zeapo/pwdstore/ClipboardService.kt @@ -17,6 +17,7 @@ import androidx.core.app.NotificationCompat import androidx.core.content.getSystemService import androidx.preference.PreferenceManager import com.github.ajalt.timberkt.d +import com.zeapo.pwdstore.utils.PreferenceKeys import com.zeapo.pwdstore.utils.clipboard import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -44,7 +45,7 @@ class ClipboardService : Service() { ACTION_START -> { val time = try { - Integer.parseInt(settings.getString("general_show_time", "45") as String) + Integer.parseInt(settings.getString(PreferenceKeys.GENERAL_SHOW_TIME, "45") as String) } catch (e: NumberFormatException) { 45 } @@ -82,7 +83,7 @@ class ClipboardService : Service() { } private fun clearClipboard() { - val deepClear = settings.getBoolean("clear_clipboard_20x", false) + val deepClear = settings.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, false) val clipboard = clipboard if (clipboard != null) { -- cgit v1.2.3