Skip to content
Snippets Groups Projects
Commit 85d5365e authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Fix default clipboard entry reappearing bug

parent b1d9667e
No related branches found
No related tags found
No related merge requests found
......@@ -187,16 +187,18 @@ fun ClipboardEntryViewPreview() {
}
}
val DefaultClipboardEntry = ClipboardEntry(
timestamp = 0L,
pinned = true,
text = "Clipboard entries will appear here",
uri = null,
mimeTypes = listOf()
)
class ClipboardHistoryManager(val context: Context, val coroutineScope: LifecycleCoroutineScope) : PersistentActionState {
private val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clipboardHistory = mutableStateListOf(ClipboardEntry(
timestamp = 0L,
pinned = true,
text = "Clipboard entries will appear here",
uri = null,
mimeTypes = listOf()
))
val clipboardHistory = mutableStateListOf<ClipboardEntry>()
var clipboardLoaded = false
......@@ -351,6 +353,8 @@ class ClipboardHistoryManager(val context: Context, val coroutineScope: Lifecycl
clipboardHistory.clear()
clipboardHistory.addAll(data)
pruneOldItems()
} else {
clipboardHistory.add(DefaultClipboardEntry)
}
clipboardLoaded = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment