mirror of
				https://github.com/SimpleMobileTools/Simple-Keyboard.git
				synced 2025-06-05 21:49:26 +02:00 
			
		
		
		
	Merge pull request #255 from dmitriy-chernysh/copy-blank-text-fix#244
Do not trim text in clipboard
This commit is contained in:
		| @@ -24,7 +24,7 @@ class AddOrEditClipDialog(val activity: BaseSimpleActivity, val originalClip: Cl | |||||||
|                 activity.setupDialogStuff(binding.root, this) { alertDialog -> |                 activity.setupDialogStuff(binding.root, this) { alertDialog -> | ||||||
|                     alertDialog.showKeyboard(binding.addClipValue) |                     alertDialog.showKeyboard(binding.addClipValue) | ||||||
|                     alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { |                     alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { | ||||||
|                         val clipValue = binding.addClipValue.value |                         val clipValue = binding.addClipValue.text.toString() | ||||||
|                         if (clipValue.isEmpty()) { |                         if (clipValue.isEmpty()) { | ||||||
|                             activity.toast(R.string.value_cannot_be_empty) |                             activity.toast(R.string.value_cannot_be_empty) | ||||||
|                             return@setOnClickListener |                             return@setOnClickListener | ||||||
|   | |||||||
| @@ -47,7 +47,7 @@ val Context.clipsDB: ClipsDao | |||||||
|  |  | ||||||
| fun Context.getCurrentClip(): String? { | fun Context.getCurrentClip(): String? { | ||||||
|     val clipboardManager = (getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager) |     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 { | fun Context.getStrokeColor(): Int { | ||||||
|   | |||||||
| @@ -8,7 +8,6 @@ class ClipsHelper(val context: Context) { | |||||||
|  |  | ||||||
|     // make sure clips have unique values |     // make sure clips have unique values | ||||||
|     fun insertClip(clip: Clip): Long { |     fun insertClip(clip: Clip): Long { | ||||||
|         clip.value = clip.value.trim() |  | ||||||
|         return if (context.clipsDB.getClipWithValue(clip.value) == null) { |         return if (context.clipsDB.getClipWithValue(clip.value) == null) { | ||||||
|             context.clipsDB.insertOrUpdate(clip) |             context.clipsDB.insertOrUpdate(clip) | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user