Skip to content

Commit

Permalink
refactor: remove redundant parameters to show composition window
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Apr 13, 2024
1 parent c436a2d commit bd56ee3
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
commitTextByChar(checkNotNull(ShortcutUtils.pasteFromClipboard(this)).toString())
}

private fun showCompositionView(isCandidate: Boolean) {
if (Rime.compositionText.isEmpty() && isCandidate) {
mCompositionPopupWindow!!.hideCompositionView()
private fun showCompositionView() {
if (Rime.compositionText.isEmpty()) {
mCompositionPopupWindow?.hideCompositionView()
return
}
mCompositionPopupWindow?.updateCompositionView()
Expand Down Expand Up @@ -375,8 +375,8 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
}

override fun onUpdateCursorAnchorInfo(cursorAnchorInfo: CursorAnchorInfo) {
mCompositionPopupWindow!!.updateCursorAnchorInfo(cursorAnchorInfo)
showCompositionView(true)
mCompositionPopupWindow?.updateCursorAnchorInfo(cursorAnchorInfo)
showCompositionView()
}

override fun onUpdateSelection(
Expand Down Expand Up @@ -1102,7 +1102,7 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
mCandidate!!.setText(startNum)
// if isCursorUpdated, showCompositionView will be called in onUpdateCursorAnchorInfo
// otherwise we need to call it here
if (!mCompositionPopupWindow!!.isCursorUpdated) showCompositionView(true)
if (!mCompositionPopupWindow!!.isCursorUpdated) showCompositionView()
} else {
mCandidate!!.setText(0)
}
Expand Down

0 comments on commit bd56ee3

Please sign in to comment.