diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-09 00:15:10 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-09 00:15:10 +0700 |
commit | ddc94dc9388086657b889d8fd43a82bcadd82bbe (patch) | |
tree | a407b76c62122298e43ff51b10a78114637d5bba /src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt | |
parent | 7612c2e65d07e9b3ce13729da4eb95a6d7173a71 (diff) | |
download | Chatting-ddc94dc9388086657b889d8fd43a82bcadd82bbe.tar.gz Chatting-ddc94dc9388086657b889d8fd43a82bcadd82bbe.tar.bz2 Chatting-ddc94dc9388086657b889d8fd43a82bcadd82bbe.zip |
fix chat copy being in the wrong position
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt')
-rw-r--r-- | src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt index f72967f..5cbbc2d 100644 --- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt +++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt @@ -1,7 +1,6 @@ package cc.woverflow.chatting.chat import cc.woverflow.chatting.Chatting -import cc.woverflow.chatting.utils.ListenableArrayList import com.google.gson.JsonObject import com.google.gson.JsonParser import java.io.File @@ -12,11 +11,16 @@ object ChatShortcuts { private var initialized = false - val shortcuts = ListenableArrayList<Pair<String, String>>({ - it.sortWith(comparator) - }) - private val comparator = Comparator<Pair<String, String>> { o1, o2 -> - return@Comparator o2.first.length.compareTo(o1.first.length) + val shortcuts = object : ArrayList<Pair<String, String>>() { + private val comparator = Comparator<Pair<String, String>> { o1, o2 -> + return@Comparator o2.first.length.compareTo(o1.first.length) + } + + override fun add(element: Pair<String, String>): Boolean { + val value = super.add(element) + sortWith(comparator) + return value + } } |