Revert "Overview: display the year instead of the weekday for old chats"

This reverts commit 5e4d9c18be0630680d16b8fe1caf7da047a2c067.
This commit is contained in:
SpiritCroc 2020-09-17 11:57:33 +02:00
parent f217ece630
commit 9663d8046c
2 changed files with 1 additions and 12 deletions

View File

@ -51,10 +51,6 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
DateTimeFormatter.ofPattern(DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE d MMM")) 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 { fun formatMessageHour(localDateTime: LocalDateTime): String {
return messageHourFormatter.format(localDateTime) return messageHourFormatter.format(localDateTime)
} }
@ -63,10 +59,6 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
return messageDayFormatter.format(localDateTime) 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 * 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". * "2 days ago, HH:MM".

View File

@ -90,14 +90,11 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
val date = latestEvent.root.localDateTime() val date = latestEvent.root.localDateTime()
val currentDate = DateProvider.currentLocalDateTime() val currentDate = DateProvider.currentLocalDateTime()
val isSameDay = date.toLocalDate() == currentDate.toLocalDate() val isSameDay = date.toLocalDate() == currentDate.toLocalDate()
val withinOneYear = currentDate.minusYears(1).isBefore(date)
latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect.not()) latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect.not())
latestEventTime = if (isSameDay) { latestEventTime = if (isSameDay) {
dateFormatter.formatMessageHour(date) dateFormatter.formatMessageHour(date)
} else if (withinOneYear) {
dateFormatter.formatMessageDay(date)
} else { } else {
dateFormatter.formatMessageDayWithYear(date) dateFormatter.formatMessageDay(date)
} }
} }
val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers) val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers)