Skip to content

Commit

Permalink
Do not track previous state when switching to cursor for keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenMcGirr committed Mar 7, 2024
1 parent 83f4ccc commit cdccda7
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ object KeyboardInfo {
var isKeyboardVisible = false
var keyboardHeight = 0

// Track scan receiver state to go back to when keyboard is hidden
private var previousScanReceiverState = ScanReceiver.state

fun updateKeyboardState(windows: List<AccessibilityWindowInfo>) {
val keyboardWindow = windows.firstOrNull { window ->
window.type == AccessibilityWindowInfo.TYPE_INPUT_METHOD
Expand All @@ -23,16 +20,10 @@ object KeyboardInfo {
keyboardHeight = rect.height()

// Go to cursor as keyboard keys don't report AccessibilityNodeInfo
previousScanReceiverState = ScanReceiver.state
ScanReceiver.state = ScanReceiver.ReceiverState.CURSOR
} else {
isKeyboardVisible = false
keyboardHeight = 0

// Go back to previous state if not in menu state
if (ScanReceiver.state != ScanReceiver.ReceiverState.MENU) {
ScanReceiver.state = previousScanReceiverState
}
}
Log.d("KeyboardInfo", "isKeyboardVisible: $isKeyboardVisible window count: ${windows.size}")
}
Expand Down

0 comments on commit cdccda7

Please sign in to comment.