Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1fe4288 authored by Catherine Liang's avatar Catherine Liang Committed by Android (Google) Code Review
Browse files

Merge "Add meaningful accessibility labels for color picker (1/2)" into udc-dev

parents 114ed27f 628dee95
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -52,5 +52,6 @@
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:src="@drawable/color_option_selected_no_background"
        android:visibility="gone"/>
        android:visibility="gone"
        android:importantForAccessibility="no" />
</androidx.constraintlayout.widget.ConstraintLayout>
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:src="@drawable/color_overflow" />
            android:src="@drawable/color_overflow"
            android:contentDescription="@string/more_colors"/>
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+32 −0
Original line number Diff line number Diff line
@@ -455,6 +455,38 @@
    -->
    <string name="more_colors">More Colors</string>

    <!--
    Accessibility string for a button that allows the user to select a color scheme generated from
    their current wallpaper as the system color. This is shown in a list with other color options.

    [CHAR LIMIT=NONE].
    -->
    <string name="content_description_dynamic_color_option">Primary dynamic theme</string>

    <!--
    Accessibility string for a button that allows the user to select a color scheme generated from
    their current wallpaper as the system color. This is shown in a list with other color options.

    [CHAR LIMIT=NONE].
    -->
    <string name="content_description_neutral_color_option">Primary neutral theme</string>

    <!--
    Accessibility string for a button that allows the user to select a color scheme generated from
    their current wallpaper as the system color. This is shown in a list with other color options.

    [CHAR LIMIT=NONE].
    -->
    <string name="content_description_vibrant_color_option">Primary vibrant theme</string>

    <!--
    Accessibility string for a button that allows the user to select a color scheme generated from
    their current wallpaper as the system color. This is shown in a list with other color options.

    [CHAR LIMIT=NONE].
    -->
    <string name="content_description_expressive_color_option">Primary expressive theme</string>

    <!--
    Accessibility string for a button that allows the user to select the default color for their
    lock screen clock on the device. This is shown next to other buttons that allow the user to
+1 −4
Original line number Diff line number Diff line
@@ -61,10 +61,7 @@ class ColorOptionImpl(
    }

    override fun getContentDescription(context: Context): CharSequence? {
        if (type == ColorType.WALLPAPER_COLOR) {
            return context.getString(R.string.wallpaper_color_title)
        }
        return super.getContentDescription(context)
        return title
    }

    override fun getSource(): String? {
+14 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.customization.model.color.ColorUtils.toColorString
import com.android.customization.picker.color.shared.model.ColorType
import com.android.systemui.monet.ColorScheme
import com.android.systemui.monet.Style
import com.android.wallpaper.R
import com.android.wallpaper.compat.WallpaperManagerCompat
import com.android.wallpaper.module.InjectorProvider
import kotlinx.coroutines.CoroutineScope
@@ -48,7 +49,7 @@ import kotlinx.coroutines.withContext
/**
 * Default implementation of {@link ColorOptionsProvider} that reads preset colors from a stub APK.
 */
class ColorProvider(context: Context, stubPackageName: String) :
class ColorProvider(private val context: Context, stubPackageName: String) :
    ResourcesApkProvider(context, stubPackageName), ColorOptionsProvider {

    companion object {
@@ -244,6 +245,18 @@ class ColorProvider(context: Context, stubPackageName: String) :
                    OVERLAY_CATEGORY_SYSTEM_PALETTE,
                    if (isDefault) "" else toColorString(colorInt)
                )
                builder.title =
                    when (style) {
                        Style.TONAL_SPOT ->
                            context.getString(R.string.content_description_dynamic_color_option)
                        Style.SPRITZ ->
                            context.getString(R.string.content_description_neutral_color_option)
                        Style.VIBRANT ->
                            context.getString(R.string.content_description_vibrant_color_option)
                        Style.EXPRESSIVE ->
                            context.getString(R.string.content_description_expressive_color_option)
                        else -> context.getString(R.string.content_description_dynamic_color_option)
                    }
                builder.source = source
                builder.style = style
                // Color option index value starts from 1.
Loading