updating commons

This commit is contained in:
tibbi 2022-07-06 18:21:24 +02:00
parent 52170bdced
commit 6cd065806c
3 changed files with 14 additions and 18 deletions

View file

@ -65,7 +65,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:7df0d79980'
implementation 'com.github.SimpleMobileTools:Simple-Commons:c070dff787'
kapt 'androidx.room:room-compiler:2.4.2'
implementation 'androidx.room:room-runtime:2.4.2'

View file

@ -2,13 +2,9 @@ package com.simplemobiletools.keyboard.dialogs
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.showKeyboard
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.keyboard.R
import com.simplemobiletools.keyboard.extensions.clipsDB
import com.simplemobiletools.keyboard.helpers.ClipsHelper
import com.simplemobiletools.keyboard.models.Clip
import kotlinx.android.synthetic.main.dialog_add_or_edit_clip.view.*
@ -21,13 +17,13 @@ class AddOrEditClipDialog(val activity: BaseSimpleActivity, val originalClip: Cl
}
}
AlertDialog.Builder(activity)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this) {
showKeyboard(view.add_clip_value)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
.apply {
activity.setupDialogStuff(view, this) { alertDialog ->
alertDialog.showKeyboard(view.add_clip_value)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val clipValue = view.add_clip_value.value
if (clipValue.isEmpty()) {
activity.toast(R.string.value_cannot_be_empty)
@ -43,7 +39,7 @@ class AddOrEditClipDialog(val activity: BaseSimpleActivity, val originalClip: Cl
ClipsHelper(activity).insertClip(clip)
activity.runOnUiThread {
callback()
dismiss()
alertDialog.dismiss()
}
}
}

View file

@ -37,12 +37,12 @@ class ExportClipsDialog(
}
}
AlertDialog.Builder(activity)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
.apply {
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) { alertDialog ->
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.export_clips_filename.value
if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty)
@ -60,11 +60,11 @@ class ExportClipsDialog(
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newPath.getFilenameFromPath())
ConfirmationDialog(activity, title) {
callback(newPath, filename)
dismiss()
alertDialog.dismiss()
}
} else {
callback(newPath, filename)
dismiss()
alertDialog.dismiss()
}
}
}