This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
IME Animation clean up extraneous window inset call #21213
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8af6f33
Clean up extraneous window inset call
GaryQian d7dcfe5
Expose animating
GaryQian a7c58a8
tests
GaryQian 108ed96
Formatting
GaryQian f3328e8
Remove extra unused method
GaryQian ee9331c
More comments
GaryQian b7390ea
More comments
GaryQian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -669,6 +669,8 @@ public void ime_windowInsetsSync() { | |
| WindowInsets.Builder builder = new WindowInsets.Builder(); | ||
| WindowInsets noneInsets = builder.build(); | ||
|
|
||
| // imeInsets0, 1, and 2 contain unique IME bottom insets, and are used | ||
| // to distinguish which insets were sent at each stage. | ||
| builder.setInsets(WindowInsets.Type.ime(), Insets.of(0, 0, 0, 100)); | ||
| builder.setInsets(WindowInsets.Type.navigationBars(), Insets.of(10, 10, 10, 40)); | ||
| WindowInsets imeInsets0 = builder.build(); | ||
|
|
@@ -677,6 +679,10 @@ public void ime_windowInsetsSync() { | |
| builder.setInsets(WindowInsets.Type.navigationBars(), Insets.of(10, 10, 10, 40)); | ||
| WindowInsets imeInsets1 = builder.build(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add some comments for what 0, 1, 2 are supposed to represent? Different stages of an animation? |
||
|
|
||
| builder.setInsets(WindowInsets.Type.ime(), Insets.of(0, 0, 0, 50)); | ||
| builder.setInsets(WindowInsets.Type.navigationBars(), Insets.of(10, 10, 10, 40)); | ||
| WindowInsets imeInsets2 = builder.build(); | ||
|
|
||
| builder.setInsets(WindowInsets.Type.ime(), Insets.of(0, 0, 0, 200)); | ||
| builder.setInsets(WindowInsets.Type.navigationBars(), Insets.of(10, 10, 10, 0)); | ||
| WindowInsets deferredInsets = builder.build(); | ||
|
|
@@ -696,6 +702,8 @@ public void ime_windowInsetsSync() { | |
| imeSyncCallback.onPrepare(animation); | ||
| imeSyncCallback.onApplyWindowInsets(testView, deferredInsets); | ||
| imeSyncCallback.onStart(animation, null); | ||
| // Only the final state call is saved, extra calls are passed on. | ||
| imeSyncCallback.onApplyWindowInsets(testView, imeInsets2); | ||
|
|
||
| verify(flutterRenderer).setViewportMetrics(viewportMetricsCaptor.capture()); | ||
| // No change, as deferredInset is stored to be passed in onEnd() | ||
|
|
@@ -723,7 +731,7 @@ public void ime_windowInsetsSync() { | |
| imeSyncCallback.onEnd(animation); | ||
|
|
||
| verify(flutterRenderer).setViewportMetrics(viewportMetricsCaptor.capture()); | ||
| // Values should be of deferredInsets | ||
| // Values should be of deferredInsets, not imeInsets2 | ||
| assertEquals(0, viewportMetricsCaptor.getValue().paddingBottom); | ||
| assertEquals(10, viewportMetricsCaptor.getValue().paddingTop); | ||
| assertEquals(200, viewportMetricsCaptor.getValue().viewInsetBottom); | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add code comments for what these 2 are for the next maintainer