Skip to content

Commit b2dcf30

Browse files
shitlimeWhiredPlanck
authored andcommitted
fix: liquid keyboard TABs
Fix #1176 causing TABs to be unable to switch to other tabs.
1 parent 30f7513 commit b2dcf30

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,27 +152,6 @@ class LiquidKeyboard(private val context: Context) : ClipboardHelper.OnClipboard
152152
return@setListener
153153
}
154154
}
155-
156-
val tag = TabManager.get().getTabSwitchTabTag(position)
157-
val truePosition = TabManager.get().getTabSwitchPosition(position)
158-
if (tag != null) {
159-
Timber.v(
160-
"TABS click: " +
161-
"position = $position, truePosition = $truePosition, tag.text = ${tag.text}",
162-
)
163-
if (tag.type === SymbolKeyboardType.NO_KEY) {
164-
when (tag.command) {
165-
KeyCommandType.EXIT -> service.selectLiquidKeyboard(-1)
166-
KeyCommandType.DEL_LEFT, KeyCommandType.DEL_RIGHT, KeyCommandType.REDO, KeyCommandType.UNDO -> {}
167-
else -> {}
168-
}
169-
} else if (TabManager.get().isAfterTabSwitch(truePosition)) {
170-
// tab的位置在“更多”的右侧,不滚动tab,焦点仍然在”更多“上
171-
select(truePosition)
172-
} else {
173-
service.selectLiquidKeyboard(truePosition)
174-
}
175-
}
176155
}
177156
}
178157

@@ -338,6 +317,27 @@ class LiquidKeyboard(private val context: Context) : ClipboardHelper.OnClipboard
338317
if (tabTag.type === SymbolKeyboardType.SYMBOL) {
339318
service.inputSymbol(bean.text)
340319
return@setListener
320+
} else if (tabTag.type === SymbolKeyboardType.TABS) {
321+
val tag = TabManager.get().getTabSwitchTabTag(position)
322+
val truePosition = TabManager.get().getTabSwitchPosition(position)
323+
if (tag != null) {
324+
Timber.v(
325+
"TABS click: " + "position = $position, truePosition = $truePosition, tag.text = ${tag.text}",
326+
)
327+
if (tag.type === SymbolKeyboardType.NO_KEY) {
328+
when (tag.command) {
329+
KeyCommandType.EXIT -> service.selectLiquidKeyboard(-1)
330+
KeyCommandType.DEL_LEFT, KeyCommandType.DEL_RIGHT, KeyCommandType.REDO, KeyCommandType.UNDO -> {}
331+
else -> {}
332+
}
333+
} else if (TabManager.get().isAfterTabSwitch(truePosition)) {
334+
// tab的位置在“更多”的右侧,不滚动tab,焦点仍然在”更多“上
335+
select(truePosition)
336+
} else {
337+
service.selectLiquidKeyboard(truePosition)
338+
}
339+
}
340+
return@setListener
341341
}
342342
}
343343
service.currentInputConnection?.commitText(data[position].text, 1)

0 commit comments

Comments
 (0)