mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Merge pull request #719 from hjubb/date_break_improvement
Improve date breaks in messages
This commit is contained in:
commit
ef3d2bb28f
@ -59,6 +59,7 @@ class VisibleMessageView : LinearLayout {
|
||||
const val longPressMovementTreshold = 10.0f // dp
|
||||
const val longPressDurationThreshold = 250L // ms
|
||||
const val maxDoubleTapInterval = 200L
|
||||
const val maxTimeBetweenBreaks = 5 * 60 * 1000L // 5 minutes
|
||||
}
|
||||
|
||||
// region Lifecycle
|
||||
@ -111,7 +112,7 @@ class VisibleMessageView : LinearLayout {
|
||||
senderNameTextView.visibility = View.GONE
|
||||
}
|
||||
// Date break
|
||||
val showDateBreak = (previous == null || !DateUtils.isSameHour(message.timestamp, previous.timestamp))
|
||||
val showDateBreak = (previous == null || message.timestamp - previous.timestamp > maxTimeBetweenBreaks)
|
||||
dateBreakTextView.isVisible = showDateBreak
|
||||
dateBreakTextView.text = if (showDateBreak) DateUtils.getDisplayFormattedTimeSpanString(context, Locale.getDefault(), message.timestamp) else ""
|
||||
// Timestamp
|
||||
|
Loading…
Reference in New Issue
Block a user