adding an initial slideshow setup dialog

This commit is contained in:
tibbi 2017-08-04 21:19:04 +02:00
parent 8ff6c8d1f7
commit c06fe43a68
21 changed files with 176 additions and 18 deletions

View file

@ -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,8 +249,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun initSlideshow() {
SlideshowDialog(this) {
}
}
private fun copyMoveTo(isCopyOperation: Boolean) {
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }

View file

@ -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<String>, val callback: () -> Unit) {
var dialog: AlertDialog? = null
val alternativePaths = getAlternativePathsList()
var radioGroup: RadioGroup? = null

View file

@ -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() {
}
}

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slideshow_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<requestFocus/>
<RelativeLayout
android:id="@+id/slideshow_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/interval_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/interval"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/interval_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:ems="5"
android:gravity="right"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="2"
android:text="5"
android:textCursorDrawable="@null"/>
<RelativeLayout
android:id="@+id/include_videos_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/interval_label"
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/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/random_order_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include_videos_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"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:text="@string/random_order"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/use_fade_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/random_order_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/use_fade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:text="@string/use_fade"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -82,7 +82,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Prezentácia</string>
<string name="interval">Interval</string>
<string name="interval">Interval (sekundy):</string>
<string name="include_videos">Zahrnúť videá</string>
<string name="random_order">Náhodné poradie</string>
<string name="use_fade">Používať miznúce animácie</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>

View file

@ -81,7 +81,7 @@
<!-- Slideshow -->
<string name="slideshow">Slideshow</string>
<string name="interval">Interval</string>
<string name="interval">Interval (seconds):</string>
<string name="include_videos">Include videos</string>
<string name="random_order">Random order</string>
<string name="use_fade">Use fade animations</string>