Эх сурвалжийг харах

a11y dynamic content descriptions for scope toggles on profile

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 жил өмнө
parent
commit
188e33538e

+ 22 - 0
app/src/main/java/com/nextcloud/talk/controllers/ProfileController.java

@@ -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;
                 }
             }

+ 1 - 1
app/src/main/res/layout/user_info_details_table_item.xml

@@ -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"

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -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>