Addresses mispronunciation of timestamps like 7m as meters instead of minutes.
This commit is contained in:
parent
77285c9966
commit
69c1b88ff4
1 changed files with 11 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue