From 98a6b74291c6bd68f0ad0a36b99652b038f5dc39 Mon Sep 17 00:00:00 2001 From: Doris Ling Date: Mon, 12 Feb 2018 11:40:03 -0800 Subject: [PATCH] Add content description to suggestion card close button. Change-Id: I2354dd5a4b092ac24bbc0c197bd228b73d8ede64 Fixes: 72958040 Test: talkback, make RunSettingsRoboTests --- res/layout/suggestion_tile.xml | 1 + res/layout/suggestion_tile_with_button.xml | 1 + .../suggestions/SuggestionAdapterTest.java | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml index fa3f3afe4de..850e55ae025 100644 --- a/res/layout/suggestion_tile.xml +++ b/res/layout/suggestion_tile.xml @@ -52,6 +52,7 @@ android:layout_alignParentEnd="true" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" + android:contentDescription="@string/dlg_close" android:src="@drawable/ic_suggestion_close_button"/> diff --git a/res/layout/suggestion_tile_with_button.xml b/res/layout/suggestion_tile_with_button.xml index de3494afd0f..8fb8e84022e 100644 --- a/res/layout/suggestion_tile_with_button.xml +++ b/res/layout/suggestion_tile_with_button.xml @@ -52,6 +52,7 @@ android:layout_alignParentEnd="true" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" + android:contentDescription="@string/dlg_close" android:src="@drawable/ic_suggestion_close_button"/> diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java index bac02d37d86..4ff09c174c5 100644 --- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java +++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java @@ -294,6 +294,19 @@ public class SuggestionAdapterTest { verify(drawable).setTint(colorAccent); } + @Test + public void onBindViewHolder_closeButtonShouldHaveContentDescription() + throws PendingIntent.CanceledException { + final List suggestions = makeSuggestions("pkg1"); + setupSuggestions(mActivity, suggestions); + + mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0); + + assertThat( + mSuggestionHolder.itemView.findViewById(R.id.close_button).getContentDescription()) + .isNotNull(); + } + @Test public void setCardLayout_oneCard_shouldSetCardWidthToMatchParent() { final List suggestions = makeSuggestions("pkg1");