mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-04 05:40:17 +00:00
rename package
introduces weird bugs for some reason
This commit is contained in:
parent
8c40d4f3e8
commit
a91a90bfbd
312 changed files with 1620 additions and 1612 deletions
|
@ -0,0 +1,33 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
package helium314.keyboard.latin
|
||||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable
|
||||
data class ClipboardHistoryEntry (
|
||||
var timeStamp: Long,
|
||||
@Serializable(with = CharSequenceStringSerializer::class)
|
||||
val content: CharSequence,
|
||||
var isPinned: Boolean = false
|
||||
) : Comparable<ClipboardHistoryEntry> {
|
||||
override fun compareTo(other: ClipboardHistoryEntry): Int {
|
||||
val result = other.isPinned.compareTo(isPinned)
|
||||
return if (result != 0) result else other.timeStamp.compareTo(timeStamp)
|
||||
}
|
||||
}
|
||||
|
||||
class CharSequenceStringSerializer : KSerializer<CharSequence> {
|
||||
override val descriptor = PrimitiveSerialDescriptor("CharSequence", PrimitiveKind.STRING)
|
||||
|
||||
override fun serialize(encoder: Encoder, value: CharSequence) {
|
||||
encoder.encodeString(value.toString())
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder) = decoder.decodeString()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue