Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore non-keyboard animations (#300)
## 📜 Description Check that current animation is a keyboard one. If not, then do not send any events to JS. ## 💡 Motivation and Context Since we add generic `WindowInsetsAnimationCompat.Callback` -> its callbacks (`onStart`/`onProgress`/`onEnd`) can be called even when keyboard is not performing an animation. Thus it's important to filter out which events are keyboard-related and which one are not. Initially I copied an example from [Google samples](https://github.com/android/platform-samples/tree/main/samples/user-interface/window-insets), but their example code didn't have these checks. I assume it's because they had only one screen and it wasn't possible to run other insets animation. However in [Android documentation](https://developer.android.com/develop/ui/views/layout/sw-keyboard#synchronize-animation) in code sample they added a check to filter out non-keyboard animations. So taking all the information from above I decided to add these checks and add early return statements to react only on keyboard animation events. The similar approach was added in next projects: - [Telegram](https://github.com/DrKLO/Telegram/blob/33a48d8945654afdb99df778647251cc2fca4bcc/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AdjustPanLayoutHelper.java#L411-L423) - [Signal](https://github.com/signalapp/Signal-Android/blob/10a363248ea7bba0cacac3385bee5cc2fff280cd/app/src/main/java/org/thoughtcrime/securesms/components/InsetAwareConstraintLayout.kt#L244-L247) ## 📢 Changelog ### Android - added `WindowInsetsAnimationCompat` extension (new `isKeyboardAnimation` field); - return from `onStart`/`onProgress`/`onEnd` callbacks if provided animation is not keyboard animation. ## 🤔 How Has This Been Tested? Tested on: - e2e ## 📸 Screenshots (if appropriate): No visual difference 🤷♂️ ## 📝 Checklist - [x] CI successfully passed
- Loading branch information