From 4e178883f75e0565ca2cc9449bfbd43a2f770431 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 29 Oct 2022 04:57:41 +0530 Subject: [PATCH] chore: extract hard-coded preference strings --- .../java/app/passwordstore/ui/settings/PGPSettings.kt | 7 ++++--- .../app/passwordstore/ui/settings/RepositorySettings.kt | 9 +++++---- app/src/main/res/values/strings.xml | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt index 302d9300b..8a3048ba6 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt @@ -6,6 +6,7 @@ package app.passwordstore.ui.settings import androidx.fragment.app.FragmentActivity +import app.passwordstore.R import app.passwordstore.ui.pgp.PGPKeyImportActivity import app.passwordstore.ui.pgp.PGPKeyListActivity import app.passwordstore.util.extensions.launchActivity @@ -20,7 +21,7 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider { override fun provideSettings(builder: PreferenceScreen.Builder) { builder.apply { pref("_") { - title = "Import PGP key" + titleRes = R.string.pref_import_pgp_key_title persistent = false onClick { activity.launchActivity(PGPKeyImportActivity::class.java) @@ -28,7 +29,7 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider { } } pref("__") { - title = "Key manager" + titleRes = R.string.pref_pgp_key_manager_title persistent = false onClick { activity.launchActivity(PGPKeyListActivity::class.java) @@ -36,7 +37,7 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider { } } switch(PreferenceKeys.ASCII_ARMOR) { - title = "Encrypt in ASCII armor mode" + titleRes = R.string.pref_pgp_ascii_armor_title persistent = true } } diff --git a/app/src/main/java/app/passwordstore/ui/settings/RepositorySettings.kt b/app/src/main/java/app/passwordstore/ui/settings/RepositorySettings.kt index 060f7c939..8b478d639 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/RepositorySettings.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/RepositorySettings.kt @@ -126,10 +126,11 @@ class RepositorySettings(private val activity: FragmentActivity) : SettingsProvi visible = false return } - when { - httpsPass != null -> titleRes = R.string.clear_saved_passphrase_https - sshPass != null -> titleRes = R.string.clear_saved_passphrase_ssh - } + titleRes = + when { + httpsPass != null -> R.string.clear_saved_passphrase_https + else -> R.string.clear_saved_passphrase_ssh + } visible = true requestRebind() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9997f6aa6..5a542b64e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -131,6 +131,9 @@ When pulling or syncing, rebase commits that are not present in the remote repository Disable pull to sync action Prevent pulling down on the password list from triggering a Git sync + Import PGP key + Key manager + Encrypt in ASCII armor mode Generate Password