use different toggles for photos and gifs at the slideshow setup

This commit is contained in:
tibbi 2017-09-05 16:06:42 +02:00
parent ac1c84d279
commit 067798e5c2
23 changed files with 75 additions and 20 deletions

View File

@ -361,13 +361,17 @@ 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
mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() } as MutableList
}
if (!config.slideshowIncludeVideos) {
mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGif() } as MutableList
}
if (!config.slideshowIncludeGIFs) {
mSlideshowMedia = mSlideshowMedia.filter { !it.isGif() } as MutableList
}
if (config.slideshowRandomOrder) {
Collections.shuffle(mSlideshowMedia)
mPos = 0

View File

@ -42,6 +42,11 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
include_videos.toggle()
}
include_gifs_holder.setOnClickListener {
interval_value.clearFocus()
include_gifs.toggle()
}
random_order_holder.setOnClickListener {
interval_value.clearFocus()
random_order.toggle()
@ -74,6 +79,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
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
move_backwards.isChecked = config.slideshowMoveBackwards
@ -89,6 +95,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) {
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
slideshowMoveBackwards = view.move_backwards.isChecked

View File

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

View File

@ -41,6 +41,7 @@ val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
val SLIDESHOW_INTERVAL = "slideshow_interval"
val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos"
val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos"
val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs"
val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order"
val SLIDESHOW_USE_FADE = "slideshow_use_fade"
val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards"

View File

@ -78,7 +78,7 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/random_order_holder"
android:id="@+id/include_gifs_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include_videos_holder"
@ -88,6 +88,27 @@
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/include_gifs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:text="@string/include_gifs"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/random_order_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include_gifs_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
android:id="@+id/random_order"
android:layout_width="match_parent"

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Diashow</string>
<string name="interval">Intervall (Sekunden):</string>
<string name="include_photos">Bilder/GIFs verwenden</string>
<string name="include_photos">Bilder verwenden</string>
<string name="include_videos">Videos verwenden</string>
<string name="include_gifs">GIF verwenden</string>
<string name="random_order">Zufällige Reihenfolge</string>
<string name="use_fade">Übergänge animieren</string>
<string name="move_backwards">Rückwärts abspielen</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Diaporama</string>
<string name="interval">Intervalle (secondes):</string>
<string name="include_photos">Inclure photos et GIFs</string>
<string name="include_photos">Inclure photos</string>
<string name="include_videos">Inclure vidéos</string>
<string name="include_gifs">Inclure GIFs</string>
<string name="random_order">Ordre aléatoire</string>
<string name="use_fade">Utiliser un fondu</string>
<string name="move_backwards">Revenir en arrière</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Presentazione</string>
<string name="interval">Intervallo (secondi):</string>
<string name="include_photos">Includi foto e GIF</string>
<string name="include_photos">Includi foto</string>
<string name="include_videos">Includi video</string>
<string name="include_gifs">Includi GIF</string>
<string name="random_order">Ordine sparso</string>
<string name="use_fade">Usa animazioni a dissolvenza</string>
<string name="move_backwards">Scorri al contrario</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Pokaz slajdów</string>
<string name="interval">Przedział (sekundy):</string>
<string name="include_photos">Dołączaj zdjęcia i GIFy</string>
<string name="include_photos">Dołączaj zdjęcia</string>
<string name="include_videos">Dołączaj filmy</string>
<string name="include_gifs">Dołączaj GIFy</string>
<string name="random_order">Losowa kolejność</string>
<string name="use_fade">Używaj płynnych przejść</string>
   <string name="move_backwards">Odwrotna kolejność</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Apresentação</string>
<string name="interval">Intervalo (segundos):</string>
<string name="include_photos">Incluir fotos e GIFs</string>
<string name="include_photos">Incluir fotos</string>
<string name="include_videos">Incluir vídeos</string>
<string name="include_gifs">Incluir GIFs</string>
<string name="random_order">Ordem aleatória</string>
<string name="use_fade">Usar animações</string>
<string name="move_backwards">Mover para trás</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Prezentácia</string>
<string name="interval">Interval (sekundy):</string>
<string name="include_photos">Zahrnúť fotky a GIF súbory</string>
<string name="include_photos">Zahrnúť fotky</string>
<string name="include_videos">Zahrnúť videá</string>
<string name="include_gifs">Zahrnúť GIFy</string>
<string name="random_order">Náhodné poradie</string>
<string name="use_fade">Používať miznúce animácie</string>
<string name="move_backwards">Ísť opačným smerom</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">幻灯片</string>
<string name="interval">间隔(秒):</string>
<string name="include_photos">包含照片和动态图</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">包含视频</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">随机顺序</string>
<string name="use_fade">使用渐变动画</string>
<string name="move_backwards">倒播</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">投影片</string>
<string name="interval">間隔 (秒):</string>
<string name="include_photos">包含照片和GIF</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">包含影片</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">隨機順序</string>
<string name="use_fade">使用淡入淡出動畫</string>
<string name="move_backwards">反向播放</string>

View File

@ -92,8 +92,9 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval (seconds):</string>
<string name="include_photos">Include photos and GIFs</string>
<string name="include_photos">Include photos</string>
<string name="include_videos">Include videos</string>
<string name="include_gifs">Include GIFs</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>