From a780d36a6e6f3966a598083a1979fb63a387edef Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 14 May 2017 11:50:30 +0200 Subject: [PATCH] add a setting for always using dark background at fullscreen media --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-cs/strings.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-pl/strings.xml | 2 +- app/src/main/res/values-pt-rBR/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-sk/strings.xml | 2 +- app/src/main/res/values-sv/strings.xml | 2 +- app/src/main/res/values-tr/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 2 +- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 19 files changed, 49 insertions(+), 15 deletions(-) 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 0937894ce..dfcb59d95 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -32,6 +32,7 @@ class SettingsActivity : SimpleActivity() { setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() + setupDarkBackground() setupScreenRotation() setupShowMedia() updateTextColors(settings_holder) @@ -103,6 +104,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupDarkBackground() { + settings_dark_background.isChecked = config.darkBackground + settings_dark_background_holder.setOnClickListener { + settings_dark_background.toggle() + config.darkBackground = settings_dark_background.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 a702b1237..e84570f46 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -148,6 +148,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() + var darkBackground: Boolean + get() = prefs.getBoolean(DARK_BACKGROUND, false) + set(darkBackground) = prefs.edit().putBoolean(DARK_BACKGROUND, darkBackground).apply() + var showMedia: Int get() = prefs.getInt(SHOW_MEDIA, IMAGES_AND_VIDEOS) set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).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 b148245a8..5ebaa98a6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -13,6 +13,7 @@ val MAX_BRIGHTNESS = "max_brightness" val CROP_THUMBNAILS = "crop_thumbnails" val SCREEN_ROTATION = "screen_rotation" val DISPLAY_FILE_NAMES = "display_file_names" +val DARK_BACKGROUND = "dark_background" val PINNED_FOLDERS = "pinned_folders" val DIR_COLUMN_CNT = "dir_column_cnt" val MEDIA_COLUMN_CNT = "media_column_cnt" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 9d1f0c530..c1ec5d18a 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -188,6 +188,26 @@ + + + + + + System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f853ede0e..888f7f6f3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -92,7 +92,7 @@ Systemeinstellung Gerätedrehung Seitenverhältnis - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 19051c8dd..994888949 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -92,7 +92,7 @@ Paramètres système Rotation de l\'appareil Ratio d\'aspect - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c92d936ee..16bc4749f 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 55812a7bf..9a3d37fb5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -92,7 +92,7 @@ Impostazione di sistema Rotazione dispositivo Proporzioni - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 7f5fa0b1c..0b6c05291 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5b7873c6d..0d96b6c11 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f54d0b426..fcc848b59 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -92,7 +92,7 @@ Padrão do sistema Sensor do aparelho Proporção da mídia - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 0a5a848db..65ab5821a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -92,7 +92,7 @@ Системные настройки Поворот устройства Соотношение сторон - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 39935e51e..717b21f8b 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -92,7 +92,7 @@ Systémového nastavenia Otočenia zariadenia Pomeru strán - Stále použiť tmavé pozadie pri médiách na celú obrazovku + Tmavé pozadie pri médiách na celú obrazovku diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 546262e6c..bdd49333c 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 75ac344b6..479fd2c5c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -92,7 +92,7 @@ Sistem ayarı Cihaz döndürme En-boy oranı - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a96c4f6bc..88214bf91 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0f6ac93cf..9a5a2384b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9cd0a032d..a0c02d3a9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -92,7 +92,7 @@ System setting Device rotation Aspect ratio - Always use dark background at fullscreen media + Dark background at fullscreen media