summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Fufa <sfufa@google.com>2019-10-04 15:15:19 -0700
committerSamuel Fufa <sfufa@google.com>2019-10-04 15:15:58 -0700
commitf1424a3b38bdbd7fde540a1b54b54f279c24a4b7 (patch)
treef2c43843bb2506e4c348f9897c86dd5268aad148
parent055c22e8e658dcb87447a9c11ec492c2b8e922e5 (diff)
downloadpackages_apps_Trebuchet-f1424a3b38bdbd7fde540a1b54b54f279c24a4b7.tar.gz
packages_apps_Trebuchet-f1424a3b38bdbd7fde540a1b54b54f279c24a4b7.tar.bz2
packages_apps_Trebuchet-f1424a3b38bdbd7fde540a1b54b54f279c24a4b7.zip
Decouple grid size and widget preview size in WidgetsRecyclerView
Test: Manual Bug:142148773 Change-Id: I59aa29e95ddb7d6002a88cf853bae5fcf9811154
-rw-r--r--src/com/android/launcher3/DeviceProfile.java2
-rw-r--r--src/com/android/launcher3/WidgetPreviewLoader.java2
-rw-r--r--src/com/android/launcher3/widget/WidgetCell.java2
3 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c034d2de2..736142f19 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -111,6 +111,7 @@ public class DeviceProfile {
// All apps
public int allAppsCellHeightPx;
+ public int allAppsCellWidthPx;
public int allAppsIconSizePx;
public int allAppsIconDrawablePaddingPx;
public float allAppsIconTextSizePx;
@@ -349,6 +350,7 @@ public class DeviceProfile {
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
allAppsCellHeightPx = getCellSize().y;
}
+ allAppsCellWidthPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx;
if (isVerticalBarLayout()) {
// Always hide the Workspace text with vertical bar layout.
diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java
index 003bcc1ce..c6381b058 100644
--- a/src/com/android/launcher3/WidgetPreviewLoader.java
+++ b/src/com/android/launcher3/WidgetPreviewLoader.java
@@ -450,7 +450,7 @@ public class WidgetPreviewLoader {
private Bitmap generateShortcutPreview(BaseActivity launcher, ShortcutConfigActivityInfo info,
int maxWidth, int maxHeight, Bitmap preview) {
- int iconSize = launcher.getDeviceProfile().iconSizePx;
+ int iconSize = launcher.getDeviceProfile().allAppsIconSizePx;
int padding = launcher.getResources()
.getDimensionPixelSize(R.dimen.widget_preview_shortcut_padding);
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index dc4af8caf..412fb7ba6 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -103,7 +103,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private void setContainerWidth() {
DeviceProfile profile = mActivity.getDeviceProfile();
- mCellSize = (int) (profile.cellWidthPx * WIDTH_SCALE);
+ mCellSize = (int) (profile.allAppsCellWidthPx * WIDTH_SCALE);
mPresetPreviewSize = (int) (mCellSize * PREVIEW_SCALE);
}