From 5b3fa4443239a54ee8e1d6bce88c2c4dab3d134f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 5 Aug 2017 16:12:19 +0200 Subject: [PATCH] add a new slideshow setup toggle for including photos --- .../gallery/activities/ViewPagerActivity.kt | 4 ++++ .../gallery/dialogs/SlideshowDialog.kt | 7 ++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/dialog_slideshow.xml | 23 ++++++++++++++++++- app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/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-rBR/strings.xml | 1 + app/src/main/res/values-pt/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, 55 insertions(+), 1 deletion(-) 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 a44cea9a6..fbdb2ca2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -317,6 +317,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getMediaForSlideshow(): Boolean { mSlideshowMedia = mMedia.toMutableList() + if (!config.slideshowIncludePhotos) { + mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() && !it.isGif() } as MutableList + } + if (!config.slideshowIncludeVideos) { mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGif() } as MutableList } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index 18b97c326..f28d8ef62 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -32,6 +32,11 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { activity.hideKeyboard(v) } + include_photos_holder.setOnClickListener { + interval_value.clearFocus() + include_photos.toggle() + } + include_videos_holder.setOnClickListener { interval_value.clearFocus() include_videos.toggle() @@ -67,6 +72,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { val config = activity.config view.apply { interval_value.setText(config.slideshowInterval.toString()) + include_photos.isChecked = config.slideshowIncludePhotos include_videos.isChecked = config.slideshowIncludeVideos random_order.isChecked = config.slideshowRandomOrder use_fade.isChecked = config.slideshowUseFade @@ -81,6 +87,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { activity.config.apply { slideshowInterval = interval.toInt() + slideshowIncludePhotos = view.include_photos.isChecked slideshowIncludeVideos = view.include_videos.isChecked slideshowRandomOrder = view.random_order.isChecked slideshowUseFade = view.use_fade.isChecked 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 6dd00d0e4..167988674 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -237,6 +237,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL) set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply() + var slideshowIncludePhotos: Boolean + get() = prefs.getBoolean(SLIDESHOW_INCLUDE_PHOTOS, true) + set(slideshowIncludePhotos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_PHOTOS, slideshowIncludePhotos).apply() + var slideshowIncludeVideos: Boolean get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false) set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).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 5cf46791d..3efd48714 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -36,6 +36,7 @@ val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" +val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos" val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" val SLIDESHOW_USE_FADE = "slideshow_use_fade" diff --git a/app/src/main/res/layout/dialog_slideshow.xml b/app/src/main/res/layout/dialog_slideshow.xml index 7679ec6d9..1d5a8ef07 100644 --- a/app/src/main/res/layout/dialog_slideshow.xml +++ b/app/src/main/res/layout/dialog_slideshow.xml @@ -36,7 +36,7 @@ android:textCursorDrawable="@null"/> + + + + + + Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e6ff1b2c1..15edc4c14 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 209da01f5..289f5952d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1ccc71678..8de03c48b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c4cd345d5..bac507479 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a5d45c2ca..f44110e78 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4091adc4a..6ce45effd 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index c54a4e2ec..af31be8ef 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index e54551925..7e5802637 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -83,6 +83,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d4a248432..58837e577 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 581c31ace..0a5bac819 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index b2f2f7a72..479cd2c35 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -82,6 +82,7 @@ Prezentácia Interval (sekundy): + Zahrnúť fotky a GIF súbory Zahrnúť videá Náhodné poradie Používať miznúce animácie diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 67d51e72a..2ddde4be5 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index fba714c2a..b149647dd 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ed7d6b9ab..45a0ab99a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d036415d4..e72c34abd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8ad387a9b..69c044f18 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -82,6 +82,7 @@ Slideshow Interval (seconds): + Include photos and GIFs Include videos Random order Use fade animations