From 662dff67d61cd4d6ec762712e71f0d4d5848b55d Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 20:49:45 +0100 Subject: [PATCH] adding a new checkbox for always opening the videos on a new screen --- .../pro/activities/SettingsActivity.kt | 9 +++++++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 24 +++++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index eb292610f..667b5862b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -42,6 +42,7 @@ class SettingsActivity : SimpleActivity() { setupAutoplayVideos() setupRememberLastVideo() setupLoopVideos() + setupOpenVideosOnNewScreen() setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() @@ -174,6 +175,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupOpenVideosOnNewScreen() { + settings_open_videos_on_new_screen.isChecked = config.openVideosOnNewScreen + settings_open_videos_on_new_screen_holder.setOnClickListener { + settings_open_videos_on_new_screen.toggle() + config.openVideosOnNewScreen = settings_open_videos_on_new_screen.isChecked + } + } + private fun setupAnimateGifs() { settings_animate_gifs.isChecked = config.animateGifs settings_animate_gifs_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index c218dc78c..f1e9ad4ee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -180,6 +180,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(LOOP_VIDEOS, false) set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply() + var openVideosOnNewScreen: Boolean + get() = prefs.getBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, false) + set(openVideosOnNewScreen) = prefs.edit().putBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, openVideosOnNewScreen).apply() + var displayFileNames: Boolean get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index d0c1d72e4..cfbf66ad0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -13,6 +13,7 @@ const val IS_THIRD_PARTY_INTENT = "is_third_party_intent" const val AUTOPLAY_VIDEOS = "autoplay_videos" const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position" const val LOOP_VIDEOS = "loop_videos" +const val OPEN_VIDEOS_ON_NEW_SCREEN = "open_videos_on_new_screen" const val ANIMATE_GIFS = "animate_gifs" const val MAX_BRIGHTNESS = "max_brightness" const val CROP_THUMBNAILS = "crop_thumbnails" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 72de10803..64dd79f50 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -280,6 +280,30 @@ + + + + + +