You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wanting to show ETAs that will commonly be less than 60 minutes but may occasionally be up to 120 minutes. In the case that the ETA is 60 minutes or less, the ETA text of my RelativeTextView updates every minute. In the case where an ETA is greater than 60 minutes, the ETA text updates every hour. However, I need the ETA to update every minute regardless of the difference between now and the reference time.
Current interval logic:
if (difference > DateUtils.WEEK_IN_MILLIS) {
interval = DateUtils.WEEK_IN_MILLIS;
} else if (difference > DateUtils.DAY_IN_MILLIS) {
interval = DateUtils.DAY_IN_MILLIS;
} else if (difference > DateUtils.HOUR_IN_MILLIS) {
interval = DateUtils.HOUR_IN_MILLIS;
}
I think it would be helpful to add the ability to modify the time update interval. This could be achieved in a couple ways.
A) Add a public setter to set and override the time interval.
B) Allow subclasses to override the method that determines the interval.
I prefer option B as it provides more flexibility to the client.
@curioustechizen What are your thoughts on adding the ability to modify the time update interval?
The text was updated successfully, but these errors were encountered:
@ryandt For now, you can override the getRelativeTimeDisplayString() method and there use your own logic to determine the update interval.
However, I'm not happy about the flexibility (or lack of it) in this library. The default algorithm to calculate the update interval does not fit all use cases.
I'm open to suggestions about an elegant way to expose the update interval as an API.
I'm wanting to show ETAs that will commonly be less than 60 minutes but may occasionally be up to 120 minutes. In the case that the ETA is 60 minutes or less, the ETA text of my
RelativeTextView
updates every minute. In the case where an ETA is greater than 60 minutes, the ETA text updates every hour. However, I need the ETA to update every minute regardless of the difference betweennow
and the reference time.Current interval logic:
I think it would be helpful to add the ability to modify the time update interval. This could be achieved in a couple ways.
A) Add a public setter to set and override the time interval.
B) Allow subclasses to override the method that determines the interval.
I prefer option B as it provides more flexibility to the client.
@curioustechizen What are your thoughts on adding the ability to modify the time update interval?
The text was updated successfully, but these errors were encountered: