a11y dynamic content descriptions for scope toggles on profile

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-04 15:36:40 +02:00
parent d54b3f3d0a
commit 188e33538e
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
3 changed files with 24 additions and 1 deletions

View File

@ -749,14 +749,36 @@ public class ProfileController extends BaseController {
switch (item.scope) {
case PRIVATE:
holder.scope.setImageResource(R.drawable.ic_password);
holder.scope.setContentDescription(
controller.getActivity().getResources().getString(
R.string.scope_toggle_description,
item.hint,
controller.getActivity().getString(R.string.scope_private_title)));
break;
case LOCAL:
holder.scope.setImageResource(R.drawable.ic_password);
holder.scope.setContentDescription(
controller.getActivity().getResources().getString(
R.string.scope_toggle_description,
item.hint,
controller.getActivity().getString(R.string.scope_local_title)));
break;
case FEDERATED:
holder.scope.setImageResource(R.drawable.ic_contacts);
holder.scope.setContentDescription(
controller.getActivity().getResources().getString(
R.string.scope_toggle_description,
item.hint,
controller.getActivity().getString(R.string.scope_federated_title)));
break;
case PUBLISHED:
holder.scope.setImageResource(R.drawable.ic_link);
holder.scope.setContentDescription(
controller.getActivity().getResources().getString(
R.string.scope_toggle_description,
item.hint,
controller.getActivity().getString(R.string.scope_published_title)));
break;
}
}

View File

@ -30,7 +30,7 @@
android:layout_width="@dimen/iconized_single_line_item_icon_size"
android:layout_height="@dimen/iconized_single_line_item_icon_size"
android:layout_marginStart="@dimen/standard_margin"
android:contentDescription="@string/account_icon"
android:contentDescription="@null"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

View File

@ -408,6 +408,7 @@
<string name="scope_published_title">Published</string>
<string name="scope_published_description">Synchronize to trusted servers and the global and public address book</string>
<string name="scope_toggle">Scope toggle</string>
<string name="scope_toggle_description">Scope toggle for %1$s (%2$s)</string>
<!-- App Bar -->
<string name="appbar_search_in">Search in %s</string>