[Wi-Fi] [a11y] In Wi-Fi data usage page, Talkback should also announce the Progress bar percentage instead of "Progress bar" only.

Add conent description for talkback to announce, if the progress bar is 50%, then before modification is "Progress bar", and after modification is "50% Progress bar".

Bug: 146811265
Test: Add following unit test case to test if content description is correct or not:
      createPref_progressBarShouldSetPercentageContentDescription().

Change-Id: I71483df8e12f08c4c8c96ab3964666bf97872a83
This commit is contained in:
govenliu
2020-01-26 17:51:47 +08:00
committed by Goven Liu
parent 4ee5d1819b
commit 634044dc0b
2 changed files with 28 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ import com.android.settingslib.net.UidDetailProvider;
import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.apppreference.AppPreference;
import java.text.NumberFormat;
public class AppDataUsagePreference extends AppPreference {
private final AppItem mItem;
@@ -66,6 +68,8 @@ public class AppDataUsagePreference extends AppPreference {
progress.setVisibility(View.VISIBLE);
}
progress.setProgress(mPercent);
progress.setContentDescription(
NumberFormat.getPercentInstance().format((double) mPercent / 100));
}
private void setAppInfo() {