From 18dcd6b9b1d11183f004298ad53e5e1666b0cb98 Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 7 Sep 2020 10:46:46 +0200 Subject: [PATCH] Date format: add more comments and fix wrong format kind usage --- .../im/vector/app/core/date/DateFormatKind.kt | 17 +++++++++++++++++ .../ViewEditHistoryEpoxyController.kt | 2 +- .../app/features/settings/VectorLocale.kt | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/date/DateFormatKind.kt b/vector/src/main/java/im/vector/app/core/date/DateFormatKind.kt index 3828b13089..b08a1dc725 100644 --- a/vector/src/main/java/im/vector/app/core/date/DateFormatKind.kt +++ b/vector/src/main/java/im/vector/app/core/date/DateFormatKind.kt @@ -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 } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt index 65ecdfa430..c82dd70e54 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryEpoxyController.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt b/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt index d0e4af4b97..45667c1f77 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt @@ -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)