Taskbar layout update
> Calculating the hotseat padding statically
> Animating taskbar views individually when animating to home
instead of a layout animation
> Moving all navbar buttons to a separate layout/controller and independent
of Launcher
> Fixing RTL layout for taskbar and nav bar
Bug: 187353581
Test: Manual
Change-Id: If21696f38beee328f553e467394776a8e8ed4c3e
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index ff380ce..b3ae15e 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -49,8 +49,6 @@
private final View mQsb;
private final int mQsbHeight;
- private final int mTaskbarViewHeight;
-
public Hotseat(Context context) {
this(context, null);
}
@@ -63,10 +61,9 @@
super(context, attrs, defStyle);
mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
- mQsbHeight = mQsb.getLayoutParams().height;
addView(mQsb);
- mTaskbarViewHeight = context.getResources().getDimensionPixelSize(R.dimen.taskbar_size);
+ mQsbHeight = getResources().getDimensionPixelSize(R.dimen.qsb_widget_height);
}
/**
@@ -114,18 +111,13 @@
lp.gravity = Gravity.BOTTOM;
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
lp.height = (grid.isTaskbarPresent
- ? grid.workspacePadding.bottom
+ ? grid.workspacePadding.bottom
: grid.hotseatBarSizePx)
+ (grid.isTaskbarPresent ? grid.taskbarSize : insets.bottom);
}
- if (!grid.isTaskbarPresent) {
- // When taskbar is present, we set the padding separately to ensure a seamless visual
- // handoff between taskbar and hotseat during drag and drop.
- Rect padding = grid.getHotseatLayoutPadding();
- setPadding(padding.left, padding.top, padding.right, padding.bottom);
- }
-
+ Rect padding = grid.getHotseatLayoutPadding(getContext());
+ setPadding(padding.left, padding.top, padding.right, padding.bottom);
setLayoutParams(lp);
InsettableFrameLayout.dispatchInsets(this, insets);
}
@@ -193,31 +185,12 @@
int left = (r - l - qsbWidth) / 2;
int right = left + qsbWidth;
- int bottom = b - t - getQsbOffsetY();
+ int bottom = b - t - mActivity.getDeviceProfile().getQsbOffsetY();
int top = bottom - mQsbHeight;
mQsb.layout(left, top, right, bottom);
}
/**
- * Returns the number of pixels the QSB is translated from the bottom of the screen.
- */
- private int getQsbOffsetY() {
- DeviceProfile dp = mActivity.getDeviceProfile();
- int freeSpace = dp.isTaskbarPresent
- ? dp.workspacePadding.bottom
- : dp.hotseatBarSizePx - dp.hotseatCellHeightPx - mQsbHeight;
- return (int) (freeSpace * QSB_CENTER_FACTOR)
- + (dp.isTaskbarPresent ? dp.taskbarSize : dp.getInsets().bottom);
- }
-
- /**
- * Returns the number of pixels the taskbar is translated from the bottom of the screen.
- */
- public int getTaskbarOffsetY() {
- return (getQsbOffsetY() - mTaskbarViewHeight) / 2;
- }
-
- /**
* Sets the alpha value of just our ShortcutAndWidgetContainer.
*/
public void setIconsAlpha(float alpha) {