From 770905d2c96728bfb78f959be14ec4c211e71b8e Mon Sep 17 00:00:00 2001 From: shitlime Date: Tue, 16 Jan 2024 14:21:35 +0800 Subject: [PATCH] fix: liquid keyboard `TABs` Fix #1176 causing TABs to be unable to switch to other tabs. --- .../osfans/trime/ime/symbol/LiquidKeyboard.kt | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt b/app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt index bcdaab0a21..9a0f5eae82 100644 --- a/app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt +++ b/app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt @@ -152,27 +152,6 @@ class LiquidKeyboard(private val context: Context) : ClipboardHelper.OnClipboard return@setListener } } - - val tag = TabManager.get().getTabSwitchTabTag(position) - val truePosition = TabManager.get().getTabSwitchPosition(position) - if (tag != null) { - Timber.v( - "TABS click: " + - "position = $position, truePosition = $truePosition, tag.text = ${tag.text}", - ) - if (tag.type === SymbolKeyboardType.NO_KEY) { - when (tag.command) { - KeyCommandType.EXIT -> service.selectLiquidKeyboard(-1) - KeyCommandType.DEL_LEFT, KeyCommandType.DEL_RIGHT, KeyCommandType.REDO, KeyCommandType.UNDO -> {} - else -> {} - } - } else if (TabManager.get().isAfterTabSwitch(truePosition)) { - // tab的位置在“更多”的右侧,不滚动tab,焦点仍然在”更多“上 - select(truePosition) - } else { - service.selectLiquidKeyboard(truePosition) - } - } } } @@ -338,6 +317,27 @@ class LiquidKeyboard(private val context: Context) : ClipboardHelper.OnClipboard if (tabTag.type === SymbolKeyboardType.SYMBOL) { service.inputSymbol(bean.text) return@setListener + } else if (tabTag.type === SymbolKeyboardType.TABS) { + val tag = TabManager.get().getTabSwitchTabTag(position) + val truePosition = TabManager.get().getTabSwitchPosition(position) + if (tag != null) { + Timber.v( + "TABS click: " + "position = $position, truePosition = $truePosition, tag.text = ${tag.text}", + ) + if (tag.type === SymbolKeyboardType.NO_KEY) { + when (tag.command) { + KeyCommandType.EXIT -> service.selectLiquidKeyboard(-1) + KeyCommandType.DEL_LEFT, KeyCommandType.DEL_RIGHT, KeyCommandType.REDO, KeyCommandType.UNDO -> {} + else -> {} + } + } else if (TabManager.get().isAfterTabSwitch(truePosition)) { + // tab的位置在“更多”的右侧,不滚动tab,焦点仍然在”更多“上 + select(truePosition) + } else { + service.selectLiquidKeyboard(truePosition) + } + } + return@setListener } } service.currentInputConnection?.commitText(data[position].text, 1)