forked from upstream-mirrors/quik
Only show delivered indicator if it's less than 10 mins old
This commit is contained in:
@@ -33,7 +33,7 @@ class DateFormatter @Inject constructor(val context: Context) {
|
||||
now.isSameDay(then) -> getFormatter("h:mm a")
|
||||
now.isSameWeek(then) -> getFormatter("E h:mm a")
|
||||
now.isSameYear(then) -> getFormatter("MMM d, h:mm a")
|
||||
else -> getFormatter("MMMM d yyyy, h:mm a")
|
||||
else -> getFormatter("MMM d yyyy, h:mm a")
|
||||
}.format(date)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class MessagesAdapter @Inject constructor(
|
||||
|
||||
companion object {
|
||||
private val VIEWTYPE_ME = -1
|
||||
private val TIMESTAMP_THRESHOLD = 60
|
||||
private val TIMESTAMP_THRESHOLD = 10
|
||||
}
|
||||
|
||||
val longClicks: Subject<Message> = PublishSubject.create<Message>()
|
||||
@@ -84,9 +84,11 @@ class MessagesAdapter @Inject constructor(
|
||||
|
||||
bindGrouping(view, position)
|
||||
|
||||
val age = TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - message.date)
|
||||
|
||||
view.status?.text = when {
|
||||
message.isSending() -> context.getString(R.string.message_status_sending)
|
||||
message.isDelivered() -> context.getString(R.string.message_status_delivered)
|
||||
message.isDelivered() && age <= TIMESTAMP_THRESHOLD -> context.getString(R.string.message_status_delivered)
|
||||
message.isFailedMessage() -> context.getString(R.string.message_status_failed)
|
||||
else -> null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user