Add home settings toggle featureflag for enablingTwoLineText

- Have shouldUseTwoLine() be decided with the home settings toggle value

bug:316027081
spec: https://www.figma.com/file/uMzPkNMZpb7EyfHDo8usIa/V-%E2%80%A2-Toast-Butter?type=design&node-id=405-384593&mode=design&t=UBkdeuNlAdRh2FGU-0
Test:
Video: https://drive.google.com/file/d/15VUhNVro2fiwv3SzMda1StiPb3PV1eMT/view?usp=sharing
before searchPreferenceScreen: https://screenshot.googleplex.com/3uqdMsZoGSBYb6c
after searchPreferenceScreen: https://drive.google.com/file/d/15dswiHRTnafyhgQA_tL2tRc7vHFWdHbZ/view?usp=sharing
before homeSettingsPage: https://screenshot.googleplex.com/7wsNevxGun2KCCB
after homeSettingsPage: https://drive.google.com/file/d/15m5bjEyewlNHI_h26aygHa7zrgZ5qDF6/view?usp=sharing
AppListSettingsPage: https://drive.google.com/file/d/15hl4ScHBOLgKv3M38HtatMxQw85pgl7t/view?usp=sharing
Flag: enableTwolineToggle DEVELOPMENT

Change-Id: I3ad133dd51dcb97e14ccded730e7737c5049261a
This commit is contained in:
Brandon Dayauon
2023-12-14 13:47:17 -08:00
parent 0f1c6dedf5
commit 5787a2710c
7 changed files with 35 additions and 14 deletions
+10 -8
View File
@@ -714,7 +714,7 @@ public class DeviceProfile {
}
// Calculate all of the remaining variables.
extraSpace = updateAvailableDimensions(res);
extraSpace = updateAvailableDimensions(context);
calculateAndSetWorkspaceVerticalPadding(context, inv, extraSpace);
@@ -1006,14 +1006,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;
}
@@ -1023,7 +1023,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.
@@ -1047,7 +1047,7 @@ public class DeviceProfile {
if (shouldScale) {
float scale = Math.min(scaleX, scaleY);
updateIconSize(scale, res);
updateIconSize(scale, context);
extraHeight = Math.max(0, maxHeight - getCellLayoutHeightSpecification());
}
@@ -1093,7 +1093,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;
@@ -1213,13 +1213,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);
}