Date format: add more comments and fix wrong format kind usage

This commit is contained in:
ganfra 2020-09-07 10:46:46 +02:00 committed by Benoit Marty
parent c6178e504f
commit 18dcd6b9b1
3 changed files with 19 additions and 2 deletions

View File

@ -16,12 +16,29 @@
package im.vector.app.core.date
/* This will represent all kind of available date formats for the app.
We will use the date Sep 7 2020 at 9:30am as an example.
The formatting is depending of the current date.
*/
enum class DateFormatKind {
// Will show date relative and time (today or yesterday or Sep 7 or 09/07/2020 at 9:30am)
DEFAULT_DATE_AND_TIME,
// Will show hour or date relative (9:30am or yesterday or Sep 7 or 09/07/2020)
ROOM_LIST,
// Will show full date (Sep 7 2020)
TIMELINE_DAY_DIVIDER,
// Will show full date and time (Mon, Sep 7 2020, 9:30am)
MESSAGE_DETAIL,
// Will only show time (9:30am)
MESSAGE_SIMPLE,
// Will only show time (9:30am)
EDIT_HISTORY_ROW,
// Will only show date relative (today or yesterday or Sep 7 or 09/07/2020)
EDIT_HISTORY_HEADER
}

View File

@ -83,7 +83,7 @@ class ViewEditHistoryEpoxyController(private val context: Context,
// need to display header with day
genericItemHeader {
id(evDate.hashCode())
text(dateFormatter.format(evDate.timeInMillis, DateFormatKind.EDIT_HISTORY_ROW))
text(dateFormatter.format(evDate.timeInMillis, DateFormatKind.EDIT_HISTORY_HEADER))
}
}
lastDate = evDate

View File

@ -58,7 +58,7 @@ object VectorLocale {
/**
* Init this object
*/
fun init(context: Context, localeProvider: LocaleProvider) {
fun init(context: Context) {
this.context = context
val preferences = PreferenceManager.getDefaultSharedPreferences(context)