formatMsgTime

open fun formatMsgTime(msgTimeStamp: Long, isChatList: Boolean): String

格式化消息时间 会话列表时间日期显示逻辑: 1.同一天,使用时分显示,如23:22 2.昨天,统一显示为昨天 3.昨天之前,但是在同一周(周一~周日算同一周),显示为:周X,如周三 4.昨天之前,不在同一周,显示为月/日,如04/08 5.不同年,显示为年/月/日,如19/04/08 type = 2,消息窗口时间日期显示逻辑: 规则同上,2,3,4,5都需要加上" 时分"

Parameters

msgTimeStamp

消息时间戳,毫秒级

isChatList

是否为会话列表


open fun formatMsgTime(msgTime: Calendar, now: Calendar, isChatList: Boolean): String

根据和now时间的对比,格式化消息时间 格式化消息时间 会话列表时间日期显示逻辑: 1.同一天,使用时分显示,如23:22 2.昨天,统一显示为昨天 3.昨天之前,但是在同一周(周一~周日算同一周),显示为:周X,如周三 4.昨天之前,不在同一周,显示为月/日,如04/08 5.不同年,显示为年/月/日,如19/04/08 type = 2,消息窗口时间日期显示逻辑: 规则同上,2,3,4,5都需要加上" 时分"

Return

格式化后的字符串

Parameters

msgTime

消息时间

now

对比时间戳

isChatList

是否为会话列表