Do not trim text in clipboard
This commit is contained in:
Tibor Kaputa 2023-10-11 09:53:37 +02:00 committed by GitHub
commit d310b7ad58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View file

@ -24,7 +24,7 @@ class AddOrEditClipDialog(val activity: BaseSimpleActivity, val originalClip: Cl
activity.setupDialogStuff(binding.root, this) { alertDialog ->
alertDialog.showKeyboard(binding.addClipValue)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val clipValue = binding.addClipValue.value
val clipValue = binding.addClipValue.text.toString()
if (clipValue.isEmpty()) {
activity.toast(R.string.value_cannot_be_empty)
return@setOnClickListener

View file

@ -47,7 +47,7 @@ val Context.clipsDB: ClipsDao
fun Context.getCurrentClip(): String? {
val clipboardManager = (getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
return clipboardManager.primaryClip?.getItemAt(0)?.text?.trim()?.toString()
return clipboardManager.primaryClip?.getItemAt(0)?.text?.toString()
}
fun Context.getStrokeColor(): Int {

View file

@ -8,7 +8,6 @@ class ClipsHelper(val context: Context) {
// make sure clips have unique values
fun insertClip(clip: Clip): Long {
clip.value = clip.value.trim()
return if (context.clipsDB.getClipWithValue(clip.value) == null) {
context.clipsDB.insertOrUpdate(clip)
} else {