Stay organized with collections Save and categorize content based on your preferences. DateSorter
open class DateSorter
Sorts dates into the following groups: Today Yesterday seven days ago one month ago older than a month ago
Summary
| Constants |
| static Int | must be >= 3 |
Constants
DAY_COUNT
static val DAY_COUNT: Int
must be >= 3
Value: 5
Public constructors
DateSorter
DateSorter(context: Context!)
| Parameters |
context | Context!: Application context |
Public methods
getBoundary
open fun getBoundary(index: Int): Long
| Parameters |
index | Int: date bin index as returned by getIndex() |
| Return |
Long | date boundary at given index |
getIndex
open fun getIndex(time: Long): Int
| Parameters |
time | Long: time since the Epoch in milliseconds, such as that returned by Calendar.getTimeInMillis() |
| Return |
Int | an index from 0 to (DAY_COUNT - 1) that identifies which date bin this date belongs to |
getLabel
open fun getLabel(index: Int): String!
| Parameters |
index | Int: date bin index as returned by getIndex() |
| Return |
String! | string label suitable for display to user |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]