Skip to content

Commit

Permalink
fix: liquid keyboard TABs
Browse files Browse the repository at this point in the history
Fix osfans#1176 causing TABs to be unable to switch to other tabs.
  • Loading branch information
shitlime committed Jan 16, 2024
1 parent 30f7513 commit 770905d
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 770905d

Please sign in to comment.