Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11d2834d authored by Evan Severson's avatar Evan Severson
Browse files

Update remote floating toolbar content rect on layout change

Animation end is not the correct singal and may be dispatched before the
size and location are set.

Test: Turn off animations then manual.
      LoginActivityTest#testAutofillManuallyOneDataset
Bug: 408556479
Bug: 363318732
Flag: android.permission.flags.system_selection_toolbar_enabled
Change-Id: I98d63bda9df346b0e42c427a5f36baa3d5f3d516
parent 465c4874
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -217,13 +217,14 @@ final class RemoteSelectionToolbar {
        mOpenOverflowAnimation.setAnimationListener(mOverflowAnimationListener);
        mCloseOverflowAnimation = new AnimationSet(true);
        mCloseOverflowAnimation.setAnimationListener(mOverflowAnimationListener);
        mShowAnimation = createEnterAnimation(mContentContainer,
                new AnimatorListenerAdapter() {
        mContentContainer.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
                    public void onAnimationEnd(Animator animation) {
            public void onLayoutChange(View v, int left, int top, int right, int bottom,
                    int oldLeft, int oldTop, int oldRight, int oldBottom) {
                updateFloatingToolbarRootContentRect();
            }
        });
        mShowAnimation = createEnterAnimation(mContentContainer);
        mDismissAnimation = createExitAnimation(
                mContentContainer,
                150,  // startDelay
@@ -1334,11 +1335,10 @@ final class RemoteSelectionToolbar {
     *
     * @param view  The view to animate
     */
    private static AnimatorSet createEnterAnimation(View view, Animator.AnimatorListener listener) {
    private static AnimatorSet createEnterAnimation(View view) {
        AnimatorSet animation = new AnimatorSet();
        animation.playTogether(
                ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(150));
        animation.addListener(listener);
        return animation;
    }