From 9663d8046c1b9e17e19f90b83d99145d555306ef Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Thu, 17 Sep 2020 11:57:33 +0200 Subject: [PATCH] Revert "Overview: display the year instead of the weekday for old chats" This reverts commit 5e4d9c18be0630680d16b8fe1caf7da047a2c067. --- .../java/im/vector/app/core/date/VectorDateFormatter.kt | 8 -------- .../app/features/home/room/list/RoomSummaryItemFactory.kt | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/date/VectorDateFormatter.kt b/vector/src/main/java/im/vector/app/core/date/VectorDateFormatter.kt index b90332212a..02050b0a56 100644 --- a/vector/src/main/java/im/vector/app/core/date/VectorDateFormatter.kt +++ b/vector/src/main/java/im/vector/app/core/date/VectorDateFormatter.kt @@ -51,10 +51,6 @@ class VectorDateFormatter @Inject constructor(private val context: Context, DateTimeFormatter.ofPattern(DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE d MMM")) } - private val messageDayWithYearFormatter by lazy { - DateTimeFormatter.ofPattern(DateFormat.getBestDateTimePattern(localeProvider.current(), "d MMM YYYY")) - } - fun formatMessageHour(localDateTime: LocalDateTime): String { return messageHourFormatter.format(localDateTime) } @@ -63,10 +59,6 @@ class VectorDateFormatter @Inject constructor(private val context: Context, return messageDayFormatter.format(localDateTime) } - fun formatMessageDayWithYear(localDateTime: LocalDateTime): String { - return messageDayWithYearFormatter.format(localDateTime) - } - /** * Formats a localized relative date time for the last 2 days, e.g, "Today, HH:MM", "Yesterday, HH:MM" or * "2 days ago, HH:MM". diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index 370a3877ef..da58748dea 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -90,14 +90,11 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor val date = latestEvent.root.localDateTime() val currentDate = DateProvider.currentLocalDateTime() val isSameDay = date.toLocalDate() == currentDate.toLocalDate() - val withinOneYear = currentDate.minusYears(1).isBefore(date) latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect.not()) latestEventTime = if (isSameDay) { dateFormatter.formatMessageHour(date) - } else if (withinOneYear) { - dateFormatter.formatMessageDay(date) } else { - dateFormatter.formatMessageDayWithYear(date) + dateFormatter.formatMessageDay(date) } } val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers)