Browse Source

Merge pull request #1216 from nextcloud/a11yContentDescription

A11y content description
Andy Scherzinger 4 years ago
parent
commit
b97b25177a

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

+ 8 - 0
app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.kt

@@ -194,12 +194,20 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
             else -> null
         }
 
+        val readStatusContentDescriptionString = when (message.readStatus) {
+            ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
+            ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
+            else -> null
+        }
+
         readStatusDrawableInt?.let { drawableInt ->
             context?.resources?.getDrawable(drawableInt, null)?.let {
                 it.setColorFilter(context?.resources!!.getColor(R.color.white60), PorterDuff.Mode.SRC_ATOP)
                 checkMark?.setImageDrawable(it)
             }
         }
+
+        checkMark?.setContentDescription(readStatusContentDescriptionString)
     }
 
     init {

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

@@ -759,6 +759,11 @@ public class ProfileController extends BaseController {
                         holder.scope.setImageResource(R.drawable.ic_link);
                         break;
                 }
+
+                holder.scope.setContentDescription(
+                        controller.getActivity().getResources().getString(
+                                R.string.scope_toggle_description,
+                                item.hint));
             }
 
             holder.icon.setImageResource(item.icon);

+ 6 - 6
app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java

@@ -35,13 +35,8 @@ import android.view.inputmethod.EditorInfo;
 import android.widget.Button;
 import android.widget.ImageView;
 
-import androidx.annotation.NonNull;
-import autodagger.AutoInjector;
-import butterknife.BindView;
-import butterknife.OnClick;
 import com.bluelinelabs.conductor.RouterTransaction;
 import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
-import com.google.android.material.textfield.TextInputEditText;
 import com.google.android.material.textfield.TextInputLayout;
 import com.nextcloud.talk.R;
 import com.nextcloud.talk.application.NextcloudTalkApplication;
@@ -65,6 +60,11 @@ import org.parceler.Parcels;
 
 import javax.inject.Inject;
 
+import androidx.annotation.NonNull;
+import autodagger.AutoInjector;
+import butterknife.BindView;
+import butterknife.OnClick;
+
 @AutoInjector(NextcloudTalkApplication.class)
 public class EntryMenuController extends BaseController {
 
@@ -95,7 +95,6 @@ public class EntryMenuController extends BaseController {
 
     private EmojiPopup emojiPopup;
 
-
     private Bundle originalBundle;
 
     public EntryMenuController(Bundle args) {
@@ -116,6 +115,7 @@ public class EntryMenuController extends BaseController {
         this.callUrl = args.getString(BundleKeys.INSTANCE.getKEY_CALL_URL(), "");
     }
 
+    @NonNull
     @Override
     protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
         return inflater.inflate(R.layout.controller_entry_menu, container, false);

+ 4 - 0
app/src/main/res/layout/call_item.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -46,6 +48,7 @@
         android:layout_alignParentStart="true"
         android:layout_marginStart="8dp"
         android:layout_marginEnd="8dp"
+        android:contentDescription="@string/nc_remote_audio_off"
         android:src="@drawable/ic_mic_off_white_24px"
         android:visibility="invisible" />
 
@@ -56,6 +59,7 @@
         android:layout_below="@id/peer_nick_text_view"
         android:layout_marginStart="8dp"
         android:layout_toEndOf="@id/remote_audio_off"
+        android:contentDescription="@string/nc_remote_video_off"
         android:src="@drawable/ic_videocam_off_white_24px"
         android:visibility="invisible" />
 

+ 3 - 0
app/src/main/res/layout/call_states.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -29,6 +31,7 @@
         android:layout_height="48dp"
         android:layout_above="@id/callStateTextView"
         android:layout_centerHorizontal="true"
+        android:contentDescription="@null"
         android:src="@drawable/ic_signal_wifi_off_white_24dp"
         android:visibility="gone" />
 

+ 7 - 4
app/src/main/res/layout/controller_call_notification.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -27,6 +29,7 @@
         android:id="@+id/backgroundImageView"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:contentDescription="@null"
         android:scaleType="centerCrop"
         android:src="@color/grey950"
         tools:srcCompat="@tools:sample/backgrounds/scenic" />
@@ -48,7 +51,7 @@
             app:backgroundImage="@color/nc_darkGreen"
             app:placeholderImage="@drawable/ic_call_white_24dp"
             app:roundAsCircle="true"
-            tools:visibility="visible"/>
+            tools:visibility="visible" />
 
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/callControlHangupView"
@@ -68,7 +71,7 @@
             app:backgroundImage="@color/nc_darkGreen"
             app:placeholderImage="@drawable/ic_videocam_white_24px"
             app:roundAsCircle="true"
-            tools:visibility="visible"/>
+            tools:visibility="visible" />
     </LinearLayout>
 
     <RelativeLayout
@@ -105,11 +108,11 @@
             android:id="@+id/incomingCallDescriptionTextView"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_below="@+id/conversationNameTextView"
             android:text="@string/nc_call_incoming"
             android:textAlignment="center"
             android:textColor="@color/controller_call_incomingCallTextView"
-            android:textSize="16sp"
-            android:layout_below="@+id/conversationNameTextView" />
+            android:textSize="16sp" />
 
     </RelativeLayout>
 

+ 1 - 0
app/src/main/res/layout/controller_entry_menu.xml

@@ -74,6 +74,7 @@
         android:layout_alignParentEnd="true"
         android:layout_marginStart="-4dp"
         android:background="@color/transparent"
+        android:contentDescription="@string/nc_add_emojis"
         android:src="@drawable/ic_insert_emoticon_black_24dp"
         android:tint="@color/emoji_icons"
         android:visibility="gone"

+ 2 - 1
app/src/main/res/layout/controller_locked.xml

@@ -46,6 +46,7 @@
             android:layout_width="32dp"
             android:layout_height="32dp"
             android:layout_gravity="center"
+            android:contentDescription="@string/nc_locked"
             android:src="@drawable/ic_lock_white_24px" />
 
     </FrameLayout>
@@ -57,7 +58,7 @@
         android:layout_gravity="center_horizontal"
         android:paddingTop="16dp"
         android:paddingBottom="56dp"
-        android:text="@string/nc_locked"
+        android:text="@string/nc_locked_tap_to_unlock"
         android:textAlignment="center"
         android:textColor="@color/textColorOnPrimaryBackground"
         android:textSize="22sp" />

+ 1 - 0
app/src/main/res/layout/controller_operations_menu.xml

@@ -32,6 +32,7 @@
         android:layout_marginTop="24dp"
         android:layout_marginEnd="24dp"
         android:layout_marginBottom="8dp"
+        android:contentDescription="@null"
         android:tintMode="src_in"
         android:visibility="gone" />
 

+ 4 - 1
app/src/main/res/layout/item_custom_outcoming_text_message.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -66,7 +68,8 @@
             android:layout_height="wrap_content"
             android:layout_below="@id/messageTime"
             android:layout_marginStart="8dp"
-            app:layout_alignSelf="center" />
+            app:layout_alignSelf="center"
+            android:contentDescription="@null" />
 
     </com.google.android.flexbox.FlexboxLayout>
 </RelativeLayout>

+ 6 - 2
app/src/main/res/layout/lobby_view.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -32,6 +34,7 @@
         android:layout_above="@id/lobby_text_view"
         android:layout_centerHorizontal="true"
         android:layout_margin="@dimen/margin_between_elements"
+        android:contentDescription="@string/nc_lobby"
         android:src="@drawable/ic_room_service_black_24dp"
         app:tint="@color/grey_600" />
 
@@ -40,9 +43,10 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_centerInParent="true"
-        android:layout_margin="@dimen/margin_between_elements"
+        android:layout_margin="@dimen/standard_margin"
         android:text="@string/nc_lobby_waiting"
         android:textAlignment="center"
-        android:textColor="@color/grey_600" />
+        android:textColor="@color/grey_600"
+        android:textSize="16sp" />
 
 </RelativeLayout>

+ 3 - 0
app/src/main/res/layout/rv_item_app.xml

@@ -2,6 +2,8 @@
   ~ Nextcloud Talk application
   ~
   ~ @author Mario Danic
+  ~ @author Andy Scherzinger
+  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
   ~ Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
   ~
   ~ This program is free software: you can redistribute it and/or modify
@@ -32,6 +34,7 @@
         android:layout_height="24dp"
         android:layout_centerVertical="true"
         android:layout_marginStart="16dp"
+        android:contentDescription="@null"
         android:focusable="false"
         android:focusableInTouchMode="false"
         tools:src="@drawable/ic_add_grey600_24px" />

+ 1 - 0
app/src/main/res/layout/rv_item_browser_file.xml

@@ -53,6 +53,7 @@
         android:layout_height="16dp"
         android:layout_below="@id/file_icon"
         android:layout_alignStart="@+id/file_icon"
+        android:contentDescription="@string/encrypted"
         android:src="@drawable/ic_lock_grey600_24px" />
 
     <TextView

+ 1 - 0
app/src/main/res/layout/rv_item_conversation.xml

@@ -59,6 +59,7 @@
         android:layout_centerVertical="true"
         android:layout_marginStart="@dimen/standard_margin"
         android:background="?android:attr/selectableItemBackground"
+        android:contentDescription="@null"
         android:scaleType="center"
         android:src="@drawable/ic_more_horiz_black_24dp" />
 

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

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

+ 6 - 3
app/src/main/res/layout/view_message_input.xml

@@ -46,7 +46,8 @@
             android:layout_width="36dp"
             android:layout_height="36dp"
             android:layout_below="@id/quotedChatMessageView"
-            android:scaleType="centerInside" />
+            android:scaleType="centerInside"
+            android:contentDescription="@string/nc_add_attachment" />
 
         <ImageButton
             android:id="@+id/smileyButton"
@@ -56,7 +57,8 @@
             android:layout_toStartOf="@id/messageSendButton"
             android:background="@color/transparent"
             android:src="@drawable/ic_insert_emoticon_black_24dp"
-            android:tint="@color/emoji_icons" />
+            android:tint="@color/emoji_icons"
+            android:contentDescription="@string/nc_add_emojis" />
 
         <ImageButton
             android:id="@id/messageSendButton"
@@ -66,7 +68,8 @@
             android:layout_below="@id/quotedChatMessageView"
             android:adjustViewBounds="true"
             android:padding="4dp"
-            android:scaleType="centerInside" />
+            android:scaleType="centerInside"
+            android:contentDescription="@string/nc_description_send_message_button" />
 
         <Space
             android:id="@id/attachmentButtonSpace"

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

@@ -128,7 +128,8 @@
     <string name="nc_settings_link_previews_desc">Allows previews of content from received links for supported services</string>
     <string name="nc_settings_link_previews_key" translatable="false">link_previews</string>
     <string name="nc_settings_read_privacy_key" translatable="false">read_privacy</string>
-    <string name="nc_locked">Tap to unlock</string>
+    <string name="nc_locked_tap_to_unlock">Tap to unlock</string>
+    <string name="nc_locked">Locked</string>
     <string name="nc_settings_read_privacy_desc">Share my read-status and show the read-status of others</string>
     <string name="nc_settings_read_privacy_title">Read status</string>
 
@@ -209,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>
@@ -232,6 +236,7 @@
     <string name="nc_ok">OK</string>
     <string name="nc_call_name">Conversation name</string>
     <string name="nc_proceed">Proceed</string>
+    <string name="nc_add_emojis">Add emojis</string>
     <string name="nc_call_name_is_same">The name you entered is the same as the existing one</string>
     <string name="nc_wrong_link">Conversation link is not valid</string>
     <string name="nc_share_text">Join the conversation at %1$s/index.php/call/%2$s</string>
@@ -274,6 +279,11 @@
     <string name="nc_message_quote_cancel_reply">Cancel reply</string>
     <!-- When translating to German, please use non-formal variant -->
     <string name="nc_formatted_message_you">You: %1$s</string>
+    <string name="nc_message_read">Message read</string>
+    <string name="nc_message_sent">Message sent</string>
+    <string name="nc_remote_video_off">Remote video off</string>
+    <string name="nc_remote_audio_off">Remote audio off</string>
+    <string name="nc_add_attachment">Add attachment</string>
 
     <!-- Contacts endless loading -->
     <string name="nc_no_more_load_retry">No more items to load. Refresh to retry.</string>
@@ -368,6 +378,7 @@
     <string name="nc_phone_book_integration_account_not_found">Account not found</string>
 
     <string name="starred">Favorite</string>
+    <string name="encrypted">Encrypted</string>
     <string name="password_protected">Password protected</string>
 
     <string name="avatar">Avatar</string>
@@ -398,6 +409,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">Change privacy level of %1$s</string>
 
     <!-- App Bar -->
     <string name="appbar_search_in">Search in %s</string>

+ 1 - 1
scripts/analysis/lint-results.txt

@@ -1,2 +1,2 @@
 DO NOT TOUCH; GENERATED BY DRONE
-      <span class="mdl-layout-title">Lint Report: 3 errors and 367 warnings</span>
+      <span class="mdl-layout-title">Lint Report: 3 errors and 346 warnings</span>