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 2024-04-04 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"lastModified": "Last updated 2024-04-04 UTC.",
"confidential": False
}