show a toast if the slideshow ended + implement moving backwards

This commit is contained in:
tibbi 2017-08-05 13:34:30 +02:00
parent e3a5b9356e
commit c47ddc536d
18 changed files with 26 additions and 1 deletions

View file

@ -52,8 +52,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private var mRotationDegrees = 0f
private var mLastHandledOrientation = 0
private var mPrevHashcode = 0
private var mSlideshowHandler = Handler()
private var mSlideshowInterval = SLIDESHOW_DEFAULT_INTERVAL
private var mSlideshowMoveBackwards = false
companion object {
var screenWidth = 0
@ -261,6 +263,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun startSlideshow() {
hideSystemUI()
mSlideshowInterval = config.slideshowInterval
mSlideshowMoveBackwards = config.slideshowMoveBackwards
mIsSlideshowActive = true
scheduleSwipe()
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@ -280,7 +283,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (mIsSlideshowActive) {
mSlideshowHandler.postDelayed({
if (mIsSlideshowActive && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !isDestroyed) {
view_pager.currentItem = ++view_pager.currentItem
val before = view_pager.currentItem
view_pager.currentItem = if (mSlideshowMoveBackwards) --view_pager.currentItem else ++view_pager.currentItem
if (before == view_pager.currentItem) {
stopSlideshow()
toast(R.string.slideshow_ended)
}
}
}, mSlideshowInterval * 1000L)
}

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Zobrazit skryté média</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Versteckte Ordner zeigen</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Mostrar carpetas ocultas</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Afficher les dossiers cachés</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Show hidden media</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Mostra cartelle nascoste</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">非表示フォルダーを表示</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Pokazuj ukryte foldery</string>

View file

@ -87,6 +87,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Mostrar pastas ocultas</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Mostrar pastas ocultas</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Показать скрытые папки</string>

View file

@ -86,6 +86,7 @@
<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>
<string name="slideshow_ended">Prezentácia skončila</string>
<!-- Settings -->
<string name="show_hidden_media">Zobraziť skryté médiá</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Visa dolda mappar</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Gizli klasörleri göster</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">显示所有</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">秀出隱藏資料夾</string>

View file

@ -86,6 +86,7 @@
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>
<string name="move_backwards">Move backwards</string>
<string name="slideshow_ended">The slideshow ended</string>
<!-- Settings -->
<string name="show_hidden_media">Show hidden media</string>