From d54b3f3d0a1e883c85c037b56e385b0b4b4f3454 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Tue, 4 May 2021 15:11:11 +0200 Subject: [PATCH] a11y dynamically set call state info on user items Signed-off-by: Andy Scherzinger --- .../talk/adapters/items/UserItem.java | 31 ++++++++++++++----- .../rv_item_conversation_info_participant.xml | 2 ++ app/src/main/res/values/strings.xml | 3 ++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java index a569f2a0d..9968aab35 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java @@ -193,24 +193,42 @@ public class UserItem extends AbstractFlexibleItem 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 break; } - if (holder.contactMentionId != null) { String userType = ""; diff --git a/app/src/main/res/layout/rv_item_conversation_info_participant.xml b/app/src/main/res/layout/rv_item_conversation_info_participant.xml index c98f43a7e..3996386e7 100644 --- a/app/src/main/res/layout/rv_item_conversation_info_participant.xml +++ b/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" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a120e173e..23d4722bf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -210,6 +210,9 @@ Reconnecting… Currently offline, please check your connectivity Leaving call… + %1$s in call + %1$s in call with audio + %1$s with video %1$s on %2$s notification channel