Adds content descriptions and hints to non-textual elements so they can be described by screen readers.

main
Vavassor 8 years ago
parent 4ea04bb576
commit f6a165a50a
  1. 25
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.java
  2. 9
      app/src/main/res/layout/activity_account.xml
  3. 9
      app/src/main/res/layout/activity_compose.xml
  4. 4
      app/src/main/res/layout/activity_login.xml
  5. 11
      app/src/main/res/layout/activity_main.xml
  6. 3
      app/src/main/res/layout/item_blocked_user.xml
  7. 6
      app/src/main/res/layout/item_follow.xml
  8. 35
      app/src/main/res/layout/item_status.xml
  9. 3
      app/src/main/res/layout/item_status_notification.xml
  10. 36
      app/src/main/res/layout/tab_account.xml
  11. 11
      app/src/main/res/values/strings.xml
  12. 2
      app/src/main/res/xml/preferences.xml

@ -289,6 +289,16 @@ public class AccountActivity extends BaseActivity {
updateButtons();
}
private void updateFollowButton(FloatingActionButton button) {
if (following) {
button.setImageResource(R.drawable.ic_person_minus_24px);
button.setContentDescription(getString(R.string.action_unfollow));
} else {
button.setImageResource(R.drawable.ic_person_add_24dp);
button.setContentDescription(getString(R.string.action_follow));
}
}
private void updateButtons() {
invalidateOptionsMenu();
@ -297,24 +307,13 @@ public class AccountActivity extends BaseActivity {
if(!isSelf && !blocking) {
floatingBtn.show();
if (following) {
floatingBtn.setImageResource(R.drawable.ic_person_minus_24px);
} else {
floatingBtn.setImageResource(R.drawable.ic_person_add_24dp);
}
updateFollowButton(floatingBtn);
floatingBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
follow(accountId);
if (following) {
floatingBtn.setImageResource(R.drawable.ic_person_minus_24px);
} else {
floatingBtn.setImageResource(R.drawable.ic_person_add_24dp);
}
updateFollowButton(floatingBtn);
}
});
}

@ -36,7 +36,8 @@
app:layout_collapseMode="pin"
android:fitsSystemWindows="true"
android:layout_alignTop="@+id/account_header_info"
android:layout_alignBottom="@id/account_header_info" />
android:layout_alignBottom="@id/account_header_info"
android:contentDescription="@null" />
<LinearLayout
android:orientation="vertical"
@ -101,7 +102,8 @@
android:layout_toEndOf="@id/account_username"
app:srcCompat="@drawable/reblog_disabled_light"
android:tint="?android:textColorSecondary"
android:layout_toRightOf="@id/account_username" />
android:layout_toRightOf="@id/account_username"
android:contentDescription="@string/description_account_locked"/>
</RelativeLayout>
</LinearLayout>
@ -181,6 +183,7 @@
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_person_add_24dp"/>
app:srcCompat="@drawable/ic_person_add_24dp"
android:contentDescription="@string/action_follow" />
</android.support.design.widget.CoordinatorLayout>

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_compose"
android:layout_width="match_parent"
@ -96,7 +97,8 @@
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_attach_file_24dp" />
app:srcCompat="@drawable/ic_attach_file_24dp"
android:contentDescription="@string/action_photo_pick" />
<ImageButton
android:id="@+id/action_toggle_visibility"
@ -104,7 +106,8 @@
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_public_24dp" />
app:srcCompat="@drawable/ic_public_24dp"
android:contentDescription="@string/action_compose_options" />
<Button
android:id="@+id/action_toggle_nsfw"

@ -17,7 +17,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:src="@drawable/elephant_friend"/>
android:src="@drawable/elephant_friend"
android:contentDescription="@string/description_elephant_friend" />
<android.support.design.widget.TextInputLayout
android:layout_height="wrap_content"
@ -36,7 +37,6 @@
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:elevation="0dp"
android:textColor="@android:color/white"
android:text="@string/action_login" />

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
@ -80,7 +81,6 @@
android:background="@drawable/material_drawer_shadow_bottom"
android:visibility="visible" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
@ -89,10 +89,13 @@
android:clickable="true"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_create_24dp"/>
app:srcCompat="@drawable/ic_create_24dp"
android:contentDescription="@string/action_compose" />
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
android:layout_height="match_parent">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>

@ -24,7 +24,8 @@
style="?attr/image_button_style"
android:layout_alignParentRight="true"
android:layout_marginLeft="16dp"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:contentDescription="@string/action_unblock" />
<LinearLayout
android:layout_width="wrap_content"

@ -24,7 +24,8 @@
app:srcCompat="@drawable/ic_person_add_24dp"
android:paddingRight="10dp"
android:paddingLeft="24dp"
android:tint="?attr/colorAccent" />
android:tint="?attr/colorAccent"
android:contentDescription="@string/action_follow" />
<TextView
android:id="@+id/notification_text"
@ -50,7 +51,8 @@
android:scaleType="fitCenter"
android:layout_marginLeft="8dp"
android:layout_marginRight="10dp"
android:layout_alignParentLeft="true" />
android:layout_alignParentLeft="true"
android:contentDescription="@null" />
<LinearLayout
android:layout_width="wrap_content"

@ -22,7 +22,8 @@
android:id="@+id/status_reblogged_icon"
android:paddingRight="10dp"
android:paddingLeft="24dp"
android:tint="?android:textColorTertiary" />
android:tint="?android:textColorTertiary"
android:contentDescription="@null" />
<TextView
android:layout_width="wrap_content"
@ -41,7 +42,8 @@
android:id="@+id/status_avatar"
android:layout_below="@+id/status_reblogged_bar"
android:layout_marginTop="11dp"
android:layout_marginRight="10dp" />
android:layout_marginRight="10dp"
android:contentDescription="@null" />
<RelativeLayout
android:layout_height="wrap_content"
@ -58,7 +60,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="20m ago"
android:text="20m"
android:textColor="?android:textColorSecondary" />
<LinearLayout
@ -147,6 +149,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
@ -160,7 +163,8 @@
android:layout_weight="1"
android:layout_marginRight="2dp"
android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin" />
android:layout_marginTop="@dimen/status_media_preview_top_margin"
android:contentDescription="@null" />
<ImageView
android:id="@+id/status_media_preview_1"
@ -169,7 +173,9 @@
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin" />
android:layout_marginTop="@dimen/status_media_preview_top_margin"
android:contentDescription="@null" />
</LinearLayout>
<LinearLayout
@ -184,7 +190,8 @@
android:layout_height="@dimen/status_media_preview_height"
android:layout_weight="1"
android:layout_marginRight="2dp"
android:scaleType="centerCrop" />
android:scaleType="centerCrop"
android:contentDescription="@null" />
<ImageView
android:id="@+id/status_media_preview_3"
@ -192,9 +199,11 @@
android:layout_height="@dimen/status_media_preview_height"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
android:scaleType="centerCrop"
android:contentDescription="@null" />
</LinearLayout>
</LinearLayout>
<LinearLayout
@ -241,7 +250,8 @@
android:id="@+id/status_reply"
android:layout_width="32dp"
android:layout_height="32dp"
style="?attr/image_button_style" />
style="?attr/image_button_style"
android:contentDescription="@string/action_reply" />
<Space
android:layout_width="0dp"
@ -257,7 +267,8 @@
app:sparkbutton_primaryColor="@color/status_reblog_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_reblog_button_marked_light"
android:layout_width="32dp"
android:layout_height="32dp" />
android:layout_height="32dp"
android:contentDescription="@string/action_reblog" />
<Space
android:layout_width="0dp"
@ -273,7 +284,8 @@
android:layout_gravity="center"
app:sparkbutton_primaryColor="@color/status_favourite_button_marked_dark"
app:sparkbutton_secondaryColor="@color/status_favourite_button_marked_light"
android:id="@+id/status_favourite" />
android:id="@+id/status_favourite"
android:contentDescription="@string/action_favourite" />
<Space
android:layout_width="0dp"
@ -285,7 +297,8 @@
android:id="@+id/status_more"
android:layout_width="32dp"
android:layout_height="32dp"
style="?attr/image_button_style" />
style="?attr/image_button_style"
android:contentDescription="@string/action_more" />
<Space
android:layout_width="0dp"

@ -21,7 +21,8 @@
android:id="@+id/notification_icon"
android:paddingRight="10dp"
android:paddingLeft="24dp"
app:srcCompat="@drawable/ic_repeat_24dp" />
app:srcCompat="@drawable/ic_repeat_24dp"
android:contentDescription="@null" />
<TextView
android:layout_width="wrap_content"

@ -1,30 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<RelativeLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
android:id="@+id/title"
android:layout_centerHorizontal="true"
android:textAllCaps="true"
android:textStyle="normal|bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title"
android:layout_centerHorizontal="true"
android:textAllCaps="true"
android:textStyle="normal|bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/total"
android:layout_centerHorizontal="true"
android:layout_below="@id/title"
android:textSize="10sp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/total"
android:layout_centerHorizontal="true"
android:layout_below="@id/title"
android:textSize="10sp" />
</RelativeLayout>

@ -46,6 +46,10 @@
<string name="report_username_format">Report @%s</string>
<string name="report_comment_hint">Additional comments?</string>
<string name="action_reply">Reply</string>
<string name="action_reblog">Boost</string>
<string name="action_favourite">Favourite</string>
<string name="action_more">More</string>
<string name="action_compose">Compose</string>
<string name="action_login">Login with Mastodon</string>
<string name="action_logout">Log Out</string>
@ -76,6 +80,7 @@
<string name="action_unmute">Unmute</string>
<string name="action_mention">Mention</string>
<string name="toggle_nsfw">NSFW</string>
<string name="action_compose_options">Options</string>
<string name="send_status_to">Share toot URL to…</string>
@ -121,7 +126,8 @@
<string name="pref_title_appearance_settings">Appearance</string>
<string name="pref_title_light_theme">Use the Light Theme</string>
<string name="pref_title_browser_settings">Browser</string>
<string name="pre_title_custom_tabs">Use Chrome Custom Tabs</string>
<string name="pref_title_custom_tabs">Use Chrome Custom Tabs</string>
<string name="pref_title_hide_follow_button">Hide follow button while scrolling</string>
<string name="notification_mention_format">%s mentioned you</string>
<string name="notification_summary_large">%1$s, %2$s, %3$s and %4$d others</string>
@ -129,4 +135,7 @@
<string name="notification_summary_small">%1$s and %2$s</string>
<string name="notification_title_summary">%d new interactions</string>
<string name="description_elephant_friend">Elephant Friend</string>
<string name="description_account_locked">Locked Account</string>
</resources>

@ -11,7 +11,7 @@
<CheckBoxPreference
android:key="fabHide"
android:title="Hide FAB while scrolling"
android:title="@string/pref_title_hide_follow_button"
android:defaultValue="false" />
</PreferenceCategory>

Loading…
Cancel
Save