Loading quickstep/src/com/android/quickstep/TaskIconCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -256,7 +256,7 @@ public class TaskIconCache implements DisplayInfoChangeListener { private BaseIconFactory getIconFactory() { if (mIconFactory == null) { mIconFactory = new BaseIconFactory(mContext, DisplayController.INSTANCE.get(mContext).getInfo().densityDpi, DisplayController.INSTANCE.get(mContext).getInfo().getDensityDpi(), mContext.getResources().getDimensionPixelSize(R.dimen.taskbar_icon_size)); } return mIconFactory; Loading res/values/attrs.xml +11 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,17 @@ defaults to 2 * numHotseatIcons --> <attr name="numExtendedHotseatIcons" format="integer" /> <!-- alignment of hotseat to the grid. Not applicable for 3 button mode when taskbar is enabled --> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpan" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanLandscape" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanTwoPanelLandscape" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanTwoPanelPortrait" format="integer" /> <attr name="dbFile" format="string" /> <attr name="defaultLayoutId" format="reference" /> <attr name="defaultSplitDisplayLayoutId" format="reference" /> Loading res/xml/device_profiles.xml +1 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ launcher:numFolderRows="3" launcher:numFolderColumns="3" launcher:numHotseatIcons="6" launcher:hotseatColumnSpanLandscape="4" launcher:numAllAppsColumns="6" launcher:isScalable="true" launcher:devicePaddingId="@xml/paddings_6x5" Loading src/com/android/launcher3/DeviceProfile.java +52 −20 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ public class DeviceProfile { public final int numShownHotseatIcons; public int hotseatCellHeightPx; private final int hotseatExtraVerticalSize; private final boolean areNavButtonsInline; // In portrait: size = height, in landscape: size = width public int hotseatBarSizePx; public int hotseatBarTopPaddingPx; Loading Loading @@ -358,7 +359,7 @@ public class DeviceProfile { // We shrink hotseat sizes regardless of orientation, if nav buttons are inline and QSB // might be inline in either orientations, to keep hotseat size consistent across rotation. boolean areNavButtonsInline = isTaskbarPresent && !isGestureMode; areNavButtonsInline = isTaskbarPresent && !isGestureMode; if (areNavButtonsInline && canQsbInline) { numShownHotseatIcons = inv.numShrunkenHotseatIcons; } else { Loading @@ -373,15 +374,14 @@ public class DeviceProfile { res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding); if (isQsbInline) { hotseatBarBottomPaddingPx = res.getDimensionPixelSize(R.dimen.inline_qsb_bottom_margin); qsbWidth = calculateQsbWidth(); } else { hotseatBarBottomPaddingPx = (isTallDevice ? res.getDimensionPixelSize( R.dimen.dynamic_grid_hotseat_bottom_tall_padding) : res.getDimensionPixelSize( R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding)) + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); qsbWidth = 0; } springLoadedHotseatBarTopMarginPx = res.getDimensionPixelSize( R.dimen.spring_loaded_hotseat_top_margin); hotseatBarSidePaddingEndPx = Loading @@ -390,9 +390,7 @@ public class DeviceProfile { hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0; hotseatExtraVerticalSize = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size); hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics); updateHotseatIconSize( pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics)); updateHotseatIconSize(pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics)); qsbBottomMarginOriginalPx = isScalableGrid ? res.getDimensionPixelSize(R.dimen.scalable_grid_qsb_bottom_margin) Loading Loading @@ -483,6 +481,10 @@ public class DeviceProfile { cellLayoutPadding); updateWorkspacePadding(); // Hotseat and QSB width depends on updated cellSize and workspace padding hotseatBorderSpace = calculateHotseatBorderSpace(); qsbWidth = calculateQsbWidth(); flingToDeleteThresholdVelocity = res.getDimensionPixelSize( R.dimen.drag_flingToDeleteMinVelocity); Loading @@ -493,14 +495,26 @@ public class DeviceProfile { new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE); } /** * QSB width is always calculated because when in 3 button nav the width doesn't follow the * width of the hotseat. */ private int calculateQsbWidth() { if (isQsbInline) { int columns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns; return cellWidthPx * columns + cellLayoutBorderSpacePx.x * (columns - 1) - (cellWidthPx - iconSizePx) // left and right cell space return getIconToIconWidthForColumns(columns) - iconSizePx * numShownHotseatIcons - hotseatBorderSpace * numShownHotseatIcons; } else { int columns = inv.hotseatColumnSpan[mTypeIndex]; return getIconToIconWidthForColumns(columns); } } private int getIconToIconWidthForColumns(int columns) { return columns * getCellSize().x + (columns - 1) * cellLayoutBorderSpacePx.x - (getCellSize().x - iconSizePx); // left and right cell space } private int getHorizontalMarginPx(InvariantDeviceProfile idp, Resources res) { Loading Loading @@ -741,13 +755,6 @@ public class DeviceProfile { // All apps updateAllAppsIconSize(scale, res); // Hotseat hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics, scale); if (isQsbInline) { qsbWidth = calculateQsbWidth(); } else { qsbWidth = 0; } updateHotseatIconSize(iconSizePx); // Folder icon Loading @@ -755,6 +762,23 @@ public class DeviceProfile { folderIconOffsetYPx = (iconSizePx - folderIconSizePx) / 2; } /** * Hotseat width spans a certain number of columns on scalable grids. * This method calculates the space between the icons to achieve that width. */ private int calculateHotseatBorderSpace() { if (!isScalableGrid) return 0; //TODO(http://b/228998082) remove this when 3 button spaces are fixed if (areNavButtonsInline) { return pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics); } else { int columns = inv.hotseatColumnSpan[mTypeIndex]; float hotseatWidthPx = getIconToIconWidthForColumns(columns); float hotseatIconsTotalPx = iconSizePx * numShownHotseatIcons; return (int) (hotseatWidthPx - hotseatIconsTotalPx) / (numShownHotseatIcons - 1); } } /** * Updates the iconSize for allApps* variants. Loading Loading @@ -1070,6 +1094,13 @@ public class DeviceProfile { mHotseatPadding.left -= diff; mHotseatPadding.right += diff; } } else if (isScalableGrid) { int sideSpacing = (availableWidthPx - qsbWidth) / 2; mHotseatPadding.set(sideSpacing, hotseatBarTopPaddingPx, sideSpacing, hotseatBarSizePx - hotseatCellHeightPx - hotseatBarTopPaddingPx + mInsets.bottom); } else { // We want the edges of the hotseat to line up with the edges of the workspace, but the // icons in the hotseat are a different size, and so don't line up perfectly. To account Loading Loading @@ -1306,6 +1337,7 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("allAppsLeftRightMargin", allAppsLeftRightMargin)); writer.println(prefix + pxToDpStr("hotseatBarSizePx", hotseatBarSizePx)); writer.println(prefix + "\tinv.hotseatColumnSpan: " + inv.hotseatColumnSpan[mTypeIndex]); writer.println(prefix + pxToDpStr("hotseatCellHeightPx", hotseatCellHeightPx)); writer.println(prefix + pxToDpStr("hotseatBarTopPaddingPx", hotseatBarTopPaddingPx)); writer.println(prefix + pxToDpStr("hotseatBarBottomPaddingPx", hotseatBarBottomPaddingPx)); Loading Loading @@ -1384,7 +1416,7 @@ public class DeviceProfile { private static Context getContext(Context c, Info info, int orientation, WindowBounds bounds) { Configuration config = new Configuration(c.getResources().getConfiguration()); config.orientation = orientation; config.densityDpi = info.densityDpi; config.densityDpi = info.getDensityDpi(); config.smallestScreenWidthDp = (int) info.smallestSizeDp(bounds); return c.createConfigurationContext(config); } Loading src/com/android/launcher3/Hotseat.java +2 −10 Original line number Diff line number Diff line Loading @@ -173,17 +173,9 @@ public class Hotseat extends CellLayout implements Insettable { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width; if (mActivity.getDeviceProfile().isQsbInline) { width = mActivity.getDeviceProfile().qsbWidth; } else { MarginLayoutParams qsbParams = (MarginLayoutParams) mQsb.getLayoutParams(); width = getShortcutsAndWidgets().getMeasuredWidth() - qsbParams.getMarginStart() - qsbParams.getMarginEnd(); } int qsbWidth = mActivity.getDeviceProfile().qsbWidth; mQsb.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), mQsb.measure(MeasureSpec.makeMeasureSpec(qsbWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mQsbHeight, MeasureSpec.EXACTLY)); } Loading Loading
quickstep/src/com/android/quickstep/TaskIconCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -256,7 +256,7 @@ public class TaskIconCache implements DisplayInfoChangeListener { private BaseIconFactory getIconFactory() { if (mIconFactory == null) { mIconFactory = new BaseIconFactory(mContext, DisplayController.INSTANCE.get(mContext).getInfo().densityDpi, DisplayController.INSTANCE.get(mContext).getInfo().getDensityDpi(), mContext.getResources().getDimensionPixelSize(R.dimen.taskbar_icon_size)); } return mIconFactory; Loading
res/values/attrs.xml +11 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,17 @@ defaults to 2 * numHotseatIcons --> <attr name="numExtendedHotseatIcons" format="integer" /> <!-- alignment of hotseat to the grid. Not applicable for 3 button mode when taskbar is enabled --> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpan" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanLandscape" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanTwoPanelLandscape" format="integer" /> <!-- defaults to numColumns, if not specified --> <attr name="hotseatColumnSpanTwoPanelPortrait" format="integer" /> <attr name="dbFile" format="string" /> <attr name="defaultLayoutId" format="reference" /> <attr name="defaultSplitDisplayLayoutId" format="reference" /> Loading
res/xml/device_profiles.xml +1 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ launcher:numFolderRows="3" launcher:numFolderColumns="3" launcher:numHotseatIcons="6" launcher:hotseatColumnSpanLandscape="4" launcher:numAllAppsColumns="6" launcher:isScalable="true" launcher:devicePaddingId="@xml/paddings_6x5" Loading
src/com/android/launcher3/DeviceProfile.java +52 −20 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ public class DeviceProfile { public final int numShownHotseatIcons; public int hotseatCellHeightPx; private final int hotseatExtraVerticalSize; private final boolean areNavButtonsInline; // In portrait: size = height, in landscape: size = width public int hotseatBarSizePx; public int hotseatBarTopPaddingPx; Loading Loading @@ -358,7 +359,7 @@ public class DeviceProfile { // We shrink hotseat sizes regardless of orientation, if nav buttons are inline and QSB // might be inline in either orientations, to keep hotseat size consistent across rotation. boolean areNavButtonsInline = isTaskbarPresent && !isGestureMode; areNavButtonsInline = isTaskbarPresent && !isGestureMode; if (areNavButtonsInline && canQsbInline) { numShownHotseatIcons = inv.numShrunkenHotseatIcons; } else { Loading @@ -373,15 +374,14 @@ public class DeviceProfile { res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding); if (isQsbInline) { hotseatBarBottomPaddingPx = res.getDimensionPixelSize(R.dimen.inline_qsb_bottom_margin); qsbWidth = calculateQsbWidth(); } else { hotseatBarBottomPaddingPx = (isTallDevice ? res.getDimensionPixelSize( R.dimen.dynamic_grid_hotseat_bottom_tall_padding) : res.getDimensionPixelSize( R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding)) + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding); qsbWidth = 0; } springLoadedHotseatBarTopMarginPx = res.getDimensionPixelSize( R.dimen.spring_loaded_hotseat_top_margin); hotseatBarSidePaddingEndPx = Loading @@ -390,9 +390,7 @@ public class DeviceProfile { hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0; hotseatExtraVerticalSize = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size); hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics); updateHotseatIconSize( pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics)); updateHotseatIconSize(pxFromDp(inv.iconSize[INDEX_DEFAULT], mMetrics)); qsbBottomMarginOriginalPx = isScalableGrid ? res.getDimensionPixelSize(R.dimen.scalable_grid_qsb_bottom_margin) Loading Loading @@ -483,6 +481,10 @@ public class DeviceProfile { cellLayoutPadding); updateWorkspacePadding(); // Hotseat and QSB width depends on updated cellSize and workspace padding hotseatBorderSpace = calculateHotseatBorderSpace(); qsbWidth = calculateQsbWidth(); flingToDeleteThresholdVelocity = res.getDimensionPixelSize( R.dimen.drag_flingToDeleteMinVelocity); Loading @@ -493,14 +495,26 @@ public class DeviceProfile { new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE); } /** * QSB width is always calculated because when in 3 button nav the width doesn't follow the * width of the hotseat. */ private int calculateQsbWidth() { if (isQsbInline) { int columns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns; return cellWidthPx * columns + cellLayoutBorderSpacePx.x * (columns - 1) - (cellWidthPx - iconSizePx) // left and right cell space return getIconToIconWidthForColumns(columns) - iconSizePx * numShownHotseatIcons - hotseatBorderSpace * numShownHotseatIcons; } else { int columns = inv.hotseatColumnSpan[mTypeIndex]; return getIconToIconWidthForColumns(columns); } } private int getIconToIconWidthForColumns(int columns) { return columns * getCellSize().x + (columns - 1) * cellLayoutBorderSpacePx.x - (getCellSize().x - iconSizePx); // left and right cell space } private int getHorizontalMarginPx(InvariantDeviceProfile idp, Resources res) { Loading Loading @@ -741,13 +755,6 @@ public class DeviceProfile { // All apps updateAllAppsIconSize(scale, res); // Hotseat hotseatBorderSpace = pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics, scale); if (isQsbInline) { qsbWidth = calculateQsbWidth(); } else { qsbWidth = 0; } updateHotseatIconSize(iconSizePx); // Folder icon Loading @@ -755,6 +762,23 @@ public class DeviceProfile { folderIconOffsetYPx = (iconSizePx - folderIconSizePx) / 2; } /** * Hotseat width spans a certain number of columns on scalable grids. * This method calculates the space between the icons to achieve that width. */ private int calculateHotseatBorderSpace() { if (!isScalableGrid) return 0; //TODO(http://b/228998082) remove this when 3 button spaces are fixed if (areNavButtonsInline) { return pxFromDp(inv.hotseatBorderSpaces[mTypeIndex], mMetrics); } else { int columns = inv.hotseatColumnSpan[mTypeIndex]; float hotseatWidthPx = getIconToIconWidthForColumns(columns); float hotseatIconsTotalPx = iconSizePx * numShownHotseatIcons; return (int) (hotseatWidthPx - hotseatIconsTotalPx) / (numShownHotseatIcons - 1); } } /** * Updates the iconSize for allApps* variants. Loading Loading @@ -1070,6 +1094,13 @@ public class DeviceProfile { mHotseatPadding.left -= diff; mHotseatPadding.right += diff; } } else if (isScalableGrid) { int sideSpacing = (availableWidthPx - qsbWidth) / 2; mHotseatPadding.set(sideSpacing, hotseatBarTopPaddingPx, sideSpacing, hotseatBarSizePx - hotseatCellHeightPx - hotseatBarTopPaddingPx + mInsets.bottom); } else { // We want the edges of the hotseat to line up with the edges of the workspace, but the // icons in the hotseat are a different size, and so don't line up perfectly. To account Loading Loading @@ -1306,6 +1337,7 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("allAppsLeftRightMargin", allAppsLeftRightMargin)); writer.println(prefix + pxToDpStr("hotseatBarSizePx", hotseatBarSizePx)); writer.println(prefix + "\tinv.hotseatColumnSpan: " + inv.hotseatColumnSpan[mTypeIndex]); writer.println(prefix + pxToDpStr("hotseatCellHeightPx", hotseatCellHeightPx)); writer.println(prefix + pxToDpStr("hotseatBarTopPaddingPx", hotseatBarTopPaddingPx)); writer.println(prefix + pxToDpStr("hotseatBarBottomPaddingPx", hotseatBarBottomPaddingPx)); Loading Loading @@ -1384,7 +1416,7 @@ public class DeviceProfile { private static Context getContext(Context c, Info info, int orientation, WindowBounds bounds) { Configuration config = new Configuration(c.getResources().getConfiguration()); config.orientation = orientation; config.densityDpi = info.densityDpi; config.densityDpi = info.getDensityDpi(); config.smallestScreenWidthDp = (int) info.smallestSizeDp(bounds); return c.createConfigurationContext(config); } Loading
src/com/android/launcher3/Hotseat.java +2 −10 Original line number Diff line number Diff line Loading @@ -173,17 +173,9 @@ public class Hotseat extends CellLayout implements Insettable { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width; if (mActivity.getDeviceProfile().isQsbInline) { width = mActivity.getDeviceProfile().qsbWidth; } else { MarginLayoutParams qsbParams = (MarginLayoutParams) mQsb.getLayoutParams(); width = getShortcutsAndWidgets().getMeasuredWidth() - qsbParams.getMarginStart() - qsbParams.getMarginEnd(); } int qsbWidth = mActivity.getDeviceProfile().qsbWidth; mQsb.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), mQsb.measure(MeasureSpec.makeMeasureSpec(qsbWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mQsbHeight, MeasureSpec.EXACTLY)); } Loading