Fix talkback doesn't speak subtext info

In the original design, we only set title description for
view holder, this is wrong. It causes talkback can't
speak subtext info.

Currently, we set the title content description in the title
view directly, so talkback can say the title and subtext now
when talkback focus on an app view.

Test: Talkback speaks full information for an app entry
Fix: 177873163
Change-Id: I94996d596a85cc2813ed1b10cdd4ed2bee62f4a9
This commit is contained in:
Tsung-Mao Fang
2021-05-20 21:25:22 +08:00
parent bac284a622
commit a51c9988c5
3 changed files with 28 additions and 6 deletions

View File

@@ -69,6 +69,22 @@ public class ApplicationViewHolderTest {
assertThat(mHolder.mSummary.getText()).isEqualTo(mContext.getText(R.string.disabled));
}
@Test
public void setTitle_titleIsNotEmptyAndContentIsNotEmpty_shouldSetTitleAndContentDescription() {
mHolder.setTitle("title", "content");
assertThat(mHolder.mAppName).isEqualTo("title");
assertThat(mHolder.mAppName.getContentDescription()).isEqualTo("content");
}
@Test
public void setTitle_titleIsNotEmptyButContentIsEmpty_shouldSetTitle() {
mHolder.setTitle("title", "");
assertThat(mHolder.mAppName).isEqualTo("title");
assertThat(mHolder.mAppName.getContentDescription()).isEqualTo("title");
}
@Test
public void updateSize() {
final String invalidStr = "invalid";