Przeglądaj źródła

a11y dynamically set call state info on user items

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 lat temu
rodzic
commit
d54b3f3d0a

+ 24 - 7
app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java

@@ -193,24 +193,42 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
                     holder.videoCallImageView.setVisibility(View.GONE);
                     break;
                 case IN_CALL:
-                    holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble));
+                    holder.voiceOrSimpleCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_call_bubble, null));
                     holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
+                    holder.voiceOrSimpleCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_in_call, participant.displayName));
                     holder.videoCallImageView.setVisibility(View.GONE);
                     break;
                 case IN_CALL_WITH_AUDIO:
-                    holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble));
+                    holder.voiceOrSimpleCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_voice_bubble, null));
                     holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
+                    holder.voiceOrSimpleCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_in_call_with_audio, participant.displayName));
                     holder.videoCallImageView.setVisibility(View.GONE);
                     break;
                 case IN_CALL_WITH_VIDEO:
-                    holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble));
-                    holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble));
+                    holder.voiceOrSimpleCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_call_bubble, null));
+                    holder.videoCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_video_bubble, null));
+                    holder.voiceOrSimpleCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_in_call, participant.displayName));
+                    holder.videoCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_with_video, participant.displayName));
                     holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
                     holder.videoCallImageView.setVisibility(View.VISIBLE);
                     break;
                 case IN_CALL_WITH_AUDIO_AND_VIDEO:
-                    holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble));
-                    holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble));
+                    holder.voiceOrSimpleCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_voice_bubble, null));
+                    holder.videoCallImageView.setBackground(
+                            ResourcesCompat.getDrawable(resources, R.drawable.shape_video_bubble, null));
+                    holder.voiceOrSimpleCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_in_call_with_audio));
+                    holder.videoCallImageView.setContentDescription(
+                            resources.getString(R.string.nc_call_state_with_video));
                     holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
                     holder.videoCallImageView.setVisibility(View.VISIBLE);
                     break;
@@ -220,7 +238,6 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
                     break;
             }
 
-
             if (holder.contactMentionId != null) {
                 String userType = "";
 

+ 2 - 0
app/src/main/res/layout/rv_item_conversation_info_participant.xml

@@ -38,6 +38,7 @@
             android:layout_height="12dp"
             android:layout_gravity="bottom|end"
             android:background="@drawable/shape_lock_bubble"
+            android:contentDescription="@null"
             android:visibility="gone"
             tools:visibility="visible" />
 
@@ -47,6 +48,7 @@
             android:layout_height="12dp"
             android:layout_gravity="top|end"
             android:background="@drawable/shape_favorite_bubble"
+            android:contentDescription="@null"
             android:visibility="gone"
             tools:visibility="visible" />
 

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

@@ -210,6 +210,9 @@
     <string name="nc_call_reconnecting">Reconnecting…</string>
     <string name="nc_offline">Currently offline, please check your connectivity</string>
     <string name="nc_leaving_call">Leaving call…</string>
+    <string name="nc_call_state_in_call">%1$s in call</string>
+    <string name="nc_call_state_in_call_with_audio">%1$s in call with audio</string>
+    <string name="nc_call_state_with_video">%1$s with video</string>
 
     <!-- Notification channels -->
     <string name="nc_notification_channel">%1$s on %2$s notification channel</string>