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

Commit 7fedde35 authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge changes I93c2232d,I00daff83 into udc-qpr-dev

* changes:
  Align the bubble bar with the taskbar in overview and app
  Update the bubble bar offset on Home
parents cdb56ea2 d76a9d92
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@
        android:layout_height="@dimen/bubblebar_size"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/transient_taskbar_bottom_margin"
        android:layout_marginBottom="@dimen/transient_taskbar_bottom_margin"
        android:paddingEnd="@dimen/taskbar_icon_spacing"
        android:paddingStart="@dimen/taskbar_icon_spacing"
        android:visibility="gone"
+4 −2
Original line number Diff line number Diff line
@@ -123,9 +123,11 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas

        val taskbarTouchableHeight = controllers.taskbarStashController.touchableHeight
        val bubblesTouchableHeight =
            if (controllers.bubbleControllers.isPresent)
            if (controllers.bubbleControllers.isPresent) {
                controllers.bubbleControllers.get().bubbleStashController.touchableHeight
            else 0
            } else {
                0
            }
        val touchableHeight = Math.max(taskbarTouchableHeight, bubblesTouchableHeight)

        if (
+8 −2
Original line number Diff line number Diff line
@@ -72,7 +72,11 @@ public class BubbleBarView extends FrameLayout {

    private final BubbleBarBackground mBubbleBarBackground;

    // The current bounds of all the bubble bar.
    /**
     * The current bounds of all the bubble bar. Note that these bounds may not account for
     * translation. The bounds should be retrieved using {@link #getBubbleBarBounds()} which
     * updates the bounds and accounts for translation.
     */
    private final Rect mBubbleBarBounds = new Rect();
    // The amount the bubbles overlap when they are stacked in the bubble bar
    private final float mIconOverlapAmount;
@@ -186,9 +190,11 @@ public class BubbleBarView extends FrameLayout {
    }

    /**
     * Returns the bounds of the bubble bar.
     * Updates the bounds with translation that may have been applied and returns the result.
     */
    public Rect getBubbleBarBounds() {
        mBubbleBarBounds.top = getTop() + (int) getTranslationY();
        mBubbleBarBounds.bottom = getBottom() + (int) getTranslationY();
        return mBubbleBarBounds;
    }

+34 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.launcher3.taskbar.bubbles;

import static java.lang.Math.abs;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -125,6 +127,16 @@ public class BubbleStashController {
            mBubblesShowingOnHome = onHome;
            if (mBubblesShowingOnHome) {
                showBubbleBar(/* expanded= */ false);
                // When transitioning from app to home the stash animator may already have been
                // created, so we need to animate the bubble bar here to align with hotseat.
                if (!mIsStashed) {
                    mIconTranslationYForStash.animateToValue(getBubbleBarTranslationYForHotseat())
                            .start();
                }
                // If the bubble bar is already unstashed, the taskbar touchable region won't be
                // updated correctly, so force an update here.
                mControllers.runAfterInit(() ->
                        mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged());
            } else if (!mBarViewController.isExpanded()) {
                stashBubbleBar();
            }
@@ -143,6 +155,11 @@ public class BubbleStashController {
            mBubblesShowingOnOverview = onOverview;
            if (!mBubblesShowingOnOverview && !mBarViewController.isExpanded()) {
                stashBubbleBar();
            } else {
                // When transitioning to overview the stash animator may already have been
                // created, so we need to animate the bubble bar here to align with taskbar.
                mIconTranslationYForStash.animateToValue(getBubbleBarTranslationYForTaskbar())
                        .start();
            }
        }
    }
@@ -234,8 +251,11 @@ public class BubbleStashController {
            secondHalfDurationScale = 0.75f;

            // If we're on home, adjust the translation so the bubble bar aligns with hotseat.
            final float hotseatTransY = mActivity.getDeviceProfile().getTaskbarOffsetY();
            final float translationY = mBubblesShowingOnHome ? hotseatTransY : 0;
            // Otherwise we're either showing in an app or in overview. In either case adjust it so
            // the bubble bar aligns with the taskbar.
            final float translationY = mBubblesShowingOnHome ? getBubbleBarTranslationYForHotseat()
                    : getBubbleBarTranslationYForTaskbar();

            fullLengthAnimatorSet.playTogether(
                    mIconScaleForStash.animateToValue(1),
                    mIconTranslationYForStash.animateToValue(translationY));
@@ -265,6 +285,7 @@ public class BubbleStashController {
                    if (isStashed) {
                        mBarViewController.setExpanded(false);
                    }
                    mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
                });
            }
        });
@@ -277,4 +298,15 @@ public class BubbleStashController {
            mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
        });
    }

    private float getBubbleBarTranslationYForTaskbar() {
        return -mActivity.getDeviceProfile().taskbarBottomMargin;
    }

    private float getBubbleBarTranslationYForHotseat() {
        final float hotseatBottomSpace = mActivity.getDeviceProfile().hotseatBarBottomSpacePx;
        final float hotseatCellHeight = mActivity.getDeviceProfile().hotseatCellHeightPx;
        return -hotseatBottomSpace - hotseatCellHeight + mUnstashedHeight - abs(
                hotseatCellHeight - mUnstashedHeight) / 2;
    }
}