Keyboard plugin - replace setWindowInsetsAnimationCallback with setOnApplyWindowInsetsListener #2398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed an issue with the Keyboard plugin inaccurately resizing the view when the number row is enabled in my Gboard. The Keyboard plugin doesn't resize the view properly in this case. The reason is that the number row is added after the keyboard opening lifecycle is finished. Since the Keyboard plugin listens to
setWindowInsetsAnimationCallback
events (onStart and onEnd) to update the view height, it misses this last inset change after the keyboard opening animation is complete.I propose replacing the current listener with
setOnApplyWindowInsetsListener
, which listens to all inset changes, enabling the plugin to properly adjust the view height whenever the keyboard height changes.Device: Pixel 9 Pro running API level 36
Dependencies:
Gboard number row option: Settings -> System -> Keyboard -> On-screen keyboard -> Gboard -> Preferences -> Number row
Capacitor configs: