Loading aconfig/launcher.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,13 @@ flag { bug: "270390937" } flag { name: "enable_twoline_toggle" namespace: "launcher" description: "Enables visibility in home settings to see the toggle to turn on/off two lines in all apps." bug: "316027081" } flag { name: "enable_grid_only_overview" namespace: "launcher" Loading quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.Flags; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.allapps.FloatingHeaderRow; Loading Loading @@ -137,7 +138,9 @@ public class PredictionRowView<T extends Context & ActivityContext> int totalHeight = iconHeight + iconPadding + textHeight + mVerticalPadding * 2; // Prediction row height will be 4dp bigger than the regular apps in A-Z list when two line // is not enabled. Otherwise, the extra height will increase by just the textHeight. int extraHeight = FeatureFlags.enableTwolineAllapps() ? textHeight : mTopRowExtraHeight; int extraHeight = (FeatureFlags.enableTwolineAllapps() && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get( getContext())))) ? textHeight : mTopRowExtraHeight; totalHeight += extraHeight; return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom(); } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // Update icon size deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; deviceProfile.updateIconSize(1f, getResources()); deviceProfile.updateIconSize(1f, this); }; mDeviceProfile = originDeviceProfile.toBuilder(this) .withDimensionsOverride(overrideProvider).build(); Loading src/com/android/launcher3/BubbleTextView.java +4 −2 Original line number Diff line number Diff line Loading @@ -428,8 +428,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, * Only if actual text can be displayed in two line, the {@code true} value will be effective. */ protected boolean shouldUseTwoLine() { return (FeatureFlags.enableTwolineAllapps() && isCurrentLanguageEnglish()) && (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW); return FeatureFlags.enableTwolineAllapps() && isCurrentLanguageEnglish() && (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW) && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext()))); } protected boolean isCurrentLanguageEnglish() { Loading src/com/android/launcher3/DeviceProfile.java +10 −8 Original line number Diff line number Diff line Loading @@ -717,7 +717,7 @@ public class DeviceProfile { } // Calculate all of the remaining variables. extraSpace = updateAvailableDimensions(res); extraSpace = updateAvailableDimensions(context); calculateAndSetWorkspaceVerticalPadding(context, inv, extraSpace); Loading Loading @@ -1009,14 +1009,14 @@ public class DeviceProfile { /** * Returns the amount of extra (or unused) vertical space. */ private int updateAvailableDimensions(Resources res) { private int updateAvailableDimensions(Context context) { iconCenterVertically = (mIsScalableGrid || mIsResponsiveGrid) && isVerticalBarLayout(); if (mIsResponsiveGrid) { iconSizePx = mResponsiveWorkspaceCellSpec.getIconSize(); iconTextSizePx = mResponsiveWorkspaceCellSpec.getIconTextSize(); mIconDrawablePaddingOriginalPx = mResponsiveWorkspaceCellSpec.getIconDrawablePadding(); updateIconSize(1f, res); updateIconSize(1f, context); updateWorkspacePadding(); return 0; } Loading @@ -1026,7 +1026,7 @@ public class DeviceProfile { iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics)); iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics); updateIconSize(1f, res); updateIconSize(1f, context); updateWorkspacePadding(); // Check to see if the icons fit within the available height. Loading @@ -1050,7 +1050,7 @@ public class DeviceProfile { if (shouldScale) { float scale = Math.min(scaleX, scaleY); updateIconSize(scale, res); updateIconSize(scale, context); extraHeight = Math.max(0, maxHeight - getCellLayoutHeightSpecification()); } Loading Loading @@ -1096,7 +1096,7 @@ public class DeviceProfile { * iconTextSizePx, iconDrawablePaddingPx, cellWidth/Height, allApps* variants, * hotseat sizes, workspaceSpringLoadedShrinkFactor, folderIconSizePx, and folderIconOffsetYPx. */ public void updateIconSize(float scale, Resources res) { public void updateIconSize(float scale, Context context) { // Icon scale should never exceed 1, otherwise pixellation may occur. iconScale = Math.min(1f, scale); cellScaleToFit = scale; Loading Loading @@ -1216,13 +1216,15 @@ public class DeviceProfile { if (mIsResponsiveGrid) { updateAllAppsWithResponsiveMeasures(); } else { updateAllAppsIconSize(scale, res); updateAllAppsIconSize(scale, context.getResources()); } updateAllAppsContainerWidth(); if (isVerticalLayout && !mIsResponsiveGrid) { hideWorkspaceLabelsIfNotEnoughSpace(); } if (FeatureFlags.enableTwolineAllapps()) { if (FeatureFlags.enableTwolineAllapps() && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(context)))) { // Add extra textHeight to the existing allAppsCellHeight. allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx); } Loading Loading
aconfig/launcher.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,13 @@ flag { bug: "270390937" } flag { name: "enable_twoline_toggle" namespace: "launcher" description: "Enables visibility in home settings to see the toggle to turn on/off two lines in all apps." bug: "316027081" } flag { name: "enable_grid_only_overview" namespace: "launcher" Loading
quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.Flags; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.allapps.FloatingHeaderRow; Loading Loading @@ -137,7 +138,9 @@ public class PredictionRowView<T extends Context & ActivityContext> int totalHeight = iconHeight + iconPadding + textHeight + mVerticalPadding * 2; // Prediction row height will be 4dp bigger than the regular apps in A-Z list when two line // is not enabled. Otherwise, the extra height will increase by just the textHeight. int extraHeight = FeatureFlags.enableTwolineAllapps() ? textHeight : mTopRowExtraHeight; int extraHeight = (FeatureFlags.enableTwolineAllapps() && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get( getContext())))) ? textHeight : mTopRowExtraHeight; totalHeight += extraHeight; return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom(); } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // Update icon size deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; deviceProfile.updateIconSize(1f, getResources()); deviceProfile.updateIconSize(1f, this); }; mDeviceProfile = originDeviceProfile.toBuilder(this) .withDimensionsOverride(overrideProvider).build(); Loading
src/com/android/launcher3/BubbleTextView.java +4 −2 Original line number Diff line number Diff line Loading @@ -428,8 +428,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, * Only if actual text can be displayed in two line, the {@code true} value will be effective. */ protected boolean shouldUseTwoLine() { return (FeatureFlags.enableTwolineAllapps() && isCurrentLanguageEnglish()) && (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW); return FeatureFlags.enableTwolineAllapps() && isCurrentLanguageEnglish() && (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW) && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext()))); } protected boolean isCurrentLanguageEnglish() { Loading
src/com/android/launcher3/DeviceProfile.java +10 −8 Original line number Diff line number Diff line Loading @@ -717,7 +717,7 @@ public class DeviceProfile { } // Calculate all of the remaining variables. extraSpace = updateAvailableDimensions(res); extraSpace = updateAvailableDimensions(context); calculateAndSetWorkspaceVerticalPadding(context, inv, extraSpace); Loading Loading @@ -1009,14 +1009,14 @@ public class DeviceProfile { /** * Returns the amount of extra (or unused) vertical space. */ private int updateAvailableDimensions(Resources res) { private int updateAvailableDimensions(Context context) { iconCenterVertically = (mIsScalableGrid || mIsResponsiveGrid) && isVerticalBarLayout(); if (mIsResponsiveGrid) { iconSizePx = mResponsiveWorkspaceCellSpec.getIconSize(); iconTextSizePx = mResponsiveWorkspaceCellSpec.getIconTextSize(); mIconDrawablePaddingOriginalPx = mResponsiveWorkspaceCellSpec.getIconDrawablePadding(); updateIconSize(1f, res); updateIconSize(1f, context); updateWorkspacePadding(); return 0; } Loading @@ -1026,7 +1026,7 @@ public class DeviceProfile { iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics)); iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics); updateIconSize(1f, res); updateIconSize(1f, context); updateWorkspacePadding(); // Check to see if the icons fit within the available height. Loading @@ -1050,7 +1050,7 @@ public class DeviceProfile { if (shouldScale) { float scale = Math.min(scaleX, scaleY); updateIconSize(scale, res); updateIconSize(scale, context); extraHeight = Math.max(0, maxHeight - getCellLayoutHeightSpecification()); } Loading Loading @@ -1096,7 +1096,7 @@ public class DeviceProfile { * iconTextSizePx, iconDrawablePaddingPx, cellWidth/Height, allApps* variants, * hotseat sizes, workspaceSpringLoadedShrinkFactor, folderIconSizePx, and folderIconOffsetYPx. */ public void updateIconSize(float scale, Resources res) { public void updateIconSize(float scale, Context context) { // Icon scale should never exceed 1, otherwise pixellation may occur. iconScale = Math.min(1f, scale); cellScaleToFit = scale; Loading Loading @@ -1216,13 +1216,15 @@ public class DeviceProfile { if (mIsResponsiveGrid) { updateAllAppsWithResponsiveMeasures(); } else { updateAllAppsIconSize(scale, res); updateAllAppsIconSize(scale, context.getResources()); } updateAllAppsContainerWidth(); if (isVerticalLayout && !mIsResponsiveGrid) { hideWorkspaceLabelsIfNotEnoughSpace(); } if (FeatureFlags.enableTwolineAllapps()) { if (FeatureFlags.enableTwolineAllapps() && (!Flags.enableTwolineToggle() || (Flags.enableTwolineToggle() && LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(context)))) { // Add extra textHeight to the existing allAppsCellHeight. allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx); } Loading