Skip to content

Commit

Permalink
fix: missing selection event on input switching
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jan 3, 2025
1 parent e98b142 commit e662c75
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@ class KeyboardControllerSelectionWatcher(
val end = editText.selectionEnd
val editTextHeight = editText.height

val view = editText
val layout = view.layout

if (layout === null) {
return true
}

if (lastSelectionStart != start || lastSelectionEnd != end || lastEditTextHeight != editTextHeight) {
lastSelectionStart = start
lastSelectionEnd = end
lastEditTextHeight = editTextHeight

val view = editText
val layout = view.layout

if (layout === null) {
return true
}

val cursorPositionStartX: Float
val cursorPositionStartY: Float
val cursorPositionEndX: Float
Expand Down Expand Up @@ -226,9 +226,6 @@ class KeyboardControllerSelectionWatcher(

fun setup() {
editText.viewTreeObserver.addOnPreDrawListener(preDrawListener)

// trigger initial event (on input switching)
preDrawListener.onPreDraw()
}

fun destroy() {
Expand Down

0 comments on commit e662c75

Please sign in to comment.