From a833af316b96b5078a838a2928d35f436de24f46 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Wed, 2 Aug 2023 16:30:27 -0400 Subject: [PATCH] Adjust the hotseat when the bubble bar becomes visible When the bubble bar becomes visible the space between icons in the hotseat is now adjusted. This change only does it when the QSB is above the icons, but this will be changed in the future to be based on the amount of space between the hotseat and the edge of the screen. When the hotseat is adjusted, the new width is smaller by the size of 2 icons. The icons are then translated to be evenly spaced within the boundaries of the new width. Since the adjustment is only applied when the QSB is above the icons, it is resized accordingly to the new width. All visual updates currently snap to the new position, but will be animated in a follow up. Demo: https://recall.googleplex.com/projects/3391fc5c-599d-4827-b6f8-d2deb160aa99/sessions/fad1a5c5-e9cf-4586-92e4-1e92df3b002e Bug: 280494203 Test: Manual (on tangor) - Set device to landscape - Make the bubble bar visible by adding a bubble - Rotate to portrait mode - Observe that the hotseat is adjusted - Rotate to landscape - Observe that the hotseat adjustment is removed - Rotate back to portrait - Observe that the hotseat is adjusted again - Dismiss the bubble to hide he bubble bar - Observe the hotseat adjustment is removed Change-Id: I5b02a60b6cb301ffa2507a6d825c748a782cca18 --- quickstep/res/values/dimens.xml | 1 + .../taskbar/LauncherTaskbarUIController.java | 24 +++++ .../taskbar/TaskbarActivityContext.java | 5 + .../taskbar/TaskbarUIController.java | 4 +- .../taskbar/TaskbarViewController.java | 25 ++++- .../taskbar/bubbles/BubbleBarController.java | 6 +- .../bubbles/BubbleBarViewController.java | 3 +- .../uioverrides/QuickstepLauncher.java | 11 ++- res/values/dimens.xml | 3 + src/com/android/launcher3/DeviceProfile.java | 33 ++++++- src/com/android/launcher3/Hotseat.java | 94 +++++++++++++++++++ src/com/android/launcher3/Launcher.java | 1 + .../launcher3/ShortcutAndWidgetContainer.java | 25 +++++ .../util/MultiTranslateDelegate.java | 3 + .../launcher3/views/ActivityContext.java | 10 ++ 15 files changed, 239 insertions(+), 9 deletions(-) diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index f32f204bd1..ae3407ef4f 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -368,6 +368,7 @@ @dimen/taskbar_stashed_handle_height 8dp 1dp + 90dp 50dp 24dp diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 4e834ec3ef..e6dfe0f4a9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -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(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 3a1ed0b260..7da8f9e30d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -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); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index 6fad655687..139e8f0c98 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -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) {} } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 3d22e7895f..54840f129d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -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 - + (hotseatCellSize + borderSpacing) * positionInHotseat - + hotseatCellSize / 2f; + 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 diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 90f474862e..bd11efd499 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -190,8 +190,10 @@ public class BubbleBarController extends IBubblesListener.Stub { mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController; bubbleControllers.runAfterInit(() -> { - mBubbleBarViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED); - mBubbleStashedHandleViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED); + mBubbleBarViewController.setHiddenForBubbles( + !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); + mBubbleStashedHandleViewController.setHiddenForBubbles( + !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse( key -> setSelectedBubble(mBubbles.get(key))); }); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 5c607c988a..065dd58f16 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -75,7 +75,7 @@ public class BubbleBarViewController { // Whether the bar is hidden for a sysui state. private boolean mHiddenForSysui; // Whether the bar is hidden because there are no bubbles. - private boolean mHiddenForNoBubbles; + private boolean mHiddenForNoBubbles = true; private boolean mShouldShowEducation; public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) { @@ -212,6 +212,7 @@ public class BubbleBarViewController { if (mHiddenForNoBubbles != hidden) { mHiddenForNoBubbles = hidden; updateVisibilityForStateChange(); + mActivity.bubbleBarVisibilityChanged(!hidden); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b50ab9716c..00c74614e8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -133,7 +133,6 @@ import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchControlle import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController; import com.android.launcher3.util.ActivityOptionsWrapper; -import com.android.launcher3.util.BackPressHandler; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.IntSet; @@ -1272,6 +1271,16 @@ public class QuickstepLauncher extends Launcher { return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); } + @Override + public boolean isBubbleBarEnabled() { + return (mTaskbarUIController != null && mTaskbarUIController.isBubbleBarEnabled()); + } + + @Override + public boolean hasBubbles() { + return (mTaskbarUIController != null && mTaskbarUIController.hasBubbles()); + } + private static final class LauncherTaskViewController extends TaskViewTouchController { diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 1079e0000d..c6fce285af 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -385,6 +385,9 @@ 0dp 0dp + + 0dp + 16dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index baa170bfa1..91243177f2 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -220,6 +220,9 @@ public class DeviceProfile { private final int mMinHotseatQsbWidthPx; private final int mMaxHotseatIconSpacePx; public final int inlineNavButtonsEndSpacingPx; + // Space required for the bubble bar between the hotseat and the edge of the screen. If there's + // not enough space, the hotseat will adjust itself for the bubble bar. + private final int mBubbleBarSpaceThresholdPx; // Bottom sheets public int bottomSheetTopPadding; @@ -574,6 +577,9 @@ public class DeviceProfile { hotseatBarEndOffset = 0; } + mBubbleBarSpaceThresholdPx = + res.getDimensionPixelSize(R.dimen.bubblebar_hotseat_adjustment_threshold); + // Needs to be calculated after hotseatBarSizePx is correct, // for the available height to be correct if (mIsResponsiveGrid) { @@ -1562,6 +1568,32 @@ public class DeviceProfile { paddings.bottom -= insets.bottom; } + + /** + * Returns the new border space that should be used between hotseat icons after adjusting it to + * the bubble bar. + * + *

If there's no adjustment needed, this method returns {@code 0}. + */ + public float getHotseatAdjustedBorderSpaceForBubbleBar(Context context) { + // only need to adjust when QSB is on top of the hotseat. + if (isQsbInline) { + return 0; + } + + // no need to adjust if there's enough space for the bubble bar to the right of the hotseat. + if (getHotseatLayoutPadding(context).right > mBubbleBarSpaceThresholdPx) { + return 0; + } + + // The adjustment is shrinking the hotseat's width by 1 icon on either side. + int iconsWidth = + iconSizePx * numShownHotseatIcons + hotseatBorderSpace * (numShownHotseatIcons - 1); + int newWidth = iconsWidth - 2 * iconSizePx; + // Evenly space the icons within the boundaries of the new width. + return (float) (newWidth - iconSizePx * numShownHotseatIcons) / (numShownHotseatIcons - 1); + } + /** * Returns the padding for hotseat view */ @@ -2169,5 +2201,4 @@ public class DeviceProfile { mIsGestureMode, mViewScaleProvider, mOverrideProvider); } } - } diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 03afba11c1..3b12b86bf7 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -16,6 +16,12 @@ package com.android.launcher3; +import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; +import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_BUBBLE_ADJUSTMENT_ANIM; + +import android.animation.AnimatorSet; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; @@ -27,6 +33,10 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.widget.FrameLayout; +import com.android.launcher3.util.HorizontalInsettableView; +import com.android.launcher3.util.MultiTranslateDelegate; +import com.android.launcher3.views.ActivityContext; + /** * View class that represents the bottom row of the home screen. */ @@ -34,6 +44,7 @@ public class Hotseat extends CellLayout implements Insettable { // Ratio of empty space, qsb should take up to appear visually centered. public static final float QSB_CENTER_FACTOR = .325f; + private static final int BUBBLE_BAR_ADJUSTMENT_ANIMATION_DURATION_MS = 250; @ViewDebug.ExportedProperty(category = "launcher") private boolean mHasVerticalHotseat; @@ -72,9 +83,36 @@ public class Hotseat extends CellLayout implements Insettable { } public void resetLayout(boolean hasVerticalHotseat) { + ActivityContext activityContext = ActivityContext.lookupContext(getContext()); + boolean bubbleBarEnabled = activityContext.isBubbleBarEnabled(); + boolean hasBubbles = activityContext.hasBubbles(); removeAllViewsInLayout(); mHasVerticalHotseat = hasVerticalHotseat; DeviceProfile dp = mActivity.getDeviceProfile(); + + if (bubbleBarEnabled) { + float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); + if (hasBubbles && Float.compare(adjustedBorderSpace, 0f) != 0) { + getShortcutsAndWidgets().setTranslationProvider(child -> { + int index = getShortcutsAndWidgets().indexOfChild(child); + float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; + return dp.iconSizePx + index * borderSpaceDelta; + }); + if (mQsb instanceof HorizontalInsettableView) { + HorizontalInsettableView insettableQsb = (HorizontalInsettableView) mQsb; + final float insetFraction = (float) dp.iconSizePx / dp.hotseatQsbWidth; + // post this to the looper so that QSB has a chance to redraw itself, e.g. + // after device rotation + mQsb.post(() -> insettableQsb.setHorizontalInsets(insetFraction)); + } + } else { + getShortcutsAndWidgets().setTranslationProvider(null); + if (mQsb instanceof HorizontalInsettableView) { + ((HorizontalInsettableView) mQsb).setHorizontalInsets(0); + } + } + } + resetCellSize(dp); if (hasVerticalHotseat) { setGridSize(1, dp.numShownHotseatIcons); @@ -83,6 +121,62 @@ public class Hotseat extends CellLayout implements Insettable { } } + /** + * Adjust the hotseat icons for the bubble bar. + * + *

When the bubble bar becomes visible, if needed, this method animates the hotseat icons + * to reduce the spacing between them and make room for the bubble bar. The QSB width is + * animated as well to align with the hotseat icons. + * + *

When the bubble bar goes away, any adjustments that were previously made are reversed. + */ + public void adjustForBubbleBar(boolean isBubbleBarVisible) { + DeviceProfile dp = mActivity.getDeviceProfile(); + float adjustedBorderSpace = dp.getHotseatAdjustedBorderSpaceForBubbleBar(getContext()); + if (Float.compare(adjustedBorderSpace, 0f) == 0) { + return; + } + + ShortcutAndWidgetContainer icons = getShortcutsAndWidgets(); + AnimatorSet animatorSet = new AnimatorSet(); + float borderSpaceDelta = adjustedBorderSpace - dp.hotseatBorderSpace; + + // update the translation provider for future layout passes of hotseat icons. + if (isBubbleBarVisible) { + icons.setTranslationProvider(child -> { + int index = icons.indexOfChild(child); + return dp.iconSizePx + index * borderSpaceDelta; + }); + } else { + icons.setTranslationProvider(null); + } + + for (int i = 0; i < icons.getChildCount(); i++) { + View child = icons.getChildAt(i); + float tx = isBubbleBarVisible ? dp.iconSizePx + i * borderSpaceDelta : 0; + if (child instanceof Reorderable) { + MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate(); + animatorSet.play( + mtd.getTranslationX(INDEX_BUBBLE_ADJUSTMENT_ANIM).animateToValue(tx)); + } else { + animatorSet.play(ObjectAnimator.ofFloat(child, VIEW_TRANSLATE_X, tx)); + } + } + if (mQsb instanceof HorizontalInsettableView) { + HorizontalInsettableView horizontalInsettableQsb = (HorizontalInsettableView) mQsb; + ValueAnimator qsbAnimator = ValueAnimator.ofFloat(0f, 1f); + qsbAnimator.addUpdateListener(animation -> { + float fraction = qsbAnimator.getAnimatedFraction(); + float insetFraction = isBubbleBarVisible + ? (float) dp.iconSizePx * fraction / dp.hotseatQsbWidth + : (float) dp.iconSizePx * (1 - fraction) / dp.hotseatQsbWidth; + horizontalInsettableQsb.setHorizontalInsets(insetFraction); + }); + animatorSet.play(qsbAnimator); + } + animatorSet.setDuration(BUBBLE_BAR_ADJUSTMENT_ANIMATION_DURATION_MS).start(); + } + @Override public void setInsets(Rect insets) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1fef2f80a0..b8e7737798 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2325,6 +2325,7 @@ public class Launcher extends StatefulActivity *

* Implementation of the method from LauncherModel.Callbacks. */ + @Override public void startBinding() { TraceHelper.INSTANCE.beginSection("startBinding"); // Floating panels (except the full widget sheet) are associated with individual icons. If diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index 5e7f21bcd0..b22b690260 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -21,6 +21,7 @@ import static android.view.MotionEvent.ACTION_DOWN; import static com.android.launcher3.CellLayout.FOLDER; import static com.android.launcher3.CellLayout.HOTSEAT; import static com.android.launcher3.CellLayout.WORKSPACE; +import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_BUBBLE_ADJUSTMENT_ANIM; import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_WIDGET_CENTERING; import android.app.WallpaperManager; @@ -33,6 +34,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.Nullable; + import com.android.launcher3.CellLayout.ContainerType; import com.android.launcher3.celllayout.CellLayoutLayoutParams; import com.android.launcher3.folder.FolderIcon; @@ -62,6 +65,9 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon. private final ActivityContext mActivity; private boolean mInvertIfRtl = false; + @Nullable + private TranslationProvider mTranslationProvider = null; + public ShortcutAndWidgetContainer(Context context, @ContainerType int containerType) { super(context); mActivity = ActivityContext.lookupContext(context); @@ -229,6 +235,16 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon. childLeft, childTop, childLeft + lp.width, childTop + lp.height); } child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height); + if (mTranslationProvider != null) { + final float tx = mTranslationProvider.getTranslationX(child); + if (child instanceof Reorderable) { + ((Reorderable) child).getTranslateDelegate() + .getTranslationX(INDEX_BUBBLE_ADJUSTMENT_ANIM) + .setValue(tx); + } else { + child.setTranslationX(tx); + } + } if (lp.dropped) { lp.dropped = false; @@ -298,4 +314,13 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon. cl.clearFolderLeaveBehind(); } } + + void setTranslationProvider(@Nullable TranslationProvider provider) { + mTranslationProvider = provider; + } + + /** Provides translation values to apply when laying out child views. */ + interface TranslationProvider { + float getTranslationX(View child); + } } diff --git a/src/com/android/launcher3/util/MultiTranslateDelegate.java b/src/com/android/launcher3/util/MultiTranslateDelegate.java index 1cb7a453af..0e32ba7bfc 100644 --- a/src/com/android/launcher3/util/MultiTranslateDelegate.java +++ b/src/com/android/launcher3/util/MultiTranslateDelegate.java @@ -40,6 +40,9 @@ public class MultiTranslateDelegate { // Specific for widgets public static final int INDEX_WIDGET_CENTERING = 3; + // Specific for hotseat items when adjusting for bubbles + public static final int INDEX_BUBBLE_ADJUSTMENT_ANIM = 3; + public static final int COUNT = 5; private final MultiPropertyFactory mTranslationX; diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java index 84ea87118c..7b82195914 100644 --- a/src/com/android/launcher3/views/ActivityContext.java +++ b/src/com/android/launcher3/views/ActivityContext.java @@ -442,6 +442,16 @@ public interface ActivityContext { return CellPosMapper.DEFAULT; } + /** Whether bubbles are enabled. */ + default boolean isBubbleBarEnabled() { + return false; + } + + /** Whether the bubble bar has bubbles. */ + default boolean hasBubbles() { + return false; + } + /** * Returns the ActivityContext associated with the given Context, or throws an exception if * the Context is not associated with any ActivityContext.