From c06fe43a687252e16a172bfaefd68eec9d0dc10b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 4 Aug 2017 21:19:04 +0200 Subject: [PATCH] adding an initial slideshow setup dialog --- .../gallery/activities/ViewPagerActivity.kt | 4 + .../gallery/dialogs/ExcludeFolderDialog.kt | 1 - .../gallery/dialogs/SlideshowDialog.kt | 51 +++++++++ app/src/main/res/layout/dialog_slideshow.xml | 104 ++++++++++++++++++ app/src/main/res/values-cs/strings.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-it/strings.xml | 2 +- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-pl/strings.xml | 2 +- app/src/main/res/values-pt-rBR/strings.xml | 2 +- app/src/main/res/values-pt/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-sk/strings.xml | 2 +- app/src/main/res/values-sv/strings.xml | 2 +- app/src/main/res/values-tr/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 2 +- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 21 files changed, 176 insertions(+), 18 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt create mode 100644 app/src/main/res/layout/dialog_slideshow.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index d8c9cd241..9f34993cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -17,6 +17,7 @@ import android.os.Build import android.os.Bundle import android.provider.MediaStore import android.support.v4.view.ViewPager +import android.transition.Slide import android.util.DisplayMetrics import android.view.* import com.simplemobiletools.commons.dialogs.ConfirmationDialog @@ -28,6 +29,7 @@ import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask import com.simplemobiletools.gallery.dialogs.SaveAsDialog +import com.simplemobiletools.gallery.dialogs.SlideshowDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment import com.simplemobiletools.gallery.fragments.ViewPagerFragment @@ -247,7 +249,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun initSlideshow() { + SlideshowDialog(this) { + } } private fun copyMoveTo(isCopyOperation: Boolean) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ExcludeFolderDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ExcludeFolderDialog.kt index 936433cb3..defa365fc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ExcludeFolderDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ExcludeFolderDialog.kt @@ -14,7 +14,6 @@ import com.simplemobiletools.gallery.extensions.config import kotlinx.android.synthetic.main.dialog_exclude_folder.view.* class ExcludeFolderDialog(val activity: SimpleActivity, val selectedPaths: List, val callback: () -> Unit) { - var dialog: AlertDialog? = null val alternativePaths = getAlternativePathsList() var radioGroup: RadioGroup? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt new file mode 100644 index 000000000..8ce824e02 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -0,0 +1,51 @@ +package com.simplemobiletools.gallery.dialogs + +import android.support.v7.app.AlertDialog +import android.view.LayoutInflater +import android.view.WindowManager +import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.SimpleActivity +import kotlinx.android.synthetic.main.dialog_slideshow.view.* + + +class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { + var dialog: AlertDialog + + init { + val view = LayoutInflater.from(activity).inflate(R.layout.dialog_slideshow, null).apply { + interval_value.setOnClickListener { + val text = interval_value.text + if (text.isNotEmpty()) { + text.replace(0, 1, text.subSequence(0, 1), 0, 1) + interval_value.selectAll() + } + } + + include_videos_holder.setOnClickListener { + include_videos.toggle() + } + + random_order_holder.setOnClickListener { + random_order.toggle() + } + + use_fade_holder.setOnClickListener { + use_fade.toggle() + } + } + + dialog = AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() }) + .setNegativeButton(R.string.cancel, null) + .create().apply { + window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) + activity.setupDialogStuff(view, this) + currentFocus?.clearFocus() + } + } + + private fun dialogConfirmed() { + + } +} diff --git a/app/src/main/res/layout/dialog_slideshow.xml b/app/src/main/res/layout/dialog_slideshow.xml new file mode 100644 index 000000000..6558dc17c --- /dev/null +++ b/app/src/main/res/layout/dialog_slideshow.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ae6d5e5d3..40d71a3fc 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 7fc9f8aae..39aed4245 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 686bf180c..fb1fbb8ce 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index edf38033b..84d095ab4 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index a4a9b8135..ce5ecab3b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 756b14eb4..57da6ce18 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 1db0cc43d..e2f372b89 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index eff70d5e4..49e9e8802 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 21f64ac03..310109fa2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -82,7 +82,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 3352875be..b2401407b 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 85c64a684..363f435fb 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f9bd2312a..f5beb86b5 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -81,7 +81,7 @@ Prezentácia - Interval + Interval (sekundy): Zahrnúť videá Náhodné poradie Používať miznúce animácie diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 540589920..fa8881770 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 19408787d..b79d919d5 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index bf147404b..d04ea72bc 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b0403528b..651704630 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7bd64fd1b..a10a370cd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,7 +81,7 @@ Slideshow - Interval + Interval (seconds): Include videos Random order Use fade animations