store clipboard history entries in companion object

fixes #548
This commit is contained in:
Helium314 2024-03-10 19:08:18 +01:00
parent 7d004c1c79
commit ec4d0558e7

View file

@ -17,7 +17,6 @@ class ClipboardHistoryManager(
) : ClipboardManager.OnPrimaryClipChangedListener {
private lateinit var clipboardManager: ClipboardManager
private val historyEntries: MutableList<ClipboardHistoryEntry> = ArrayList()
private var onHistoryChangeListener: OnHistoryChangeListener? = null
fun onCreate() {
@ -149,4 +148,9 @@ class ClipboardHistoryManager(
fun onClipboardHistoryEntriesRemoved(pos: Int, count: Int)
fun onClipboardHistoryEntryMoved(from: Int, to: Int)
}
companion object {
// store pinned clips in companion object so they survive a keyboard switch (which destroys the current instance)
private val historyEntries: MutableList<ClipboardHistoryEntry> = ArrayList()
}
}