add a new slideshow setup toggle for including photos

This commit is contained in:
tibbi 2017-08-05 16:12:19 +02:00
parent 3f1cfab633
commit 5b3fa44432
22 changed files with 55 additions and 1 deletions

View file

@ -317,6 +317,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun getMediaForSlideshow(): Boolean { private fun getMediaForSlideshow(): Boolean {
mSlideshowMedia = mMedia.toMutableList() mSlideshowMedia = mMedia.toMutableList()
if (!config.slideshowIncludePhotos) {
mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() && !it.isGif() } as MutableList
}
if (!config.slideshowIncludeVideos) { if (!config.slideshowIncludeVideos) {
mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGif() } as MutableList mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGif() } as MutableList
} }

View file

@ -32,6 +32,11 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
activity.hideKeyboard(v) activity.hideKeyboard(v)
} }
include_photos_holder.setOnClickListener {
interval_value.clearFocus()
include_photos.toggle()
}
include_videos_holder.setOnClickListener { include_videos_holder.setOnClickListener {
interval_value.clearFocus() interval_value.clearFocus()
include_videos.toggle() include_videos.toggle()
@ -67,6 +72,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
val config = activity.config val config = activity.config
view.apply { view.apply {
interval_value.setText(config.slideshowInterval.toString()) interval_value.setText(config.slideshowInterval.toString())
include_photos.isChecked = config.slideshowIncludePhotos
include_videos.isChecked = config.slideshowIncludeVideos include_videos.isChecked = config.slideshowIncludeVideos
random_order.isChecked = config.slideshowRandomOrder random_order.isChecked = config.slideshowRandomOrder
use_fade.isChecked = config.slideshowUseFade use_fade.isChecked = config.slideshowUseFade
@ -81,6 +87,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
activity.config.apply { activity.config.apply {
slideshowInterval = interval.toInt() slideshowInterval = interval.toInt()
slideshowIncludePhotos = view.include_photos.isChecked
slideshowIncludeVideos = view.include_videos.isChecked slideshowIncludeVideos = view.include_videos.isChecked
slideshowRandomOrder = view.random_order.isChecked slideshowRandomOrder = view.random_order.isChecked
slideshowUseFade = view.use_fade.isChecked slideshowUseFade = view.use_fade.isChecked

View file

@ -237,6 +237,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL) get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL)
set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply() 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 var slideshowIncludeVideos: Boolean
get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false) get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false)
set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).apply() set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).apply()

View file

@ -36,6 +36,7 @@ val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
// slideshow // slideshow
val SLIDESHOW_INTERVAL = "slideshow_interval" val SLIDESHOW_INTERVAL = "slideshow_interval"
val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos"
val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos"
val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order"
val SLIDESHOW_USE_FADE = "slideshow_use_fade" val SLIDESHOW_USE_FADE = "slideshow_use_fade"

View file

@ -36,7 +36,7 @@
android:textCursorDrawable="@null"/> android:textCursorDrawable="@null"/>
<RelativeLayout <RelativeLayout
android:id="@+id/include_videos_holder" android:id="@+id/include_photos_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/interval_label" android:layout_below="@+id/interval_label"
@ -46,6 +46,27 @@
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin"> android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/include_photos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:text="@string/include_photos"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/include_videos_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include_photos_holder"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/include_videos" android:id="@+id/include_videos"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -83,6 +83,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Prezentácia</string> <string name="slideshow">Prezentácia</string>
<string name="interval">Interval (sekundy):</string> <string name="interval">Interval (sekundy):</string>
<string name="include_photos">Zahrnúť fotky a GIF súbory</string>
<string name="include_videos">Zahrnúť videá</string> <string name="include_videos">Zahrnúť videá</string>
<string name="random_order">Náhodné poradie</string> <string name="random_order">Náhodné poradie</string>
<string name="use_fade">Používať miznúce animácie</string> <string name="use_fade">Používať miznúce animácie</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>

View file

@ -82,6 +82,7 @@
<!-- Slideshow --> <!-- Slideshow -->
<string name="slideshow">Slideshow</string> <string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string> <string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_videos">Include videos</string> <string name="include_videos">Include videos</string>
<string name="random_order">Random order</string> <string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>