From fbff8d6408984db70e5a704e30fde34bbc0cc725 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Fri, 2 Sep 2022 15:07:58 +0200 Subject: [PATCH] Use a different date format when device is inactive --- vector/src/main/java/im/vector/app/core/date/DateFormatKind.kt | 2 +- .../settings/devices/v2/list/OtherSessionsController.kt | 3 ++- 2 files changed, 3 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 b08a1dc725..a66066ac8b 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 @@ -27,7 +27,7 @@ enum class DateFormatKind { // 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) + // Will show full date (Sep 7, 2020) TIMELINE_DAY_DIVIDER, // Will show full date and time (Mon, Sep 7 2020, 9:30am) diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsController.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsController.kt index 817878cf0f..c992505e37 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsController.kt @@ -43,7 +43,8 @@ class OtherSessionsController @Inject constructor( } } else { data.take(NUMBER_OF_OTHER_DEVICES_TO_RENDER).forEach { device -> - val formattedLastActivityDate = host.dateFormatter.format(device.deviceInfo.lastSeenTs, DateFormatKind.DEFAULT_DATE_AND_TIME) + val dateFormatKind = if (device.isInactive) DateFormatKind.TIMELINE_DAY_DIVIDER else DateFormatKind.DEFAULT_DATE_AND_TIME + val formattedLastActivityDate = host.dateFormatter.format(device.deviceInfo.lastSeenTs, dateFormatKind) val description = if (device.isInactive) { stringProvider.getQuantityString( R.plurals.device_manager_other_sessions_description_inactive,