diff options
author | Jon Miranda <jonmiranda@google.com> | 2017-06-20 10:58:36 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2017-06-23 11:47:48 -0700 |
commit | b28c4fcf351dc9f44f69253b227880758f6b460c (patch) | |
tree | 1a75f63300be881006ab64d5d39ef0b815826d85 /src/com/android/launcher3 | |
parent | a9d721df781bf4d195eb52bba1f9a3193f7eaad4 (diff) | |
download | android_packages_apps_Trebuchet-b28c4fcf351dc9f44f69253b227880758f6b460c.tar.gz android_packages_apps_Trebuchet-b28c4fcf351dc9f44f69253b227880758f6b460c.tar.bz2 android_packages_apps_Trebuchet-b28c4fcf351dc9f44f69253b227880758f6b460c.zip |
Landscape grid changes for Workspace/All Apps.
This is the just first CL to get eyes on the changes.
Next CL will update the All Apps to be full width.
Bug: 37015359
Change-Id: I2d7ec6851fdc13b8fa654e7e2be3152330243ccc
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/BaseContainerView.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 129 | ||||
-rw-r--r-- | src/com/android/launcher3/IconCache.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/InvariantDeviceProfile.java | 21 | ||||
-rw-r--r-- | src/com/android/launcher3/ShortcutAndWidgetContainer.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/WidgetPreviewLoader.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsGridAdapter.java | 9 |
8 files changed, 109 insertions, 82 deletions
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java index ac7cbafea..c55a5860e 100644 --- a/src/com/android/launcher3/BaseContainerView.java +++ b/src/com/android/launcher3/BaseContainerView.java @@ -113,20 +113,18 @@ public abstract class BaseContainerView extends FrameLayout * Calculate the background padding as it can change due to insets/content padding change. */ private void updatePaddings() { - Context context = getContext(); - int paddingLeft; - int paddingRight; - int paddingTop; - int paddingBottom; - - DeviceProfile grid = Launcher.getLauncher(context).getDeviceProfile(); + DeviceProfile grid = Launcher.getLauncher(getContext()).getDeviceProfile(); int[] padding = grid.getContainerPadding(); - paddingLeft = padding[0] + grid.edgeMarginPx; - paddingRight = padding[1] + grid.edgeMarginPx; + + int paddingLeft = padding[0]; + int paddingRight = padding[1]; + int paddingTop = 0; + int paddingBottom = 0; + if (!grid.isVerticalBarLayout()) { + paddingLeft += grid.edgeMarginPx; + paddingRight += grid.edgeMarginPx; paddingTop = paddingBottom = grid.edgeMarginPx; - } else { - paddingTop = paddingBottom = 0; } updateBackground(paddingLeft, paddingTop, paddingRight, paddingBottom); } diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index d07e3303d..d99a30ae7 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -154,7 +154,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { @ContainerType private final int mContainerType; - private final float mChildScale; + private final float mChildScale = 1f; public static final int MODE_SHOW_REORDER_HINT = 0; public static final int MODE_DRAG_OVER = 1; @@ -218,8 +218,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mFolderLeaveBehind.delegateCellX = -1; mFolderLeaveBehind.delegateCellY = -1; - mChildScale = mContainerType == HOTSEAT ? grid.inv.hotseatScale : 1f; - setAlwaysDrawnWithCacheEnabled(false); final Resources res = getResources(); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 0a346a6ea..dcfb268d1 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -19,6 +19,7 @@ package com.android.launcher3; import android.appwidget.AppWidgetHostView; import android.content.ComponentName; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Point; import android.graphics.PointF; @@ -32,7 +33,6 @@ import android.widget.FrameLayout; import com.android.launcher3.CellLayout.ContainerType; import com.android.launcher3.badge.BadgeRenderer; -import com.android.launcher3.config.FeatureFlags; import java.util.ArrayList; @@ -80,9 +80,8 @@ public class DeviceProfile { public final int workspaceSpringLoadedBottomSpace; // Page indicator - private final int pageIndicatorHeightPx; - private final int pageIndicatorLandGutterLeftNavBarPx; - private final int pageIndicatorLandGutterRightNavBarPx; + private final int pageIndicatorSizePx; + private final int pageIndicatorLandGutterPx; private final int pageIndicatorLandWorkspaceOffsetPx; // Workspace icons @@ -93,7 +92,7 @@ public class DeviceProfile { public int cellWidthPx; public int cellHeightPx; - public int cellPaddingXPx; + public int workspaceCellPaddingXPx; // Folder public int folderBackgroundOffset; @@ -110,15 +109,17 @@ public class DeviceProfile { public int folderChildDrawablePaddingPx; // Hotseat - public int hotseatCellWidthPx; public int hotseatCellHeightPx; - public int hotseatIconSizePx; public int hotseatBarHeightPx; public int hotseatBarTopPaddingPx; + public int hotseatBarLeftNavBarRightPaddingPx; + public int hotseatBarRightNavBarRightPaddingPx; public int hotseatBarBottomPaddingPx; - public int hotseatLandGutterPx; + public int hotseatLandLeftNavBarGutterPx; + public int hotseatLandRightNavBarGutterPx; // All apps + public int allAppsCellHeightPx; public int allAppsNumCols; public int allAppsNumPredictiveCols; public int allAppsButtonVisualSize; @@ -160,19 +161,22 @@ public class DeviceProfile { transposeLayoutWithOrientation = res.getBoolean(R.bool.hotseat_transpose_layout_with_orientation); + context = getContext(context, isVerticalBarLayout() + ? Configuration.ORIENTATION_LANDSCAPE + : Configuration.ORIENTATION_PORTRAIT); + res = context.getResources(); + + ComponentName cn = new ComponentName(context.getPackageName(), this.getClass().getName()); defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null); edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); desiredWorkspaceLeftRightMarginPx = edgeMarginPx; - pageIndicatorHeightPx = - res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height); - pageIndicatorLandGutterLeftNavBarPx = res.getDimensionPixelSize( - R.dimen.dynamic_grid_page_indicator_gutter_width_left_nav_bar); + pageIndicatorSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_size); + pageIndicatorLandGutterPx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_page_indicator_gutter_width); pageIndicatorLandWorkspaceOffsetPx = res.getDimensionPixelSize(R.dimen.all_apps_caret_workspace_offset); - pageIndicatorLandGutterRightNavBarPx = res.getDimensionPixelSize( - R.dimen.dynamic_grid_page_indicator_gutter_width_right_nav_bar); defaultPageSpacingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing); topWorkspacePadding = @@ -182,8 +186,7 @@ public class DeviceProfile { overviewModeMaxIconZoneHeightPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_max_icon_zone_height); overviewModeBarItemWidthPx = - (int) (res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_item_width) - * (isLandscape ? 1.5f : 1f)); + res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_item_width); overviewModeBarSpacerWidthPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_bar_spacer_width); overviewModeIconZoneRatio = @@ -194,15 +197,25 @@ public class DeviceProfile { workspaceSpringLoadedBottomSpace = res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space); - cellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x); + workspaceCellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x); hotseatBarTopPaddingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding); hotseatBarBottomPaddingPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); - hotseatBarHeightPx = hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx + - res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height); - hotseatLandGutterPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_land_gutter_width); + hotseatBarLeftNavBarRightPaddingPx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_hotseat_land_left_nav_bar_right_padding); + hotseatBarRightNavBarRightPaddingPx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_hotseat_land_right_nav_bar_right_padding); + hotseatBarHeightPx = isVerticalBarLayout() + ? res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height) + : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height) + + hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx; + + hotseatLandLeftNavBarGutterPx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_hotseat_land_left_nav_bar_gutter_width); + hotseatLandRightNavBarGutterPx = res.getDimensionPixelSize( + R.dimen.dynamic_grid_hotseat_land_right_nav_bar_gutter_width); // Determine sizes. widthPx = width; @@ -263,7 +276,7 @@ public class DeviceProfile { private void computeAllAppsButtonSize(Context context) { Resources res = context.getResources(); float padding = res.getInteger(R.integer.config_allAppsButtonPaddingPercent) / 100f; - allAppsButtonVisualSize = (int) (hotseatIconSizePx * (1 - padding)) - context.getResources() + allAppsButtonVisualSize = (int) (iconSizePx * (1 - padding)) - context.getResources() .getDimensionPixelSize(R.dimen.all_apps_button_scale_down); } @@ -281,25 +294,33 @@ public class DeviceProfile { } private void updateIconSize(float scale, Resources res, DisplayMetrics dm) { - iconSizePx = (int) (Utilities.pxFromDp(inv.iconSize, dm) * scale); + float invIconSizePx = isVerticalBarLayout() ? inv.landscapeIconSize : inv.iconSize; + iconSizePx = (int) (Utilities.pxFromDp(invIconSizePx, dm) * scale); iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale); iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale); - hotseatIconSizePx = (int) (Utilities.pxFromDp(inv.hotseatIconSize, dm) * scale); + + // All apps + allAppsIconTextSizePx = iconTextSizePx; allAppsIconSizePx = iconSizePx; allAppsIconDrawablePaddingPx = iconDrawablePaddingPx; - allAppsIconTextSizePx = iconTextSizePx; + allAppsCellHeightPx = getCellSize().y; + + if (isVerticalBarLayout()) { + // Always hide the Workspace text with vertical bar layout. + iconTextSizePx = 0; + allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx); + } cellWidthPx = iconSizePx + iconDrawablePaddingPx; cellHeightPx = iconSizePx + iconDrawablePaddingPx + Utilities.calculateTextHeight(iconTextSizePx); // Hotseat - hotseatCellWidthPx = cellWidthPx; hotseatCellHeightPx = iconSizePx + iconDrawablePaddingPx; if (!isVerticalBarLayout()) { int expectedWorkspaceHeight = availableHeightPx - hotseatBarHeightPx - - pageIndicatorHeightPx - topWorkspacePadding; + - pageIndicatorSizePx - topWorkspacePadding; float minRequiredHeight = dropTargetBarSizePx + workspaceSpringLoadedBottomSpace; workspaceSpringLoadShrinkFactor = Math.min( res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f, @@ -403,22 +424,25 @@ public class DeviceProfile { /** * Returns the workspace padding in the specified orientation. - * Note that it assumes that while in verticalBarLayout, the nav bar is on the right, as such - * this value is not reliable. - * Use {@link #getTotalWorkspacePadding()} instead. */ public Rect getWorkspacePadding(Rect recycle) { Rect padding = recycle == null ? new Rect() : recycle; if (isVerticalBarLayout()) { if (mInsets.left > 0) { - padding.set(mInsets.left + pageIndicatorLandGutterLeftNavBarPx, 0, - hotseatBarHeightPx + hotseatLandGutterPx - mInsets.left, 2 * edgeMarginPx); + padding.set(mInsets.left + pageIndicatorLandGutterPx, + 0, + hotseatBarHeightPx + hotseatLandLeftNavBarGutterPx + + hotseatBarLeftNavBarRightPaddingPx - mInsets.left, + edgeMarginPx); } else { - padding.set(pageIndicatorLandGutterRightNavBarPx, 0, - hotseatBarHeightPx + hotseatLandGutterPx, 2 * edgeMarginPx); + padding.set(pageIndicatorLandGutterPx, + 0, + hotseatBarHeightPx + hotseatLandRightNavBarGutterPx + + hotseatBarRightNavBarRightPaddingPx, + edgeMarginPx); } } else { - int paddingBottom = hotseatBarHeightPx + pageIndicatorHeightPx; + int paddingBottom = hotseatBarHeightPx + pageIndicatorSizePx; if (isTablet) { // Pad the left and right of the workspace to ensure consistent spacing // between all icons @@ -460,7 +484,7 @@ public class DeviceProfile { return new Rect(mInsets.left, mInsets.top + dropTargetBarSizePx + edgeMarginPx, mInsets.left + availableWidthPx, - mInsets.top + availableHeightPx - hotseatBarHeightPx - pageIndicatorHeightPx - + mInsets.top + availableHeightPx - hotseatBarHeightPx - pageIndicatorSizePx - edgeMarginPx); } } @@ -550,7 +574,12 @@ public class DeviceProfile { lp.gravity = Gravity.RIGHT; lp.width = hotseatBarHeightPx + mInsets.left + mInsets.right; lp.height = LayoutParams.MATCH_PARENT; - hotseat.getLayout().setPadding(mInsets.left, mInsets.top, mInsets.right, + + int paddingRight = mInsets.left > 0 + ? hotseatBarLeftNavBarRightPaddingPx + : hotseatBarRightNavBarRightPaddingPx; + + hotseat.getLayout().setPadding(mInsets.left, mInsets.top, mInsets.right + paddingRight, workspacePadding.bottom); } else if (isTablet) { // Pad the hotseat with the workspace padding calculated above @@ -578,17 +607,15 @@ public class DeviceProfile { lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams(); if (isVerticalBarLayout()) { if (mInsets.left > 0) { - lp.leftMargin = mInsets.left + pageIndicatorLandGutterLeftNavBarPx - - lp.width - pageIndicatorLandWorkspaceOffsetPx; - } else if (mInsets.right > 0) { - lp.leftMargin = pageIndicatorLandGutterRightNavBarPx - lp.width - - pageIndicatorLandWorkspaceOffsetPx; + lp.leftMargin = mInsets.left; + } else { + lp.leftMargin = pageIndicatorLandWorkspaceOffsetPx; } lp.bottomMargin = workspacePadding.bottom; } else { // Put the page indicators above the hotseat lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; - lp.height = pageIndicatorHeightPx; + lp.height = pageIndicatorSizePx; lp.bottomMargin = hotseatBarHeightPx + mInsets.bottom; } pageIndicator.setLayoutParams(lp); @@ -607,6 +634,12 @@ public class DeviceProfile { overviewMode.setLayoutParams(lp); } + // Layout the AllAppsRecyclerView + View view = launcher.findViewById(R.id.apps_list_view); + int paddingLeftRight = hasVerticalBarLayout ? 0 : edgeMarginPx; + view.setPadding(paddingLeftRight, view.getPaddingTop(), paddingLeftRight, + view.getPaddingBottom()); + if (notifyListeners) { for (int i = mListeners.size() - 1; i >= 0; i--) { mListeners.get(i).onLauncherLayoutChanged(); @@ -650,9 +683,8 @@ public class DeviceProfile { } // In landscape, we match the width of the workspace - int padding = (pageIndicatorLandGutterRightNavBarPx + - hotseatBarHeightPx + hotseatLandGutterPx + mInsets.left) / 2; - return new int[]{ padding, padding }; + Rect padding = getWorkspacePadding(null); + return new int[] { padding.left - mInsets.left, padding.right + mInsets.left}; } public boolean shouldIgnoreLongPressToOverview(float touchX) { @@ -661,4 +693,11 @@ public class DeviceProfile { boolean touchedRhsEdge = mInsets.right == 0 && touchX > (widthPx - edgeMarginPx); return !inMultiWindowMode && (touchedLhsEdge || touchedRhsEdge); } + + private static Context getContext(Context c, int orientation) { + Configuration context = new Configuration(c.getResources().getConfiguration()); + context.orientation = orientation; + return c.createConfigurationContext(context); + + } } diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index ec30de834..383e6efd0 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -753,7 +753,7 @@ public class IconCache { } private static final class IconDB extends SQLiteCacheHelper { - private final static int DB_VERSION = 15; + private final static int DB_VERSION = 16; private final static int RELEASE_VERSION = DB_VERSION + (FeatureFlags.LAUNCHER3_DISABLE_ICON_NORMALIZATION ? 0 : 1); diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index d22461535..d7bebd1b1 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -76,6 +76,7 @@ public class InvariantDeviceProfile { public int numFolderRows; public int numFolderColumns; public float iconSize; + public float landscapeIconSize; public int iconBitmapSize; public int fillResIconDpi; public float iconTextSize; @@ -84,8 +85,6 @@ public class InvariantDeviceProfile { * Number of icons inside the hotseat area. */ public int numHotseatIcons; - float hotseatIconSize; - public float hotseatScale; int defaultLayoutId; public DeviceProfile landscapeProfile; @@ -99,12 +98,12 @@ public class InvariantDeviceProfile { public InvariantDeviceProfile(InvariantDeviceProfile p) { this(p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns, p.numFolderRows, p.numFolderColumns, p.minAllAppsPredictionColumns, - p.iconSize, p.iconTextSize, p.numHotseatIcons, p.hotseatIconSize, + p.iconSize, p.landscapeIconSize, p.iconTextSize, p.numHotseatIcons, p.defaultLayoutId); } InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc, - float is, float its, int hs, float his, int dlId) { + float is, float lis, float its, int hs, int dlId) { name = n; minWidthDps = w; minHeightDps = h; @@ -114,12 +113,10 @@ public class InvariantDeviceProfile { numFolderColumns = fc; minAllAppsPredictionColumns = maapc; iconSize = is; + landscapeIconSize = lis; iconTextSize = its; numHotseatIcons = hs; - hotseatIconSize = his; defaultLayoutId = dlId; - - hotseatScale = hotseatIconSize / iconSize; } @TargetApi(23) @@ -152,17 +149,15 @@ public class InvariantDeviceProfile { minAllAppsPredictionColumns = closestProfile.minAllAppsPredictionColumns; iconSize = interpolatedDeviceProfileOut.iconSize; + landscapeIconSize = interpolatedDeviceProfileOut.landscapeIconSize; iconBitmapSize = Utilities.pxFromDp(iconSize, dm); iconTextSize = interpolatedDeviceProfileOut.iconTextSize; - hotseatIconSize = interpolatedDeviceProfileOut.hotseatIconSize; fillResIconDpi = getLauncherIconDensity(iconBitmapSize); // If the partner customization apk contains any grid overrides, apply them // Supported overrides: numRows, numColumns, iconSize applyPartnerDeviceProfileOverrides(context, dm); - hotseatScale = hotseatIconSize / iconSize; - Point realSize = new Point(); display.getRealSize(realSize); // The real size never changes. smallSide and largeSide will remain the @@ -210,9 +205,9 @@ public class InvariantDeviceProfile { a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns), a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns), iconSize, + a.getFloat(R.styleable.InvariantDeviceProfile_landscapeIconSize, iconSize), a.getFloat(R.styleable.InvariantDeviceProfile_iconTextSize, 0), a.getInt(R.styleable.InvariantDeviceProfile_numHotseatIcons, numColumns), - a.getFloat(R.styleable.InvariantDeviceProfile_hotseatIconSize, iconSize), a.getResourceId(R.styleable.InvariantDeviceProfile_defaultLayoutId, 0))); a.recycle(); } @@ -304,14 +299,14 @@ public class InvariantDeviceProfile { private void add(InvariantDeviceProfile p) { iconSize += p.iconSize; + landscapeIconSize += p.landscapeIconSize; iconTextSize += p.iconTextSize; - hotseatIconSize += p.hotseatIconSize; } private InvariantDeviceProfile multiply(float w) { iconSize *= w; + landscapeIconSize *= w; iconTextSize *= w; - hotseatIconSize *= w; return this; } diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java index 3a3e13d22..fd708c0fd 100644 --- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java +++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java @@ -120,7 +120,9 @@ public class ShortcutAndWidgetContainer extends ViewGroup { // Center the icon/folder int cHeight = getCellContentHeight(); int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f)); - int cellPaddingX = profile.cellPaddingXPx; + int cellPaddingX = mContainerType == CellLayout.WORKSPACE + ? profile.workspaceCellPaddingXPx + : (int) (profile.edgeMarginPx / 2f); child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0); } } else { diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java index 7d6d184f4..ad1be7e90 100644 --- a/src/com/android/launcher3/WidgetPreviewLoader.java +++ b/src/com/android/launcher3/WidgetPreviewLoader.java @@ -111,7 +111,7 @@ public class WidgetPreviewLoader { * sizes (landscape vs portrait). */ private static class CacheDb extends SQLiteCacheHelper { - private static final int DB_VERSION = 7; + private static final int DB_VERSION = 8; private static final String TABLE_NAME = "shortcut_and_widget_previews"; private static final String COLUMN_COMPONENT = "componentName"; diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 9c7372f2c..d6514a83f 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -18,7 +18,6 @@ package com.android.launcher3.allapps; import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.graphics.Point; import android.support.animation.DynamicAnimation; import android.support.animation.SpringAnimation; import android.support.v4.view.accessibility.AccessibilityEventCompat; @@ -298,8 +297,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. icon.setLongPressTimeout(ViewConfiguration.getLongPressTimeout()); icon.setOnFocusChangeListener(mIconFocusListener); - // Ensure the all apps icon height matches the workspace icons - icon.getLayoutParams().height = getCellSize().y; + // Ensure the all apps icon height matches the workspace icons in portrait mode. + icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx; return new ViewHolder(icon); case VIEW_TYPE_DISCOVERY_ITEM: AppDiscoveryItemView appDiscoveryItemView = (AppDiscoveryItemView) mLayoutInflater @@ -336,10 +335,6 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. } } - private Point getCellSize() { - return mLauncher.getDeviceProfile().getCellSize(); - } - @Override public void onBindViewHolder(ViewHolder holder, int position) { switch (holder.getItemViewType()) { |