updating commons with initial dialog updates
This commit is contained in:
parent
648cf52663
commit
c5f56edf66
21 changed files with 204 additions and 200 deletions
|
@ -78,7 +78,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:ab6a89e3b9'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:2327fff588'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
|
||||
|
|
|
@ -390,7 +390,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
mPath == config.OTGPath -> getString(R.string.usb)
|
||||
else -> getHumanizedFilename(mPath)
|
||||
}
|
||||
updateActionBarTitle(if (mShowAll) resources.getString(R.string.all_folders) else dirName)
|
||||
//updateActionBarTitle(if (mShowAll) resources.getString(R.string.all_folders) else dirName)
|
||||
getMedia()
|
||||
setupLayoutManager()
|
||||
} else {
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import android.content.DialogInterface
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
|
@ -39,7 +39,8 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
|
|||
RadioItem(8, "8x"),
|
||||
RadioItem(16, "16x"),
|
||||
RadioItem(32, "32x"),
|
||||
RadioItem(64, "64x"))
|
||||
RadioItem(64, "64x")
|
||||
)
|
||||
|
||||
RadioGroupDialog(activity, items, thumbnailSpacing) {
|
||||
thumbnailSpacing = it as Int
|
||||
|
@ -50,10 +51,10 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
|
|||
|
||||
updateThumbnailSpacingText()
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beGone
|
||||
import com.simplemobiletools.commons.extensions.beVisible
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import com.simplemobiletools.gallery.pro.helpers.*
|
||||
|
@ -21,17 +16,15 @@ import kotlinx.android.synthetic.main.directory_item_grid_square.view.*
|
|||
|
||||
class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) : DialogInterface.OnClickListener {
|
||||
private var config = activity.config
|
||||
private var view: View
|
||||
private var view = activity.layoutInflater.inflate(R.layout.dialog_change_folder_thumbnail_style, null).apply {
|
||||
dialog_folder_limit_title.isChecked = config.limitFolderTitle
|
||||
}
|
||||
|
||||
init {
|
||||
view = activity.layoutInflater.inflate(R.layout.dialog_change_folder_thumbnail_style, null).apply {
|
||||
dialog_folder_limit_title.isChecked = config.limitFolderTitle
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
setupStyle()
|
||||
setupMediaCount()
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import android.content.DialogInterface
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -25,10 +25,10 @@ class ChangeGroupingDialog(val activity: BaseSimpleActivity, val path: String =
|
|||
grouping_dialog_radio_folder.beVisibleIf(path.isEmpty())
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.group_by)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,8 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import android.content.DialogInterface
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beGoneIf
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.isVisible
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -38,10 +34,10 @@ class ChangeSortingDialog(
|
|||
sorting_dialog_radio_custom.beVisibleIf(isDirectorySorting)
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.sort_by)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
|
||||
import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST
|
||||
|
@ -46,10 +46,10 @@ class ChangeViewTypeDialog(val activity: BaseSimpleActivity, val fromFoldersView
|
|||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,30 +2,31 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import android.app.Activity
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import kotlinx.android.synthetic.main.dialog_confirm_delete_folder.view.*
|
||||
|
||||
class ConfirmDeleteFolderDialog(activity: Activity, message: String, warningMessage: String, val callback: () -> Unit) {
|
||||
var dialog: AlertDialog
|
||||
private var dialog: AlertDialog? = null
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_confirm_delete_folder, null)
|
||||
view.message.text = message
|
||||
view.message_warning.text = warningMessage
|
||||
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.yes) { dialog, which -> dialogConfirmed() }
|
||||
|
||||
builder.setNegativeButton(R.string.no, null)
|
||||
|
||||
dialog = builder.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.yes) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,33 +3,36 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
import android.widget.EditText
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.showKeyboard
|
||||
import com.simplemobiletools.commons.extensions.value
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import kotlinx.android.synthetic.main.dialog_custom_aspect_ratio.view.*
|
||||
|
||||
class CustomAspectRatioDialog(val activity: BaseSimpleActivity, val defaultCustomAspectRatio: Pair<Float, Float>?, val callback: (aspectRatio: Pair<Float, Float>) -> Unit) {
|
||||
class CustomAspectRatioDialog(
|
||||
val activity: BaseSimpleActivity, val defaultCustomAspectRatio: Pair<Float, Float>?, val callback: (aspectRatio: Pair<Float, Float>) -> Unit
|
||||
) {
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_custom_aspect_ratio, null).apply {
|
||||
aspect_ratio_width.setText(defaultCustomAspectRatio?.first?.toInt()?.toString() ?: "")
|
||||
aspect_ratio_height.setText(defaultCustomAspectRatio?.second?.toInt()?.toString() ?: "")
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
showKeyboard(view.aspect_ratio_width)
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(view.aspect_ratio_width)
|
||||
val height = getViewValue(view.aspect_ratio_height)
|
||||
callback(Pair(width, height))
|
||||
dismiss()
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.aspect_ratio_width)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(view.aspect_ratio_width)
|
||||
val height = getViewValue(view.aspect_ratio_height)
|
||||
callback(Pair(width, height))
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getViewValue(view: EditText): Float {
|
||||
|
|
|
@ -2,27 +2,29 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import android.app.Activity
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.*
|
||||
|
||||
class DeleteWithRememberDialog(val activity: Activity, val message: String, val callback: (remember: Boolean) -> Unit) {
|
||||
private var dialog: AlertDialog
|
||||
private var dialog: AlertDialog? = null
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_delete_with_remember, null)!!
|
||||
|
||||
init {
|
||||
view.delete_remember_title.text = message
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.yes) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.no, null)
|
||||
|
||||
dialog = builder.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.yes) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
callback(view.delete_remember_checkbox.isChecked)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
import android.view.ViewGroup
|
||||
import android.widget.RadioButton
|
||||
import android.widget.RadioGroup
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.getBasePath
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
|
@ -13,8 +13,8 @@ import com.simplemobiletools.gallery.pro.extensions.config
|
|||
import kotlinx.android.synthetic.main.dialog_exclude_folder.view.*
|
||||
|
||||
class ExcludeFolderDialog(val activity: BaseSimpleActivity, val selectedPaths: List<String>, val callback: () -> Unit) {
|
||||
val alternativePaths = getAlternativePathsList()
|
||||
var radioGroup: RadioGroup? = null
|
||||
private val alternativePaths = getAlternativePathsList()
|
||||
private var radioGroup: RadioGroup? = null
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_exclude_folder, null).apply {
|
||||
|
@ -33,12 +33,12 @@ class ExcludeFolderDialog(val activity: BaseSimpleActivity, val selectedPaths: L
|
|||
radioGroup!!.addView(radioButton, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -22,10 +22,10 @@ class FilterMediaDialog(val activity: BaseSimpleActivity, val callback: (result:
|
|||
filter_media_portraits.isChecked = filterMedia and TYPE_PORTRAITS != 0
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.filter_media)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -31,12 +31,12 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
|
|||
manage_bottom_actions_resize.isChecked = actions and BOTTOM_ACTION_RESIZE != 0
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -25,12 +25,12 @@ class ManageExtendedDetailsDialog(val activity: BaseSimpleActivity, val callback
|
|||
manage_extended_details_gps_coordinates.isChecked = details and EXT_GPS != 0
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogConfirmed() {
|
||||
|
|
|
@ -2,12 +2,17 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import kotlinx.android.synthetic.main.dialog_other_aspect_ratio.view.*
|
||||
|
||||
class OtherAspectRatioDialog(val activity: BaseSimpleActivity, val lastOtherAspectRatio: Pair<Float, Float>?, val callback: (aspectRatio: Pair<Float, Float>) -> Unit) {
|
||||
private val dialog: AlertDialog
|
||||
class OtherAspectRatioDialog(
|
||||
val activity: BaseSimpleActivity,
|
||||
val lastOtherAspectRatio: Pair<Float, Float>?,
|
||||
val callback: (aspectRatio: Pair<Float, Float>) -> Unit
|
||||
) {
|
||||
private var dialog: AlertDialog? = null
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_other_aspect_ratio, null).apply {
|
||||
|
@ -53,22 +58,24 @@ class OtherAspectRatioDialog(val activity: BaseSimpleActivity, val lastOtherAspe
|
|||
}
|
||||
}
|
||||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun customRatioPicked() {
|
||||
CustomAspectRatioDialog(activity, lastOtherAspectRatio) {
|
||||
callback(it)
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun ratioPicked(pair: Pair<Float, Float>) {
|
||||
callback(pair)
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class PickDirectoryDialog(
|
|||
val isPickingFolderForWidget: Boolean,
|
||||
val callback: (path: String) -> Unit
|
||||
) {
|
||||
private var dialog: AlertDialog
|
||||
private var dialog: AlertDialog? = null
|
||||
private var shownDirectories = ArrayList<Directory>()
|
||||
private var allDirectories = ArrayList<Directory>()
|
||||
private var openedSubfolders = arrayListOf("")
|
||||
|
@ -41,7 +41,7 @@ class PickDirectoryDialog(
|
|||
|
||||
view.directories_fastscroller.updateColors(activity.getProperPrimaryColor())
|
||||
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
val builder = activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setOnKeyListener { dialogInterface, i, keyEvent ->
|
||||
|
@ -55,8 +55,9 @@ class PickDirectoryDialog(
|
|||
builder.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
|
||||
}
|
||||
|
||||
dialog = builder.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_destination) {
|
||||
builder.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_destination) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
view.directories_show_hidden.beVisibleIf(!context.config.shouldShowHidden)
|
||||
view.directories_show_hidden.setOnClickListener {
|
||||
activity.handleHiddenFolderPasswordProtection {
|
||||
|
@ -125,7 +126,7 @@ class PickDirectoryDialog(
|
|||
callback(path)
|
||||
}
|
||||
}
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
} else {
|
||||
currentPathPrefix = path
|
||||
|
@ -144,14 +145,14 @@ class PickDirectoryDialog(
|
|||
private fun backPressed() {
|
||||
if (activity.config.groupDirectSubfolders) {
|
||||
if (currentPathPrefix.isEmpty()) {
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
} else {
|
||||
openedSubfolders.removeAt(openedSubfolders.size - 1)
|
||||
currentPathPrefix = openedSubfolders.last()
|
||||
gotDirectories(allDirectories)
|
||||
}
|
||||
} else {
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.pro.dialogs
|
|||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
|
||||
|
@ -20,12 +21,12 @@ import com.simplemobiletools.gallery.pro.models.ThumbnailSection
|
|||
import kotlinx.android.synthetic.main.dialog_medium_picker.view.*
|
||||
|
||||
class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val callback: (path: String) -> Unit) {
|
||||
var dialog: AlertDialog
|
||||
var shownMedia = ArrayList<ThumbnailItem>()
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_medium_picker, null)
|
||||
val config = activity.config
|
||||
val viewType = config.getFolderViewType(if (config.showAll) SHOW_ALL else path)
|
||||
var isGridViewType = viewType == VIEW_TYPE_GRID
|
||||
private var dialog: AlertDialog? = null
|
||||
private var shownMedia = ArrayList<ThumbnailItem>()
|
||||
private val view = activity.layoutInflater.inflate(R.layout.dialog_medium_picker, null)
|
||||
private val config = activity.config
|
||||
private val viewType = config.getFolderViewType(if (config.showAll) SHOW_ALL else path)
|
||||
private var isGridViewType = viewType == VIEW_TYPE_GRID
|
||||
|
||||
init {
|
||||
(view.media_grid.layoutManager as MyGridLayoutManager).apply {
|
||||
|
@ -35,12 +36,14 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
|||
|
||||
view.media_fastscroller.updateColors(activity.getProperPrimaryColor())
|
||||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_photo)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_photo) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
}
|
||||
}
|
||||
|
||||
activity.getCachedMedia(path) {
|
||||
|
@ -60,7 +63,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
|||
private fun showOtherFolder() {
|
||||
PickDirectoryDialog(activity, path, true, true, false, false) {
|
||||
callback(it)
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +75,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
|||
val adapter = MediaAdapter(activity, shownMedia.clone() as ArrayList<ThumbnailItem>, null, true, false, path, view.media_grid) {
|
||||
if (it is Medium) {
|
||||
callback(it.path)
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,26 +47,26 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba
|
|||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.resize_and_save) {
|
||||
showKeyboard(view.image_width)
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
if (width <= 0 || height <= 0) {
|
||||
activity.toast(R.string.invalid_values)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
callback(newSize)
|
||||
dismiss()
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.resize_and_save) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.image_width)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
if (width <= 0 || height <= 0) {
|
||||
activity.toast(R.string.invalid_values)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
callback(newSize)
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getViewValue(view: EditText): Int {
|
||||
|
|
|
@ -68,54 +68,54 @@ class ResizeWithPathDialog(val activity: BaseSimpleActivity, val size: Point, va
|
|||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
showKeyboard(view.image_width)
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
if (width <= 0 || height <= 0) {
|
||||
activity.toast(R.string.invalid_values)
|
||||
return@setOnClickListener
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.image_width)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
if (width <= 0 || height <= 0) {
|
||||
activity.toast(R.string.invalid_values)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
|
||||
val filename = view.image_name.value
|
||||
val extension = view.image_extension.value
|
||||
if (filename.isEmpty()) {
|
||||
activity.toast(R.string.filename_cannot_be_empty)
|
||||
return@setOnClickListener
|
||||
}
|
||||
val filename = view.image_name.value
|
||||
val extension = view.image_extension.value
|
||||
if (filename.isEmpty()) {
|
||||
activity.toast(R.string.filename_cannot_be_empty)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
if (extension.isEmpty()) {
|
||||
activity.toast(R.string.extension_cannot_be_empty)
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (extension.isEmpty()) {
|
||||
activity.toast(R.string.extension_cannot_be_empty)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val newFilename = "$filename.$extension"
|
||||
val newPath = "${realPath.trimEnd('/')}/$newFilename"
|
||||
if (!newFilename.isAValidFilename()) {
|
||||
activity.toast(R.string.filename_invalid_characters)
|
||||
return@setOnClickListener
|
||||
}
|
||||
val newFilename = "$filename.$extension"
|
||||
val newPath = "${realPath.trimEnd('/')}/$newFilename"
|
||||
if (!newFilename.isAValidFilename()) {
|
||||
activity.toast(R.string.filename_invalid_characters)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
if (activity.getDoesFilePathExist(newPath)) {
|
||||
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename)
|
||||
ConfirmationDialog(activity, title) {
|
||||
callback(newSize, newPath)
|
||||
dismiss()
|
||||
}
|
||||
} else {
|
||||
if (activity.getDoesFilePathExist(newPath)) {
|
||||
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename)
|
||||
ConfirmationDialog(activity, title) {
|
||||
callback(newSize, newPath)
|
||||
dismiss()
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
} else {
|
||||
callback(newSize, newPath)
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getViewValue(view: EditText): Int {
|
||||
|
|
|
@ -14,7 +14,6 @@ class SaveAsDialog(
|
|||
val activity: BaseSimpleActivity, val path: String, val appendFilename: Boolean, val cancelCallback: (() -> Unit)? = null,
|
||||
val callback: (savePath: String) -> Unit
|
||||
) {
|
||||
|
||||
init {
|
||||
var realPath = path.getParentPath()
|
||||
if (activity.isRestrictedWithSAFSdk30(realPath) && !activity.isInDownloadDir(realPath)) {
|
||||
|
@ -48,14 +47,14 @@ class SaveAsDialog(
|
|||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel) { dialog, which -> cancelCallback?.invoke() }
|
||||
.setOnCancelListener { cancelCallback?.invoke() }
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.save_as) {
|
||||
showKeyboard(view.save_as_name)
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.save_as) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.save_as_name)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val filename = view.save_as_name.value
|
||||
val extension = view.save_as_extension.value
|
||||
|
||||
|
@ -87,15 +86,15 @@ class SaveAsDialog(
|
|||
val fileUris = activity.getFileUrisFromFileDirItems(fileDirItem)
|
||||
activity.updateSDK30Uris(fileUris) { success ->
|
||||
if (success) {
|
||||
selectPath(this, newPath)
|
||||
selectPath(alertDialog, newPath)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectPath(this, newPath)
|
||||
selectPath(alertDialog, newPath)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectPath(this, newPath)
|
||||
selectPath(alertDialog, newPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.view.View
|
|||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||
import com.simplemobiletools.commons.extensions.hideKeyboard
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.extensions.value
|
||||
|
@ -17,16 +18,12 @@ import com.simplemobiletools.gallery.pro.helpers.SLIDESHOW_DEFAULT_INTERVAL
|
|||
import kotlinx.android.synthetic.main.dialog_slideshow.view.*
|
||||
|
||||
class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) {
|
||||
val view: View
|
||||
private val view: View
|
||||
|
||||
init {
|
||||
view = activity.layoutInflater.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()
|
||||
}
|
||||
interval_value.selectAll()
|
||||
}
|
||||
|
||||
interval_value.setOnFocusChangeListener { v, hasFocus ->
|
||||
|
@ -36,9 +33,10 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
|
|||
|
||||
animation_holder.setOnClickListener {
|
||||
val items = arrayListOf(
|
||||
RadioItem(SLIDESHOW_ANIMATION_NONE, activity.getString(R.string.no_animation)),
|
||||
RadioItem(SLIDESHOW_ANIMATION_SLIDE, activity.getString(R.string.slide)),
|
||||
RadioItem(SLIDESHOW_ANIMATION_FADE, activity.getString(R.string.fade)))
|
||||
RadioItem(SLIDESHOW_ANIMATION_NONE, activity.getString(R.string.no_animation)),
|
||||
RadioItem(SLIDESHOW_ANIMATION_SLIDE, activity.getString(R.string.slide)),
|
||||
RadioItem(SLIDESHOW_ANIMATION_FADE, activity.getString(R.string.fade))
|
||||
)
|
||||
|
||||
RadioGroupDialog(activity, items, activity.config.slideshowAnimation) {
|
||||
activity.config.slideshowAnimation = it as Int
|
||||
|
@ -73,19 +71,19 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
|
|||
}
|
||||
setupValues()
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this) {
|
||||
hideKeyboard()
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
storeValues()
|
||||
callback()
|
||||
dismiss()
|
||||
}
|
||||
activity.getAlertDialogBuilder()
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
alertDialog.hideKeyboard()
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
storeValues()
|
||||
callback()
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupValues() {
|
||||
|
|
Loading…
Reference in a new issue