truncate display of clipboard text for performance reasons

fixes #1236
This commit is contained in:
Helium314 2025-01-03 18:09:51 +01:00
parent 7652af888d
commit a1c70a1181
2 changed files with 3 additions and 2 deletions

View file

@ -76,7 +76,7 @@ class ClipboardAdapter(
fun setContent(historyEntry: ClipboardHistoryEntry?) {
itemView.tag = historyEntry?.timeStamp
contentView.text = historyEntry?.content
contentView.text = historyEntry?.content?.take(1000) // truncate displayed text for performance reasons
pinnedIconView.visibility = if (historyEntry?.isPinned == true) View.VISIBLE else View.GONE
}

View file

@ -198,7 +198,8 @@ class ClipboardHistoryManager(
// create the view
val binding = ClipboardSuggestionBinding.inflate(LayoutInflater.from(latinIME), parent, false)
val textView = binding.clipboardSuggestionText
textView.text = if (isClipSensitive(inputType)) "*".repeat(content.length) else content
textView.text = (if (isClipSensitive(inputType)) "*".repeat(content.length) else content)
.take(200) // truncate displayed text for performance reasons
val clipIcon = latinIME.mKeyboardSwitcher.keyboard.mIconsSet.getIconDrawable(ToolbarKey.PASTE.name.lowercase())
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(clipIcon, null, null, null)
textView.setOnClickListener {