a11y dynamically set call state info on user items

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

View file

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

View file

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

View file

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