From 19fd54b25a417508d4631550f2ca58ce90bfeed8 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Fri, 10 Mar 2017 00:47:54 -0500 Subject: [PATCH] Option for max brightness when viewing media --- .../gallery/activities/SettingsActivity.kt | 10 +++++++++ .../gallery/activities/ViewPagerActivity.kt | 6 ++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 21 +++++++++++++++++++ app/src/main/res/values-ca-rES/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es-rES/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl-rES/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rPT/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 22 files changed, 59 insertions(+) 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 cd7be53f8..199168fa5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -26,6 +26,7 @@ class SettingsActivity : SimpleActivity() { setupAutoplayVideos() setupLoopVideos() setupAnimateGifs() + setupMaxBrightness() setupShowMedia() updateTextColors(settings_holder) } @@ -86,9 +87,18 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupMaxBrightness() { + settings_max_brightness.isChecked = config.maxBrightness + settings_max_brightness_holder.setOnClickListener { + settings_max_brightness.toggle() + config.maxBrightness = settings_max_brightness.isChecked + } + } + private fun getShowMediaText() = getString(when (config.showMedia) { IMAGES_AND_VIDEOS -> R.string.images_and_videos IMAGES -> R.string.images else -> R.string.videos }) + } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index e0a00ca84..c49551989 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -98,6 +98,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View finish() } supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) + + if (config.maxBrightness) { + var attributes = getWindow().getAttributes() + attributes.screenBrightness = 1F + getWindow().setAttributes(attributes) + } } override fun onPause() { 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 a2894e7b2..65b14e4cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -100,6 +100,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(ANIMATE_GIFS, false) set(animateGifs) = prefs.edit().putBoolean(ANIMATE_GIFS, animateGifs).apply() + var maxBrightness: Boolean + get() = prefs.getBoolean(MAX_BRIGHTNESS, false) + set(maxBrightness) = prefs.edit().putBoolean(MAX_BRIGHTNESS, maxBrightness).apply() + var loopVideos: Boolean get() = prefs.getBoolean(LOOP_VIDEOS, false) set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).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 6fed4add7..e4208e8c8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -8,6 +8,7 @@ val SHOW_HIDDEN_FOLDERS = "show_hidden_folders" val AUTOPLAY_VIDEOS = "autoplay_videos" val LOOP_VIDEOS = "loop_videos" val ANIMATE_GIFS = "animate_gifs" +val MAX_BRIGHTNESS = "max_brightness" val DISPLAY_FILE_NAMES = "display_file_names" val PINNED_FOLDERS = "pinned_folders" val DIR_COLUMN_CNT = "dir_column_cnt" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 4c16ebef1..6e9032238 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -129,6 +129,27 @@ + + + + + + + Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ce1e7cf71..aabe5a8ad 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -80,6 +80,7 @@ Bilder und Videos Video Endlos-Schleife Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index ceb2814c7..559699d5e 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7fa496931..eb1bff510 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -80,6 +80,7 @@ Images et vidéos Tourner en boucle les vidéos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-gl-rES/strings.xml b/app/src/main/res/values-gl-rES/strings.xml index ceb2814c7..559699d5e 100644 --- a/app/src/main/res/values-gl-rES/strings.xml +++ b/app/src/main/res/values-gl-rES/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 43c38ce7e..2b09abf0a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2491fc644..74fbd8fa5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 9cf94a951..993e6f3ae 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 4a68d5fbc..2a7e7b944 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -80,6 +80,7 @@ Obrazy i wideo Pętla wideo Animowanie gify z miniaturkami + Maximum brightness when viewing media diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index f2c72e55e..045a5aa7e 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -80,6 +80,7 @@ Imagens e vídeos Vídeos em ciclo Animação de gifs nas miniaturas + Maximum brightness when viewing media diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index ed5dd0480..c3b7ad7fd 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -80,6 +80,7 @@ Изображения и видео Повторять видео Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index e1247721f..d898cd5a6 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -80,6 +80,7 @@ Obrázky aj videá Automaticky reštartovať videá Animovať gif súbory pri náhľade + Maximum brightness when viewing media diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 38a0df20b..a026b9392 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -80,6 +80,7 @@ Bilder och videos Återspela videos Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index a74558bd1..ed946ccde 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -80,6 +80,7 @@ Resimler ve videolar Videolar döngüsü Küçük resimlerde gif\'leri canlandırın + Maximum brightness when viewing media diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 723d4d151..469d445f3 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -80,6 +80,7 @@ 图像和视频 循环播放视频 Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 56cfeabdb..67442eee1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -80,6 +80,7 @@ 圖片和影片 迴圈播放影片 Animate gifs at thumbnails + Maximum brightness when viewing media diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43c38ce7e..2b09abf0a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -80,6 +80,7 @@ Images and videos Loop videos Animate gifs at thumbnails + Maximum brightness when viewing media