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

Text format has extra charcters in it

latheesh123 opened this issue · comments

When text is displaying it is showing 21 hrs. ago instead of 21 hrs ago. Is there a way to get rid of " . "

This seems to be a change in the implementation of the underlying DateUtils method in Android. If you see the screenshot I posted in the README, it shows 15 mins ago (I don't remember what API version this was). The same example when I run on API 25 emulator shows 15 min. ago.

I'm guessing Android changed the implementation of DateUtils to add the . after abbreviated words like min and hrs when the flag FORMAT_ABBREV_RELATIVE is used.

If I remove the flag from here, and set it to 0, then I see 15 minutes ago, 3 hours ago etc.

Unfortunately, it is not easy to override the implementation of DateUtils class. I will consider exposing the flags so you can control whether you want to see the abbreviation or not.

For now I don't have any work-around for you, other than to search for hrs. and remove the . manually but this is error-prone.

its occurring for only hrs and min but for days and months its working fine. I am working on emulator with API 27.