Cleaned up content descriptions and added the last missing ones. Closes #122

This commit is contained in:
Vavassor 2017-04-12 21:54:37 -04:00
parent ea7f666062
commit 3bf84f9b7d
5 changed files with 40 additions and 16 deletions

View file

@ -26,7 +26,9 @@ import android.os.Bundle;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
@ -314,6 +316,23 @@ public class MainActivity extends BaseActivity {
private void setupSearchView() { private void setupSearchView() {
searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout()); searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());
// Setup content descriptions for the different elements in the search view.
final View leftAction = searchView.findViewById(R.id.left_action);
leftAction.setContentDescription(getString(R.string.action_open_drawer));
searchView.setOnFocusChangeListener(new FloatingSearchView.OnFocusChangeListener() {
@Override
public void onFocus() {
leftAction.setContentDescription(getString(R.string.action_close));
}
@Override
public void onFocusCleared() {
leftAction.setContentDescription(getString(R.string.action_open_drawer));
}
});
View clearButton = searchView.findViewById(R.id.clear_btn);
clearButton.setContentDescription(getString(R.string.action_clear));
searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() { searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
@Override @Override
public void onSearchTextChanged(String oldQuery, String newQuery) { public void onSearchTextChanged(String oldQuery, String newQuery) {

View file

@ -203,7 +203,7 @@ public class TimelineFragment extends SFragment implements
} }
private boolean followButtonPresent() { private boolean followButtonPresent() {
return kind != Kind.TAG && kind != Kind.FAVOURITES; return kind != Kind.TAG && kind != Kind.FAVOURITES && kind != Kind.USER;
} }
private void jumpToTop() { private void jumpToTop() {

View file

@ -25,7 +25,7 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:tint="?attr/colorAccent" android:tint="?attr/colorAccent"
android:contentDescription="@string/action_follow" /> android:contentDescription="@null" />
<TextView <TextView
android:id="@+id/notification_text" android:id="@+id/notification_text"
@ -52,7 +52,7 @@
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:contentDescription="@null" /> android:contentDescription="@string/action_view_profile" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -5,8 +5,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:id="@+id/status_container" android:id="@+id/status_container">
android:contentDescription="@string/action_view_thread">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -104,7 +103,8 @@
android:layout_toRightOf="@+id/status_avatar" android:layout_toRightOf="@+id/status_avatar"
android:layout_toEndOf="@+id/status_avatar" android:layout_toEndOf="@+id/status_avatar"
android:layout_below="@+id/status_name_bar" android:layout_below="@+id/status_name_bar"
android:layout_marginBottom="4dp"> android:layout_marginBottom="4dp"
android:focusable="true">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -112,7 +112,7 @@
android:id="@+id/status_content_warning_description" android:id="@+id/status_content_warning_description"
android:text="Hello world" android:text="Hello world"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:paddingRight="8dp"/> android:paddingRight="8dp" />
<ToggleButton <ToggleButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -137,7 +137,8 @@
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:layout_toRightOf="@+id/status_avatar" android:layout_toRightOf="@+id/status_avatar"
android:layout_toEndOf="@+id/status_avatar" android:layout_toEndOf="@+id/status_avatar"
android:layout_below="@+id/status_content_warning_bar" /> android:layout_below="@+id/status_content_warning_bar"
android:focusable="true" />
<FrameLayout <FrameLayout
android:id="@+id/status_media_preview_container" android:id="@+id/status_media_preview_container"
@ -165,7 +166,7 @@
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin" android:layout_marginTop="@dimen/status_media_preview_top_margin"
android:contentDescription="@null" /> android:contentDescription="@string/action_view_media" />
<ImageView <ImageView
android:id="@+id/status_media_preview_1" android:id="@+id/status_media_preview_1"
@ -175,7 +176,7 @@
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:layout_marginTop="@dimen/status_media_preview_top_margin" android:layout_marginTop="@dimen/status_media_preview_top_margin"
android:contentDescription="@null" /> android:contentDescription="@string/action_view_media" />
</LinearLayout> </LinearLayout>
@ -192,7 +193,7 @@
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:contentDescription="@null" /> android:contentDescription="@string/action_view_media" />
<ImageView <ImageView
android:id="@+id/status_media_preview_3" android:id="@+id/status_media_preview_3"
@ -201,7 +202,7 @@
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_weight="1" android:layout_weight="1"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:contentDescription="@null" /> android:contentDescription="@string/action_view_media" />
</LinearLayout> </LinearLayout>

View file

@ -20,6 +20,7 @@
<string name="title_notifications">Notifications</string> <string name="title_notifications">Notifications</string>
<string name="title_public_local">Local</string> <string name="title_public_local">Local</string>
<string name="title_public_federated">Federated</string> <string name="title_public_federated">Federated</string>
<string name="title_compose">Compose</string>
<string name="title_thread">Thread</string> <string name="title_thread">Thread</string>
<string name="title_tag">#%s</string> <string name="title_tag">#%s</string>
<string name="title_statuses">Posts</string> <string name="title_statuses">Posts</string>
@ -72,7 +73,8 @@
<string name="action_view_preferences">Preferences</string> <string name="action_view_preferences">Preferences</string>
<string name="action_view_favourites">Favourites</string> <string name="action_view_favourites">Favourites</string>
<string name="action_view_blocks">Blocked users</string> <string name="action_view_blocks">Blocked users</string>
<string name="action_view_thread">View thread</string> <string name="action_view_thread">Thread</string>
<string name="action_view_media">Media</string>
<string name="action_open_in_web">Open in browser</string> <string name="action_open_in_web">Open in browser</string>
<string name="action_submit">Submit</string> <string name="action_submit">Submit</string>
<string name="action_photo_pick">Add media</string> <string name="action_photo_pick">Add media</string>
@ -82,6 +84,8 @@
<string name="action_mention">Mention</string> <string name="action_mention">Mention</string>
<string name="toggle_nsfw">NSFW</string> <string name="toggle_nsfw">NSFW</string>
<string name="action_compose_options">Options</string> <string name="action_compose_options">Options</string>
<string name="action_open_drawer">Open drawer</string>
<string name="action_clear">Clear</string>
<string name="send_status_to">Share toot URL to…</string> <string name="send_status_to">Share toot URL to…</string>
@ -108,9 +112,9 @@
<string name="dialog_title_finishing_media_upload">Finishing Media Upload</string> <string name="dialog_title_finishing_media_upload">Finishing Media Upload</string>
<string name="dialog_message_uploading_media">Uploading…</string> <string name="dialog_message_uploading_media">Uploading…</string>
<string name="visibility_public">Everyone can see</string> <string name="visibility_public">Everyone can view</string>
<string name="visibility_unlisted">Everyone can see, but not on public timelines</string> <string name="visibility_unlisted">Everyone can view, but not on public timelines</string>
<string name="visibility_private">Only followers and mentions can see</string> <string name="visibility_private">Only followers and mentions can view</string>
<string name="pref_title_notification_settings">Notifications</string> <string name="pref_title_notification_settings">Notifications</string>
<string name="pref_title_edit_notification_settings">Edit Notifications</string> <string name="pref_title_edit_notification_settings">Edit Notifications</string>