do not allow including videos in slideshows

This commit is contained in:
tibbi 2019-01-02 18:41:04 +01:00
parent 7d758178d5
commit 1e39784324
5 changed files with 8 additions and 45 deletions

View file

@ -20,6 +20,7 @@ import android.os.Bundle
import android.os.Handler
import android.provider.MediaStore
import android.util.DisplayMetrics
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
@ -507,17 +508,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun getMediaForSlideshow(): Boolean {
mSlideshowMedia = mMediaFiles.toMutableList()
if (!config.slideshowIncludePhotos) {
mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() } as MutableList
}
mSlideshowMedia = mMediaFiles.filter {
(config.slideshowIncludePhotos && it.isImage()) || (config.slideshowIncludeGIFs && it.isGIF())
}.toMutableList()
if (!config.slideshowIncludeVideos) {
mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGIF() } as MutableList
}
if (!config.slideshowIncludeGIFs) {
mSlideshowMedia = mSlideshowMedia.filter { !it.isGIF() } as MutableList
mSlideshowMedia.forEach {
Log.e("DEBUG", "got ${it.name}")
}
if (config.slideshowRandomOrder) {

View file

@ -34,11 +34,6 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
include_photos.toggle()
}
include_videos_holder.setOnClickListener {
interval_value.clearFocus()
include_videos.toggle()
}
include_gifs_holder.setOnClickListener {
interval_value.clearFocus()
include_gifs.toggle()
@ -73,7 +68,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
activity.setupDialogStuff(view, this) {
hideKeyboard()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
if (!view.include_photos.isChecked && !view.include_videos.isChecked && !view.include_gifs.isChecked) {
if (!view.include_photos.isChecked && !view.include_gifs.isChecked) {
activity.toast(R.string.no_media_for_slideshow)
return@setOnClickListener
}
@ -91,7 +86,6 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
view.apply {
interval_value.setText(config.slideshowInterval.toString())
include_photos.isChecked = config.slideshowIncludePhotos
include_videos.isChecked = config.slideshowIncludeVideos
include_gifs.isChecked = config.slideshowIncludeGIFs
random_order.isChecked = config.slideshowRandomOrder
use_fade.isChecked = config.slideshowUseFade
@ -108,7 +102,6 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
activity.config.apply {
slideshowInterval = interval.toInt()
slideshowIncludePhotos = view.include_photos.isChecked
slideshowIncludeVideos = view.include_videos.isChecked
slideshowIncludeGIFs = view.include_gifs.isChecked
slideshowRandomOrder = view.random_order.isChecked
slideshowUseFade = view.use_fade.isChecked

View file

@ -285,10 +285,6 @@ class Config(context: Context) : BaseConfig(context) {
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()
var slideshowIncludeGIFs: Boolean
get() = prefs.getBoolean(SLIDESHOW_INCLUDE_GIFS, false)
set(slideshowIncludeGIFs) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_GIFS, slideshowIncludeGIFs).apply()

View file

@ -78,7 +78,6 @@ const val SHOW_WIDGET_FOLDER_NAME = "show_widget_folder_name"
// slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval"
const val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos"
const val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos"
const val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs"
const val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order"
const val SLIDESHOW_USE_FADE = "slideshow_use_fade"

View file

@ -57,32 +57,11 @@
</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:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingTop="@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:layout_below="@+id/include_photos_holder"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"