update Commons with some dialog crashfixes

This commit is contained in:
tibbi 2017-12-01 11:04:26 +01:00
parent 84fee84349
commit 9fbbd902e8
7 changed files with 59 additions and 57 deletions

View file

@ -47,7 +47,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:3.0.13'
implementation 'com.simplemobiletools:commons:3.0.16'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
implementation 'com.android.support:multidex:1.0.2'

View file

@ -81,7 +81,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mIsGetAnyContentIntent || mIsSetWallpaperIntent
removeTempFolder()
directories_refresh_layout.setOnRefreshListener({ getDirectories() })
directories_refresh_layout.setOnRefreshListener { getDirectories() }
mDirs = ArrayList()
storeStateVariables()
checkWhatsNewDialog()

View file

@ -1,23 +1,22 @@
package com.simplemobiletools.gallery.dialogs
import android.content.Context
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.*
class DeleteWithRememberDialog(val context: Context, val callback: (remember: Boolean) -> Unit) {
var dialog: AlertDialog
val view = LayoutInflater.from(context).inflate(R.layout.dialog_delete_with_remember, null)
class DeleteWithRememberDialog(val activity: Activity, val callback: (remember: Boolean) -> Unit) {
private var dialog: AlertDialog
val view = activity.layoutInflater.inflate(R.layout.dialog_delete_with_remember, null)!!
init {
val builder = AlertDialog.Builder(context)
val builder = AlertDialog.Builder(activity)
.setPositiveButton(R.string.yes, { dialog, which -> dialogConfirmed() })
.setNegativeButton(R.string.no, null)
dialog = builder.create().apply {
context.setupDialogStuff(view, this)
activity.setupDialogStuff(view, this)
}
}

View file

@ -74,8 +74,8 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
activity.setupDialogStuff(view, this, R.string.resize_and_save)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
activity.setupDialogStuff(view, this, R.string.resize_and_save) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val width = getViewValue(widthView)
val height = getViewValue(heightView)
if (width <= 0 || height <= 0) {
@ -86,7 +86,8 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
callback(newSize)
dismiss()
})
}
}
}
}

View file

@ -46,8 +46,8 @@ class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appen
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
activity.setupDialogStuff(view, this, R.string.save_as)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
activity.setupDialogStuff(view, this, R.string.save_as) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.save_as_name.value
val extension = view.save_as_extension.value
@ -77,7 +77,8 @@ class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appen
callback(newFile.absolutePath)
dismiss()
}
})
}
}
}
}
}

View file

@ -73,8 +73,8 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
activity.setupDialogStuff(view, this)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
activity.setupDialogStuff(view, this) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
if (!view.include_photos.isChecked && !view.include_videos.isChecked && !view.include_gifs.isChecked) {
activity.toast(R.string.no_media_for_slideshow)
return@setOnClickListener
@ -83,7 +83,8 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
storeValues()
callback()
dismiss()
})
}
}
}
}

View file

@ -119,7 +119,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
mSurfaceView = mView.video_surface
mSurfaceHolder = mSurfaceView!!.holder
mSurfaceHolder!!.addCallback(this)
mSurfaceView!!.setOnClickListener({ toggleFullscreen() })
mSurfaceView!!.setOnClickListener { toggleFullscreen() }
mView.video_holder.setOnClickListener { toggleFullscreen() }
mView.video_volume_controller.setOnTouchListener { v, event ->
handleVolumeTouched(event)
@ -423,7 +423,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
setDataSource(context, Uri.parse(mediumPath))
setDisplay(mSurfaceHolder)
setOnCompletionListener { videoCompleted() }
setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() })
setOnVideoSizeChangedListener { mediaPlayer, width, height -> setVideoSize() }
setOnPreparedListener { videoPrepared(it) }
setAudioStreamType(AudioManager.STREAM_MUSIC)
prepare()