Set content description on message header

pull/170/head
M66B 5 years ago
parent 5462c1a1d6
commit 6f4b3864d0

@ -259,6 +259,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
BottomNavigationView.OnNavigationItemSelectedListener { BottomNavigationView.OnNavigationItemSelectedListener {
private ViewCardOptional card; private ViewCardOptional card;
private View view; private View view;
private View header;
private View vwColor; private View vwColor;
private ImageButton ibExpander; private ImageButton ibExpander;
@ -382,6 +383,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
card = itemView.findViewById(R.id.card); card = itemView.findViewById(R.id.card);
view = itemView.findViewById(R.id.clItem); view = itemView.findViewById(R.id.clItem);
header = itemView.findViewById(R.id.inHeader);
vwColor = itemView.findViewById(R.id.vwColor); vwColor = itemView.findViewById(R.id.vwColor);
ibExpander = itemView.findViewById(R.id.ibExpander); ibExpander = itemView.findViewById(R.id.ibExpander);
@ -733,7 +735,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
private void bindTo(final TupleMessageEx message) { private void bindTo(final TupleMessageEx message, int position) {
boolean inbox = EntityFolder.INBOX.equals(message.folderType); boolean inbox = EntityFolder.INBOX.equals(message.folderType);
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType); boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
boolean outgoing = isOutgoing(message); boolean outgoing = isOutgoing(message);
@ -903,6 +905,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Expand warning // Expand warning
bindExpandWarning(message, expanded); bindExpandWarning(message, expanded);
// Accessibility
header.setContentDescription(context.getString(
R.string.title_accessibility_header,
position,
tvFrom.getText(),
tvTime.getText(),
tvSubject.getText(),
context.getString(message.unseen > 0 ? R.string.title_accessibility_unseen : R.string.title_accessibility_seen),
message.count - message.unflagged > 0 ? context.getString(R.string.title_accessibility_flagged) : ""
));
// Message text preview // Message text preview
int textColor = (contrast ? textColorPrimary : textColorSecondary); int textColor = (contrast ? textColorPrimary : textColorSecondary);
if (tvPreview.getTag() == null || (int) tvPreview.getTag() != textColor) { if (tvPreview.getTag() == null || (int) tvPreview.getTag() != textColor) {
@ -2193,7 +2206,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else { } else {
message.ui_seen = !message.ui_seen; message.ui_seen = !message.ui_seen;
message.unseen = (message.ui_seen ? 0 : message.count); message.unseen = (message.ui_seen ? 0 : message.count);
bindTo(message); bindTo(message, getAdapterPosition());
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", message.id); args.putLong("id", message.id);
@ -4238,7 +4251,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
holder.unwire(); holder.unwire();
holder.bindTo(message); holder.bindTo(message, position);
holder.wire(); holder.wire();
} }

@ -1020,6 +1020,7 @@
<string name="title_widget_unseen">Unread messages only</string> <string name="title_widget_unseen">Unread messages only</string>
<string name="title_widget_flagged">Starred messages only</string> <string name="title_widget_flagged">Starred messages only</string>
<string name="title_accessibility_header" translatable="false">Message %1$d: from %2$s at %3$s %4$s %5$s %6$s</string>
<string name="title_accessibility_collapsed">Collapsed</string> <string name="title_accessibility_collapsed">Collapsed</string>
<string name="title_accessibility_expanded">Expanded</string> <string name="title_accessibility_expanded">Expanded</string>
<string name="title_accessibility_seen">Read</string> <string name="title_accessibility_seen">Read</string>

Loading…
Cancel
Save