From a3238a6b9564c5892e720a72bf9857d24e1448ae Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 2 Jan 2019 23:09:18 +0100 Subject: [PATCH] Revert "remove the setting for toggling autoplaying videos" This reverts commit 62cbdaf9188c2227618f8a90f4fdf9e6888853df. --- .../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 c9018cb22..8426bd8c4 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 @@ -39,6 +39,7 @@ class SettingsActivity : SimpleActivity() { setupManageHiddenFolders() setupShowHiddenItems() setupDoExtraCheck() + setupAutoplayVideos() setupRememberLastVideo() setupLoopVideos() setupAnimateGifs() @@ -148,6 +149,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAutoplayVideos() { + settings_autoplay_videos.isChecked = config.autoplayVideos + settings_autoplay_videos_holder.setOnClickListener { + settings_autoplay_videos.toggle() + config.autoplayVideos = settings_autoplay_videos.isChecked + } + } + private fun setupRememberLastVideo() { settings_remember_last_video_position.isChecked = config.rememberLastVideoPosition settings_remember_last_video_position_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 a36fe8b1b..405181b18 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 @@ -152,6 +152,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getStringSet(INCLUDED_FOLDERS, HashSet()) set(includedFolders) = prefs.edit().remove(INCLUDED_FOLDERS).putStringSet(INCLUDED_FOLDERS, includedFolders).apply() + var autoplayVideos: Boolean + get() = prefs.getBoolean(AUTOPLAY_VIDEOS, false) + set(autoplay) = prefs.edit().putBoolean(AUTOPLAY_VIDEOS, autoplay).apply() + var animateGifs: Boolean get() = prefs.getBoolean(ANIMATE_GIFS, false) set(animateGifs) = prefs.edit().putBoolean(ANIMATE_GIFS, animateGifs).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 b455298ad..16e61ddc8 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 @@ -10,6 +10,7 @@ const val VIEW_TYPE_PREFIX = "view_type_folder_" const val SHOW_HIDDEN_MEDIA = "show_hidden_media" const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" 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 ANIMATE_GIFS = "animate_gifs" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index fcf352d62..75d86d798 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -208,6 +208,30 @@ android:textAllCaps="true" android:textSize="@dimen/smaller_text_size"/> + + + + + +