allow including videos in slideshows

This commit is contained in:
tibbi 2019-01-10 11:21:01 +01:00
parent 3f6e67b79c
commit eb20c802b2
5 changed files with 35 additions and 2 deletions

View file

@ -505,7 +505,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun getMediaForSlideshow(): Boolean { private fun getMediaForSlideshow(): Boolean {
mSlideshowMedia = mMediaFiles.filter { mSlideshowMedia = mMediaFiles.filter {
it.isImage() || (config.slideshowIncludeGIFs && it.isGIF()) it.isImage() || (config.slideshowIncludeVideos && it.isVideo() || (config.slideshowIncludeGIFs && it.isGIF()))
}.toMutableList() }.toMutableList()
if (config.slideshowRandomOrder) { if (config.slideshowRandomOrder) {

View file

@ -28,6 +28,11 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
activity.hideKeyboard(v) activity.hideKeyboard(v)
} }
include_videos_holder.setOnClickListener {
interval_value.clearFocus()
include_videos.toggle()
}
include_gifs_holder.setOnClickListener { include_gifs_holder.setOnClickListener {
interval_value.clearFocus() interval_value.clearFocus()
include_gifs.toggle() include_gifs.toggle()
@ -74,6 +79,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, 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_videos.isChecked = config.slideshowIncludeVideos
include_gifs.isChecked = config.slideshowIncludeGIFs include_gifs.isChecked = config.slideshowIncludeGIFs
random_order.isChecked = config.slideshowRandomOrder random_order.isChecked = config.slideshowRandomOrder
use_fade.isChecked = config.slideshowUseFade use_fade.isChecked = config.slideshowUseFade
@ -89,6 +95,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
activity.config.apply { activity.config.apply {
slideshowInterval = interval.toInt() slideshowInterval = interval.toInt()
slideshowIncludeVideos = view.include_videos.isChecked
slideshowIncludeGIFs = view.include_gifs.isChecked slideshowIncludeGIFs = view.include_gifs.isChecked
slideshowRandomOrder = view.random_order.isChecked slideshowRandomOrder = view.random_order.isChecked
slideshowUseFade = view.use_fade.isChecked slideshowUseFade = view.use_fade.isChecked

View file

@ -285,6 +285,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 slideshowIncludeVideos: Boolean
get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false)
set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).apply()
var slideshowIncludeGIFs: Boolean var slideshowIncludeGIFs: Boolean
get() = prefs.getBoolean(SLIDESHOW_INCLUDE_GIFS, false) get() = prefs.getBoolean(SLIDESHOW_INCLUDE_GIFS, false)
set(slideshowIncludeGIFs) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_GIFS, slideshowIncludeGIFs).apply() set(slideshowIncludeGIFs) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_GIFS, slideshowIncludeGIFs).apply()

View file

@ -79,6 +79,7 @@ const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom"
// slideshow // slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval" const val SLIDESHOW_INTERVAL = "slideshow_interval"
const val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos"
const val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" const val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs"
const val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" const val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order"
const val SLIDESHOW_USE_FADE = "slideshow_use_fade" const val SLIDESHOW_USE_FADE = "slideshow_use_fade"

View file

@ -37,7 +37,7 @@
android:textSize="@dimen/normal_text_size"/> android:textSize="@dimen/normal_text_size"/>
<RelativeLayout <RelativeLayout
android:id="@+id/include_gifs_holder" android:id="@+id/include_videos_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"
@ -47,6 +47,27 @@
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/include_videos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:text="@string/include_videos"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/include_gifs_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include_videos_holder"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/include_gifs" android:id="@+id/include_gifs"
android:layout_width="match_parent" android:layout_width="match_parent"