From 69c1b88ff405f53d57431e7bed40cf55c214c9c3 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Fri, 14 Apr 2017 20:23:07 -0400 Subject: [PATCH] Addresses mispronunciation of timestamps like 7m as meters instead of minutes. --- .../com/keylesspalace/tusky/StatusViewHolder.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java index 930ec021..9addd656 100644 --- a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java @@ -169,15 +169,25 @@ class StatusViewHolder extends RecyclerView.ViewHolder { } private void setCreatedAt(@Nullable Date createdAt) { + // This is the visible timestamp. String readout; + /* This one is for screen-readers. Frequently, they would mispronounce timestamps like "17m" + * as 17 meters instead of minutes. */ + CharSequence readoutAloud; if (createdAt != null) { long then = createdAt.getTime(); long now = new Date().getTime(); readout = DateUtils.getRelativeTimeSpanString(then, now); + readoutAloud = android.text.format.DateUtils.getRelativeTimeSpanString(then, now, + android.text.format.DateUtils.SECOND_IN_MILLIS, + android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE); } else { - readout = "?m"; // unknown minutes~ + // unknown minutes~ + readout = "?m"; + readoutAloud = "? minutes"; } sinceCreated.setText(readout); + sinceCreated.setContentDescription(readoutAloud); } private void setRebloggedByDisplayName(String name) {