Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

IME Animation clean up extraneous window inset call #21213

Merged
merged 7 commits into from
Sep 16, 2020

Conversation

GaryQian
Copy link
Contributor

@GaryQian GaryQian commented Sep 16, 2020

Description

Fixes bug part of flutter/flutter#65821

onStart is called too late, which resulted in one of the final IME position calls to slip through. This PR switches to the onPrepare instead and adds some additional safeguarding to prevent overwriting the saved inset. This is consistent with https://github.com/android/user-interface-samples/blob/master/WindowInsetsAnimation/app/src/main/java/com/google/android/samples/insetsanimation/RootViewDeferringInsetsCallback.kt which also uses onPrepare and is what this is roughly based on.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@GaryQian GaryQian requested a review from xster September 16, 2020 11:08
Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -199,7 +199,8 @@ public void sendAppPrivateCommand(String action, Bundle data) {

private View view;
private WindowInsets lastWindowInsets;
private boolean started = false;
private boolean animating = false;
Copy link
Member

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

@@ -212,34 +213,35 @@ public void sendAppPrivateCommand(String action, Bundle data) {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
this.view = view;
if (started) {
if (needsSave) {
// Store the view and insets for us in onEnd() below
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You described the what, but didn't describe the why (saving is needed) :)

@@ -677,6 +677,10 @@ public void ime_windowInsetsSync() {
builder.setInsets(WindowInsets.Type.navigationBars(), Insets.of(10, 10, 10, 40));
WindowInsets imeInsets1 = builder.build();
Copy link
Member

Choose a reason for hiding this comment

The 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?

@GaryQian GaryQian added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 16, 2020
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.
  • The status or check suite Linux Web Engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 16, 2020
@GaryQian
Copy link
Contributor Author

Landing, Linux Web Engine passes on rerun: https://ci.chromium.org/p/flutter/builders/try/Linux%20Web%20Engine/9773

@GaryQian GaryQian merged commit 933f811 into flutter:master Sep 16, 2020
@GaryQian GaryQian changed the title Clean up extraneous window inset call IME Animation clean up extraneous window inset call Sep 16, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 16, 2020
@pcsosinski
Copy link

removing cp label from PR in favor of the issue

christopherfujino added a commit that referenced this pull request Sep 24, 2020
* Update 1.22 engine to use Dart 2.10.0-110.5.beta
* Dark mode friendly iOS debugging message (#21277)
* Update FlutterViewController.mm (#21362)
* Tweaked the label here a little for style ("apps", not "application" -- plural and shorter); and "launching" rather than "re-launching"?
* Fix iOS platform view's mask view blocking touch events. (#21286)
* Disconnect the view's AndroidKeyProcessor when detaching from the engine (#21307)
* Remove extraneous window inset call on IME animation (#21213)
* Retain the WindowInsetsAnimation callback if code shrinking is enabled (#21330)

Co-authored-by: Jenn Magder <[email protected]>
Co-authored-by: Tim Sneath <[email protected]>
Co-authored-by: Chris Yang <[email protected]>
Co-authored-by: Jason Simmons <[email protected]>
Co-authored-by: Gary Qian <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants