Add transalatable Strings for shape titles

Bug: 406486710
Test: presubmit
Flag: com.android.launcher3.enable_launcher_icon_shapes
Change-Id: I227227e7591979de474c27adcd71c6d83393bae9
This commit is contained in:
Charlie Anderson committed 2025-03-26 20:09:07 -07:00
1 parent e86ab76130
commit d2560ecf31
4 files changed
+30 -9

No files matched your search

+12
View File
@@ -551,4 +551,16 @@
<!-- Content description for install app icon -->
<string name="ps_add_button_content_description">Install apps to Private Space</string>
<string name="ps_app_content_description">Add files and more to Private Space</string>
<!-- Strings for icon shapes -->
<!-- label for circle shape option in customization picker -->
<string name="circle_shape_title">Circle</string>
<!-- label for square shape option in customization picker -->
<string name="square_shape_title">Square</string>
<!-- label for 4-sided cookie option shape in customization picker -->
<string name="four_sided_cookie_shape_title">4-sided cookie</string>
<!-- label for 7-sided cookie option shape in customization picker -->
<string name="seven_sided_cookie_shape_title">7-sided cookie</string>
<!-- label for arch shape option in customization picker -->
<string name="arch_shape_title">Arch</string>
</resources>
@@ -178,7 +178,7 @@ public class GridCustomizationsProxy implements ProxyProvider {
for (IconShapeModel shape : ShapesProvider.INSTANCE.getIconShapes()) {
cursor.newRow()
.add(KEY_SHAPE_KEY, shape.getKey())
.add(KEY_SHAPE_TITLE, shape.getTitle())
.add(KEY_SHAPE_TITLE, mContext.getString(shape.getTitleId()))
.add(KEY_PATH, shape.getPathString())
.add(KEY_IS_DEFAULT, shape.getKey().equals(currentShape));
}
@@ -16,9 +16,11 @@
package com.android.launcher3.shapes
import androidx.annotation.StringRes
data class IconShapeModel(
val key: String,
val title: String,
@StringRes val titleId: Int,
val pathString: String,
val folderPathString: String = pathString,
val iconScale: Float = 1f,
@@ -18,6 +18,7 @@ package com.android.launcher3.shapes
import androidx.annotation.VisibleForTesting
import com.android.launcher3.Flags as LauncherFlags
import com.android.launcher3.R
import com.android.systemui.shared.Flags
object ShapesProvider {
@@ -44,43 +45,49 @@ object ShapesProvider {
@VisibleForTesting const val SEVEN_SIDED_COOKIE_KEY = "seven_sided_cookie"
@VisibleForTesting const val ARCH_KEY = "arch"
val iconShapes =
val iconShapes: Array<IconShapeModel> =
if (Flags.newCustomizationPickerUi() && LauncherFlags.enableLauncherIconShapes()) {
arrayOf(
IconShapeModel(
key = CIRCLE_KEY,
title = "circle",
titleId = R.string.circle_shape_title,
pathString = CIRCLE_PATH,
folderPathString = FOLDER_CLOVER_PATH,
),
IconShapeModel(
key = SQUARE_KEY,
title = "square",
titleId = R.string.square_shape_title,
pathString = SQUARE_PATH,
folderPathString = FOLDER_SQUARE_PATH,
),
IconShapeModel(
key = FOUR_SIDED_COOKIE_KEY,
title = "4 sided cookie",
titleId = R.string.four_sided_cookie_shape_title,
pathString = FOUR_SIDED_COOKIE_PATH,
folderPathString = FOLDER_COMPLEX_CLOVER_PATH,
iconScale = 72f / 83.4f,
),
IconShapeModel(
key = SEVEN_SIDED_COOKIE_KEY,
title = "7 sided cookie",
titleId = R.string.seven_sided_cookie_shape_title,
pathString = SEVEN_SIDED_COOKIE_PATH,
folderPathString = FOLDER_CLOVER_PATH,
iconScale = 72f / 80f,
),
IconShapeModel(
key = ARCH_KEY,
title = "arch",
titleId = R.string.arch_shape_title,
pathString = ARCH_PATH,
folderPathString = FOLDER_ARCH_PATH,
),
)
} else {
arrayOf(IconShapeModel(key = CIRCLE_KEY, title = "circle", pathString = CIRCLE_PATH))
arrayOf(
IconShapeModel(
key = CIRCLE_KEY,
titleId = R.string.circle_shape_title,
pathString = CIRCLE_PATH,
)
)
}
}