From 9acc34c9ba9e1d608f8dfcb2499fd18d2de83daa Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Mon, 19 Dec 2016 16:15:14 +1100 Subject: [PATCH] Tweak accessibility so that visually impaird people can use F-Droid well. Things that are still not right: * BottomNavigationView doesn't read out the title of items when selected. Created this issue: https://code.google.com/p/android/issues/detail?id=230595&thanks=230595&ts=1482125499 * TTS reader combines the app name and summary without a pause which is jarring. * Touching the background of the recycler view in the categories view reads all category names. * Likely other problems too. --- .../fdroid/fdroid/views/apps/CategoryTextWatcher.java | 3 ++- .../fdroid/views/categories/CategoryController.java | 1 + app/src/main/res/layout/app_card_featured.xml | 6 ++++-- app/src/main/res/layout/app_card_horizontal.xml | 6 ++++-- app/src/main/res/layout/app_card_large.xml | 6 ++++-- app/src/main/res/layout/app_card_list_item.xml | 6 ++++-- app/src/main/res/layout/app_list_item.xml | 6 ++++-- app/src/main/res/layout/fab_search.xml | 1 + app/src/main/res/menu/main_activity_screens.xml | 10 +++++----- app/src/main/res/values/strings.xml | 8 +++++++- 10 files changed, 36 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/views/apps/CategoryTextWatcher.java b/app/src/main/java/org/fdroid/fdroid/views/apps/CategoryTextWatcher.java index daad4a208..2d943cfae 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/apps/CategoryTextWatcher.java +++ b/app/src/main/java/org/fdroid/fdroid/views/apps/CategoryTextWatcher.java @@ -139,7 +139,8 @@ public class CategoryTextWatcher implements TextWatcher { if (Build.VERSION.SDK_INT >= 21) { // For accessibility reasons, make this more clear to screen readers that the // span we just added semantically represents a category. - TtsSpan ttsSpan = new TtsSpan.TextBuilder(context.getString(R.string.category)).build(); + CharSequence categoryName = textToSpannify.subSequence(0, colonIndex); + TtsSpan ttsSpan = new TtsSpan.TextBuilder(context.getString(R.string.tts_category_name, categoryName)).build(); textToSpannify.setSpan(ttsSpan, 0, 0, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } diff --git a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java index 402239f0c..822236a23 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java @@ -121,6 +121,7 @@ public class CategoryController extends RecyclerView.ViewHolder implements Loade int numAppsInCategory = cursor.getInt(0); viewAll.setVisibility(View.VISIBLE); viewAll.setText(activity.getResources().getQuantityString(R.plurals.button_view_all_apps_in_category, numAppsInCategory, numAppsInCategory)); + viewAll.setContentDescription(activity.getResources().getQuantityString(R.plurals.tts_view_all_in_category, numAppsInCategory, numAppsInCategory, currentCategory)); } } diff --git a/app/src/main/res/layout/app_card_featured.xml b/app/src/main/res/layout/app_card_featured.xml index e4b163856..1164db874 100644 --- a/app/src/main/res/layout/app_card_featured.xml +++ b/app/src/main/res/layout/app_card_featured.xml @@ -40,15 +40,17 @@ android:layout_height="wrap_content" android:layout_margin="12dp"> + + app:layout_constraintTop_toTopOf="parent" + tools:ignore="ContentDescription" /> + + app:layout_constraintTop_toTopOf="parent" + tools:ignore="ContentDescription" /> + + app:layout_constraintTop_toTopOf="parent" + tools:ignore="ContentDescription" /> + + app:layout_constraintTop_toTopOf="parent" + tools:ignore="ContentDescription" /> + + android:layout_marginTop="8dp" + tools:ignore="ContentDescription" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bd5c70f67..5000f3f61 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -444,5 +444,11 @@ Cancel Install - Category + + Category %1$s + + + View the single one app in the %2$s category + View all %1$d apps from the %2$s category +