mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
updating commons
This commit is contained in:
@ -65,7 +65,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:7df0d79980'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:c070dff787'
|
||||||
|
|
||||||
kapt 'androidx.room:room-compiler:2.4.2'
|
kapt 'androidx.room:room-compiler:2.4.2'
|
||||||
implementation 'androidx.room:room-runtime:2.4.2'
|
implementation 'androidx.room:room-runtime:2.4.2'
|
||||||
|
@ -2,13 +2,9 @@ package com.simplemobiletools.keyboard.dialogs
|
|||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.showKeyboard
|
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
|
||||||
import com.simplemobiletools.commons.extensions.value
|
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.R
|
||||||
import com.simplemobiletools.keyboard.extensions.clipsDB
|
|
||||||
import com.simplemobiletools.keyboard.helpers.ClipsHelper
|
import com.simplemobiletools.keyboard.helpers.ClipsHelper
|
||||||
import com.simplemobiletools.keyboard.models.Clip
|
import com.simplemobiletools.keyboard.models.Clip
|
||||||
import kotlinx.android.synthetic.main.dialog_add_or_edit_clip.view.*
|
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)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.create().apply {
|
.apply {
|
||||||
activity.setupDialogStuff(view, this) {
|
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||||
showKeyboard(view.add_clip_value)
|
alertDialog.showKeyboard(view.add_clip_value)
|
||||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
val clipValue = view.add_clip_value.value
|
val clipValue = view.add_clip_value.value
|
||||||
if (clipValue.isEmpty()) {
|
if (clipValue.isEmpty()) {
|
||||||
activity.toast(R.string.value_cannot_be_empty)
|
activity.toast(R.string.value_cannot_be_empty)
|
||||||
@ -43,7 +39,7 @@ class AddOrEditClipDialog(val activity: BaseSimpleActivity, val originalClip: Cl
|
|||||||
ClipsHelper(activity).insertClip(clip)
|
ClipsHelper(activity).insertClip(clip)
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
callback()
|
callback()
|
||||||
dismiss()
|
alertDialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,12 @@ class ExportClipsDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder(activity)
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.create().apply {
|
.apply {
|
||||||
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) {
|
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) { alertDialog ->
|
||||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
val filename = view.export_clips_filename.value
|
val filename = view.export_clips_filename.value
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
activity.toast(R.string.filename_cannot_be_empty)
|
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())
|
val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newPath.getFilenameFromPath())
|
||||||
ConfirmationDialog(activity, title) {
|
ConfirmationDialog(activity, title) {
|
||||||
callback(newPath, filename)
|
callback(newPath, filename)
|
||||||
dismiss()
|
alertDialog.dismiss()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(newPath, filename)
|
callback(newPath, filename)
|
||||||
dismiss()
|
alertDialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user