diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 1e7fd7f57d..3ca6ce419c 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -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); diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 9192e13cd0..71a2589dc7 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -615,6 +615,14 @@ public final class Utilities { return options; } + /** + * Utility method to know if a device's primary language is English. + */ + public static boolean isEnglishLanguage(Context context) { + return context.getResources().getConfiguration().locale.getLanguage() + .equals(Locale.ENGLISH.getLanguage()); + } + /** * Returns the full drawable for info as multiple layers of AdaptiveIconDrawable. The second * drawable in the Pair is the badge used with the icon.