Improvements for All Apps on different display sizes
Bug: 262912817
Test: DeviceProfileAlternativeDisplaysDumpTest
Change-Id: I50e980183b4d5c1a46cca8f1c867b866b9eae4b5
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9f9c6f9..4dd3acc 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -401,6 +401,7 @@
allAppsBorderSpacePx = new Point(
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics),
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics));
+ setupAllAppsStyle(context);
workspacePageIndicatorHeight = res.getDimensionPixelSize(
R.dimen.workspace_page_indicator_height);
@@ -805,9 +806,6 @@
int cellLayoutHorizontalPadding =
(cellLayoutPaddingPx.left + cellLayoutPaddingPx.right) / 2;
if (isTablet) {
- allAppsLeftRightPadding =
- res.getDimensionPixelSize(R.dimen.all_apps_bottom_sheet_horizontal_padding);
-
int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns)
+ (allAppsBorderSpacePx.x * (numShownAllAppsColumns - 1))
+ allAppsLeftRightPadding * 2;
@@ -818,6 +816,20 @@
}
}
+ private void setupAllAppsStyle(Context context) {
+ TypedArray allAppsStyle;
+ if (inv.allAppsStyle != INVALID_RESOURCE_HANDLE) {
+ allAppsStyle = context.obtainStyledAttributes(inv.allAppsStyle,
+ R.styleable.AllAppsStyle);
+ } else {
+ allAppsStyle = context.obtainStyledAttributes(R.style.AllAppsStyleDefault,
+ R.styleable.AllAppsStyle);
+ }
+ allAppsLeftRightPadding = allAppsStyle.getDimensionPixelSize(
+ R.styleable.AllAppsStyle_horizontalPadding, 0);
+ allAppsStyle.recycle();
+ }
+
/**
* Returns the amount of extra (or unused) vertical space.
*/
@@ -1792,7 +1804,7 @@
* Set the viewScaleProvider for the builder
*
* @param viewScaleProvider The viewScaleProvider to be set for the
- * DeviceProfile
+ * DeviceProfile
* @return This builder
*/
@NonNull