Shift transient taskbar to ensure 12dp distance with the bubble bar.
Shift the taskbar to fulfill the 12dp distance if the distance between the taskbar and the bubble bar is below this threshold. Fixes: 376929094 Test: TaskbarViewControllerTest Test: Manual. Test that the transient taskbar shifts properly. Increased the minimum distance to 120 dp and verified that the taskbar shifts correctly. Moved bubbles side to side, confirming the taskbar follows. The return-to-home-screen animation to the hotseat plays as expected from either side. Video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/bJZ8PclmltZu7IupvBFrLn Test: Manual. Test that the transient taskbar stashes properly. Increased the minimum distance to 120 dp and verified that the taskbar shifts correctly. Go to any application. Stash and un-stash the taskbar. Video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/hCGRhUgIqvcehOrTQ2Ulvj Test: Manual. Test that the transient taskbar pin/unpin properly. Increased the minimum distance to 120 dp and verified that the taskbar shifts correctly. Pin/unpin the taskbar. Video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/f3fy5JKVZAk4wLCpVra4DK Flag: com.android.wm.shell.enable_bubble_bar Change-Id: Id4bd713da93053f90d9c2be8503dc93531a03b29
This commit is contained in:
1 parent
3e419ebbf1
commit
226ed8143d
9 files changed
+193
-47
No files matched your search
@@ -122,7 +122,8 @@ public class BubbleBarViewController {
|
||||
private float mBubbleBarSwipeUpTranslationY;
|
||||
// Modified when bubble bar is springing back into the stash handle.
|
||||
private float mBubbleBarStashTranslationY;
|
||||
|
||||
// Minimum distance between the BubbleBar and the taskbar
|
||||
private final int mBubbleBarTaskbarMinDistance;
|
||||
// Whether the bar is hidden for a sysui state.
|
||||
private boolean mHiddenForSysui;
|
||||
// Whether the bar is hidden because there are no bubbles.
|
||||
@@ -150,10 +151,11 @@ public class BubbleBarViewController {
|
||||
mBubbleBarContainer = bubbleBarContainer;
|
||||
mSystemUiProxy = SystemUiProxy.INSTANCE.get(mActivity);
|
||||
mBubbleBarAlpha = new MultiValueAlpha(mBarView, 1 /* num alpha channels */);
|
||||
mIconSize = activity.getResources().getDimensionPixelSize(
|
||||
R.dimen.bubblebar_icon_size);
|
||||
mDragElevation = activity.getResources().getDimensionPixelSize(
|
||||
R.dimen.bubblebar_drag_elevation);
|
||||
Resources res = activity.getResources();
|
||||
mIconSize = res.getDimensionPixelSize(R.dimen.bubblebar_icon_size);
|
||||
mBubbleBarTaskbarMinDistance = res.getDimensionPixelSize(
|
||||
R.dimen.bubblebar_transient_taskbar_min_distance);
|
||||
mDragElevation = res.getDimensionPixelSize(R.dimen.bubblebar_drag_elevation);
|
||||
mTaskbarTranslationDelta = getBubbleBarTranslationDeltaForTaskbar(activity);
|
||||
}
|
||||
|
||||
@@ -657,6 +659,45 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation X of the transient taskbar according to the bubble bar location
|
||||
* regardless of the current taskbar mode.
|
||||
*/
|
||||
public int getTransientTaskbarTranslationXForBubbleBar(BubbleBarLocation location) {
|
||||
int taskbarShift = 0;
|
||||
if (!isBubbleBarVisible() || mTaskbarViewPropertiesProvider == null) return taskbarShift;
|
||||
Rect taskbarViewBounds = mTaskbarViewPropertiesProvider.getTaskbarViewBounds();
|
||||
if (taskbarViewBounds.isEmpty()) return taskbarShift;
|
||||
int actualDistance =
|
||||
getDistanceBetweenTransientTaskbarAndBubbleBar(location, taskbarViewBounds);
|
||||
if (actualDistance < mBubbleBarTaskbarMinDistance) {
|
||||
taskbarShift = mBubbleBarTaskbarMinDistance - actualDistance;
|
||||
if (!location.isOnLeft(mBarView.isLayoutRtl())) {
|
||||
taskbarShift = -taskbarShift;
|
||||
}
|
||||
}
|
||||
return taskbarShift;
|
||||
}
|
||||
|
||||
private int getDistanceBetweenTransientTaskbarAndBubbleBar(BubbleBarLocation location,
|
||||
Rect taskbarViewBounds) {
|
||||
Resources res = mActivity.getResources();
|
||||
DeviceProfile transientDp = mActivity.getTransientTaskbarDeviceProfile();
|
||||
int transientIconSize = getBubbleBarIconSizeFromDeviceProfile(res, transientDp);
|
||||
int transientPadding = getBubbleBarPaddingFromDeviceProfile(res, transientDp);
|
||||
int transientWidthWithMargin = (int) (mBarView.getCollapsedWidthForIconSizeAndPadding(
|
||||
transientIconSize, transientPadding) + mBarView.getHorizontalMargin());
|
||||
int distance;
|
||||
if (location.isOnLeft(mBarView.isLayoutRtl())) {
|
||||
distance = taskbarViewBounds.left - transientWidthWithMargin;
|
||||
} else {
|
||||
int displayWidth = res.getDisplayMetrics().widthPixels;
|
||||
int bubbleBarLeft = displayWidth - transientWidthWithMargin;
|
||||
distance = bubbleBarLeft - taskbarViewBounds.right;
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
//
|
||||
// Modifying view related properties.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user