diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 02cf907aa..5451dc6cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -36,6 +36,7 @@ class SettingsActivity : SimpleActivity() { setupScrollHorizontally() setupScreenRotation() setupReplaceShare() + setupPasswordProtection() setupShowMedia() setupHideSystemUI() updateTextColors(settings_holder) @@ -139,6 +140,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupPasswordProtection() { + settings_password_protection.isChecked = config.passwordProtection + settings_password_protection_holder.setOnClickListener { + settings_password_protection.toggle() + config.passwordProtection = settings_password_protection.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index b221d32da..b1d5b3918 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -232,4 +232,8 @@ class Config(context: Context) : BaseConfig(context) { var replaceShare: Boolean get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false) set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply() + + var passwordProtection: Boolean + get() = prefs.getBoolean(PASSWORD_PROTECTION, false) + set(passwordProtection) = prefs.edit().putBoolean(PASSWORD_PROTECTION, passwordProtection).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 30af458a7..a10f57105 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -33,6 +33,7 @@ val ALBUM_COVERS = "album_covers" val SCROLL_HORIZONTALLY = "scroll_horizontally" val HIDE_SYSTEM_UI = "hide_system_ui" val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" +val PASSWORD_PROTECTION = "password_protection" val NOMEDIA = ".nomedia" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 78e405aad..718443de6 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -268,6 +268,26 @@ + + + + + +