adding an Animation field at the slideshow config dialog

This commit is contained in:
tibbi 2019-06-20 15:40:33 +02:00
parent ecb1557bd7
commit c60e321278
3 changed files with 52 additions and 2 deletions

View File

@ -7,6 +7,8 @@ import com.simplemobiletools.commons.extensions.hideKeyboard
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.helpers.SLIDESHOW_ANIMATION_FADE
import com.simplemobiletools.gallery.pro.helpers.SLIDESHOW_ANIMATION_SLIDE
import com.simplemobiletools.gallery.pro.helpers.SLIDESHOW_DEFAULT_INTERVAL
import kotlinx.android.synthetic.main.dialog_slideshow.view.*
@ -28,6 +30,10 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
activity.hideKeyboard(v)
}
animation_holder.setOnClickListener {
}
include_videos_holder.setOnClickListener {
interval_value.clearFocus()
include_videos.toggle()
@ -74,6 +80,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
val config = activity.config
view.apply {
interval_value.setText(config.slideshowInterval.toString())
animation_value.text = getAnimationText()
include_videos.isChecked = config.slideshowIncludeVideos
include_gifs.isChecked = config.slideshowIncludeGIFs
random_order.isChecked = config.slideshowRandomOrder
@ -96,4 +103,12 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
loopSlideshow = view.loop_slideshow.isChecked
}
}
private fun getAnimationText(): String {
return when (activity.config.slideshowAnimation) {
SLIDESHOW_ANIMATION_SLIDE -> activity.getString(R.string.slide)
SLIDESHOW_ANIMATION_FADE -> activity.getString(R.string.fade)
else -> activity.getString(R.string.no_animation)
}
}
}

View File

@ -2,6 +2,7 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -105,7 +106,8 @@
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin"
android:background="@null"
android:clickable="false"/>
android:clickable="false"
tools:text="@string/compromise"/>
</RelativeLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/slideshow_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -35,10 +36,42 @@
android:textSize="@dimen/normal_text_size"/>
<RelativeLayout
android:id="@+id/include_videos_holder"
android:id="@+id/animation_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/interval_label"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/bigger_margin"
android:paddingBottom="@dimen/bigger_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/animation_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/animation_value"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/animation"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/animation_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/medium_margin"
android:background="@null"
android:clickable="false"
tools:text="@string/slide"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/include_videos_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/animation_holder"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin"