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.
This commit is contained in:
parent
6ad1f0faef
commit
9acc34c9ba
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp">
|
||||
|
||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||
when it will inevitably read out the name of the app straight after. -->
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:contentDescription="@string/app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
tools:src="@drawable/ic_launcher"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
tools:text="F-Droid An application summary which takes up too much space and must ellipsize, perhaps after wrapping to a new line"
|
||||
|
@ -10,15 +10,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||
when it will inevitably read out the name of the app straight after. -->
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:contentDescription="@string/app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
tools:src="@drawable/ic_launcher"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
tools:text="F-Droid An application summary which takes up too much space and must ellipsize"
|
||||
|
@ -10,9 +10,10 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||
when it will inevitably read out the name of the app straight after. -->
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:contentDescription="@string/app_icon"
|
||||
android:layout_width="96dip"
|
||||
android:layout_height="96dip"
|
||||
tools:src="@drawable/ic_launcher"
|
||||
@ -25,7 +26,8 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
tools:text="F-Droid An application summary which takes up too much space and must ellipsize"
|
||||
|
@ -10,15 +10,17 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp">
|
||||
|
||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||
when it will inevitably read out the name of the app straight after. -->
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:contentDescription="@string/app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
tools:src="@drawable/ic_launcher"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
tools:text="F-Droid An application summary which takes up too much space and must ellipsize"
|
||||
|
@ -6,18 +6,20 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- Ignore ContentDescription because it is kind of meaningless to have TTS read out "App icon"
|
||||
when it will inevitably read out the name of the app straight after. -->
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="@string/app_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
tools:src="@drawable/ic_launcher"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
android:layout_marginTop="8dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
|
@ -3,6 +3,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/btn_search"
|
||||
android:src="@drawable/ic_search_white"
|
||||
android:contentDescription="@string/menu_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
|
@ -4,26 +4,26 @@
|
||||
<item
|
||||
android:title="@string/main_menu__latest_apps"
|
||||
android:icon="@drawable/ic_overview"
|
||||
app:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/whats_new" />
|
||||
<item
|
||||
android:title="@string/main_menu__categories"
|
||||
android:icon="@drawable/ic_category"
|
||||
app:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/categories" />
|
||||
<item
|
||||
android:title="@string/main_menu__swap_nearby"
|
||||
android:icon="@drawable/ic_nearby"
|
||||
app:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/nearby" />
|
||||
<item
|
||||
android:title="@string/main_menu__my_apps"
|
||||
android:icon="@drawable/ic_my_apps"
|
||||
app:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/my_apps" />
|
||||
<item
|
||||
android:title="@string/menu_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
app:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:id="@+id/settings" />
|
||||
</menu>
|
@ -444,5 +444,11 @@
|
||||
<string name="notification_action_cancel">Cancel</string>
|
||||
<string name="notification_action_install">Install</string>
|
||||
|
||||
<string name="category">Category</string>
|
||||
<!-- Used by the TTS engine when showing a category "Chip" in the search box -->
|
||||
<string name="tts_category_name">Category %1$s</string>
|
||||
|
||||
<plurals name="tts_view_all_in_category">
|
||||
<item quantity="one">View the single one app in the %2$s category</item>
|
||||
<item quantity="other">View all %1$d apps from the %2$s category</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user