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

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

Merge "Adjust the hotseat when the bubble bar becomes visible" into main

parents b19c1220 a833af31
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -368,6 +368,7 @@
    <dimen name="bubblebar_stashed_handle_height">@dimen/taskbar_stashed_handle_height</dimen>
    <dimen name="bubblebar_pointer_size">8dp</dimen>
    <dimen name="bubblebar_elevation">1dp</dimen>
    <dimen name="bubblebar_hotseat_adjustment_threshold">90dp</dimen>

    <dimen name="bubblebar_icon_size">50dp</dimen>
    <dimen name="bubblebar_badge_size">24dp</dimen>
+24 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.MultiPropertyFactory;
@@ -202,10 +203,18 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation);
    }

    @Override
    public void refreshResumedState() {
        onLauncherResumedOrPaused(mLauncher.hasBeenResumed());
    }

    @Override
    public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) {
        if (mLauncher.getHotseat() != null) {
            mLauncher.getHotseat().adjustForBubbleBar(isBubbleBarVisible);
        }
    }

    /**
     * Create Taskbar animation when going from an app to Launcher as part of recents transition.
     * @param toState If known, the state we will end up in when reaching Launcher.
@@ -327,6 +336,21 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        return mTaskbarInAppDisplayProgress.value > 0;
    }

    public boolean isBubbleBarEnabled() {
        return BubbleBarController.BUBBLE_BAR_ENABLED;
    }

    /** Whether the bubble bar has any bubbles. */
    public boolean hasBubbles() {
        if (mControllers == null) {
            return false;
        }
        if (mControllers.bubbleControllers.isEmpty()) {
            return false;
        }
        return mControllers.bubbleControllers.get().bubbleBarViewController.hasBubbles();
    }

    @Override
    public void onExpandPip() {
        super.onExpandPip();
+5 −0
Original line number Diff line number Diff line
@@ -302,6 +302,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mNavMode = DisplayController.getNavigationMode(this);
    }

    /** Called when the visibility of the bubble bar changed. */
    public void bubbleBarVisibilityChanged(boolean isVisible) {
        mControllers.uiController.adjustHotseatForBubbleBar(isVisible);
        mControllers.taskbarViewController.resetIconAlignmentController();
    }

    public void init(@NonNull TaskbarSharedState sharedState) {
        mImeDrawsImeNavBar = getBoolByName(IME_DRAWS_IME_NAV_BAR_RES_NAME, getResources(), false);
+3 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import com.android.quickstep.views.TaskView.TaskIdAttributeContainer;
import com.android.systemui.shared.recents.model.Task;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Stream;

@@ -336,4 +335,7 @@ public class TaskbarUIController {
                .stream()
                .map(mControllers.taskbarPopupController::createSplitShortcutFactory);
    }

    /** Adjusts the hotseat for the bubble bar. */
    public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) {}
}
+22 −3
Original line number Diff line number Diff line
@@ -448,6 +448,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        }
    }

    /** Resets the icon alignment controller so that it can be recreated again later. */
    void resetIconAlignmentController() {
        mIconAlignControllerLazy = null;
    }

    /**
     * Creates an animation for aligning the Taskbar icons with the provided Launcher device profile
     */
@@ -564,9 +569,18 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
                continue;
            }

            float hotseatIconCenter = hotseatPadding.left
            float hotseatAdjustedBorderSpace =
                    launcherDp.getHotseatAdjustedBorderSpaceForBubbleBar(child.getContext());
            float hotseatIconCenter;
            if (bubbleBarHasBubbles() && hotseatAdjustedBorderSpace != 0) {
                hotseatIconCenter = hotseatPadding.left + hotseatCellSize
                        + (hotseatCellSize + hotseatAdjustedBorderSpace) * positionInHotseat
                        + hotseatCellSize / 2f;
            } else {
                hotseatIconCenter = hotseatPadding.left
                        + (hotseatCellSize + borderSpacing) * positionInHotseat
                        + hotseatCellSize / 2f;
            }
            float childCenter = (child.getLeft() + child.getRight()) / 2f;
            float toX = hotseatIconCenter - childCenter;
            if (child instanceof Reorderable) {
@@ -588,6 +602,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        return controller;
    }

    private boolean bubbleBarHasBubbles() {
        return mControllers.bubbleControllers.isPresent()
                && mControllers.bubbleControllers.get().bubbleBarViewController.hasBubbles();
    }

    public void onRotationChanged(DeviceProfile deviceProfile) {
        if (!mControllers.uiController.isIconAlignedWithHotseat()) {
            // We only translate on rotation when icon is aligned with hotseat
Loading