From 1bbca50bacabba9bac3bdf665a6f2185b75dbcde Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 28 Dec 2016 20:31:18 +0100 Subject: [PATCH] add the looping Setting switchcompat --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 4 files changed, 34 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 7bbab27bf..be4e8ae1a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -20,6 +20,7 @@ class SettingsActivity : SimpleActivity() { setupSameSorting() setupShowHiddenFolders() setupAutoplayVideos() + setupLoopVideos() setupShowMedia() updateTextColors(settings_holder) } @@ -54,6 +55,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupLoopVideos() { + settings_loop_videos.isChecked = config.loopVideos + settings_loop_videos_holder.setOnClickListener { + settings_loop_videos.toggle() + config.loopVideos = settings_loop_videos.isChecked + } + } + private fun setupShowMedia() { var isInitialSetup = true settings_show_media.setSelection(config.showMedia) 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 76715b438..a0534c128 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -76,6 +76,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(AUTOPLAY_VIDEOS, false) set(autoplay) = prefs.edit().putBoolean(AUTOPLAY_VIDEOS, autoplay).apply() + var loopVideos: Boolean + get() = prefs.getBoolean(LOOP_VIDEOS, false) + set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).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/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 1feeb9607..e72958f06 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 DIRECTORY_SORT_ORDER = "directory_sort_order" val HIDDEN_FOLDERS = "hidden_folders" val SHOW_HIDDEN_FOLDERS = "show_hidden_folders" val AUTOPLAY_VIDEOS = "autoplay_videos" +val LOOP_VIDEOS = "loop_videos" 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 d901fc20f..2e8b6d743 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -90,6 +90,26 @@ + + + + + +