curioustechizen / android-ago

An Android TextView that always displays an auto refreshing relative time span with respect to a reference time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setReferenceTime get "0 time ago"

ibabuk opened this issue · comments

When I set mReferenceTime lower than currentTimeMillis method getRelativeTimeDisplayString returned "0 time ago"
For example: I have mReferenceTime = 10, and currentTimeMillis = 8. Method getRelativeTimeDisplayString will be return "0 time ago"

Any ideas?

This does not seem right. If mReferenceTime < currentTimeMillis, we display "x minutes ago" etc, else we display "in x minutes" etc.

Can you provide a reproducible test case?

I use this TextView in my chat. When I receive message with mReferenceTime greaten then currentTimeMillis method getRelativeTimeDisplayString returned "0 time ago". It's synchronized time problem on device.

But I found simple solution

textView.setReferenceTime(Math.min(System.currentTimeMillis(), mReferenceTime));

This solved my problem

@archiecrown Ah I see. So I'll close this issue now.