show "now" instead of "in 0s" timestamps (#2843)
* Add roundoff threshold for "now" (new string resource) output in getRelativeTimeSpanString * added tests * added string resource translation for `status_created_at_now` in DE, ES, JA * fixed ktlint issues * use resource file in test, linting passes * 501ms and 999ms now show "now" instead of "0s"
This commit is contained in:
parent
330401c7d0
commit
86e5c92a05
6 changed files with 37 additions and 1 deletions
|
@ -34,7 +34,10 @@ public class TimestampUtils {
|
|||
public static String getRelativeTimeSpanString(Context context, long then, long now) {
|
||||
long span = now - then;
|
||||
boolean future = false;
|
||||
if (span < 0) {
|
||||
if (Math.abs(span) < SECOND_IN_MILLIS) {
|
||||
return context.getString(R.string.status_created_at_now);
|
||||
}
|
||||
else if (span < 0) {
|
||||
future = true;
|
||||
span = -span;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue