Merge pull request #255 from dmitriy-chernysh/copy-blank-text-fix#244
Do not trim text in clipboard
This commit is contained in:
commit
d310b7ad58
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue