Set twoline toggle to false when not in english language.

Set toggle preference in deviceProfile as this is the first step after the locale change before any binding/inflation happens.
Otherwise the toggle will be stale if we set this false during "apply"/bind which can cause complexities.

bug:373670311
Test manually vid: https://drive.google.com/file/d/1WXl_fMU8eynwlxdwYBamEnqP1tU_q0kb/view?usp=sharing
Flag: NONE bugfix

Change-Id: Iaf9e88ef76ebda6b62942b7bc3f4e39b4ced5116
This commit is contained in:
Brandon Dayauon committed 2024-10-22 09:57:23 -07:00
1 parent 13b964f91d
commit 9c65174760
2 files changed
+17 -2

No files matched your search

+9 -2
View File
@@ -24,6 +24,7 @@ import static com.android.launcher3.InvariantDeviceProfile.INDEX_LANDSCAPE;
import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_LANDSCAPE;
import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_PORTRAIT;
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.isEnglishLanguage;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
@@ -1344,8 +1345,14 @@ public class DeviceProfile {
}
if ((Flags.enableTwolineToggle()
&& LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(context))) {
// Add extra textHeight to the existing allAppsCellHeight.
allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx);
if (!isEnglishLanguage(context)) {
// Set toggle preference value to false if not english here as it's possible the
// preference is stale after language change.
LauncherPrefs.get(context).put(LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE, false);
} else {
// Add extra textHeight to the existing allAppsCellHeight.
allAppsCellHeightPx += Utilities.calculateTextHeight(allAppsIconTextSizePx);
}
}
updateHotseatSizes(iconSizePx);