Accessibility tweaks in app details.

* Correctly read out "Cancel download"
 * Allow users to hear download progress correctly.
This commit is contained in:
Peter Serwylo 2017-04-25 12:06:45 +10:00
parent bae5bdb1f4
commit e2c82d2943
3 changed files with 9 additions and 0 deletions

View File

@ -372,17 +372,21 @@ public class AppDetailsRecyclerViewAdapter
progressBar.setMax(totalBytes);
progressBar.setProgress(bytesDownloaded);
progressBar.setIndeterminate(totalBytes == -1);
progressLabel.setContentDescription("");
if (resIdString != 0) {
progressLabel.setText(resIdString);
progressLabel.setContentDescription(context.getString(R.string.downloading));
progressPercent.setText("");
} else if (totalBytes > 0 && bytesDownloaded >= 0) {
float percent = bytesDownloaded * 100 / totalBytes;
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded) + " / " + Utils.getFriendlySize(totalBytes));
progressLabel.setContentDescription(context.getString(R.string.app__tts__downloading_progress, (int) percent));
NumberFormat format = NumberFormat.getPercentInstance();
format.setMaximumFractionDigits(0);
progressPercent.setText(format.format(percent / 100));
} else if (bytesDownloaded >= 0) {
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded));
progressLabel.setContentDescription(context.getString(R.string.downloading));
progressPercent.setText("");
}

View File

@ -90,6 +90,7 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@string/app__tts__cancel_download"
android:src="@android:drawable/ic_menu_close_clear_cancel" />
<TextView
@ -99,6 +100,8 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="@string/downloading"
android:contentDescription="@string/downloading"
android:focusable="true"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView

View File

@ -75,6 +75,7 @@
<string name="app_recommended_version_installed">Version %1$s (Recommended)</string>
<string name="app__newly_added">New</string>
<string name="added_on">Added on %s</string>
<string name="app__tts__cancel_download">Cancel download</string>
<string name="app__install_downloaded_update">Update</string>
<string name="app_list__name__downloaded_and_ready_to_update">Update %1$s</string>
@ -475,6 +476,7 @@
<string name="perms_new_perm_prefix">New:</string>
<string name="perms_description_app">Provided by %1$s.</string>
<string name="downloading">Downloading…</string>
<string name="app__tts__downloading_progress">Downloading, %1$d%% complete</string>
<string name="downloading_apk">Downloading %1$s</string>
<string name="installing">Installing…</string>
<string name="uninstalling">Uninstalling…</string>