Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
ae0f7726
Commit
ae0f7726
authored
1 year ago
by
Pierre Nicolas
Browse files
Options
Downloads
Patches
Plain Diff
chatview: add hasPermanentDate util method
Change-Id: Ia05166ab28cbb442523cb840fef351c1cc3157c7
parent
7846497f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jami-android/app/src/main/java/cx/ring/adapters/ConversationAdapter.kt
+14
-0
14 additions, 0 deletions
...app/src/main/java/cx/ring/adapters/ConversationAdapter.kt
with
14 additions
and
0 deletions
jami-android/app/src/main/java/cx/ring/adapters/ConversationAdapter.kt
+
14
−
0
View file @
ae0f7726
...
...
@@ -1900,6 +1900,20 @@ class ConversationAdapter(
return
prevMsg
!=
null
&&
msg
.
timestamp
-
prevMsg
.
timestamp
>
10
*
DateUtils
.
MINUTE_IN_MILLIS
}
// Used to show the date between messages.
private
fun
hasPermanentDateString
(
message
:
Interaction
,
position
:
Int
):
Boolean
{
val
previousMessageTimestamp
=
getPreviousInteractionFromPosition
(
position
)
?.
timestamp
?:
return
false
// Create Calendar instances for each timestamp
val
calendar1
=
Calendar
.
getInstance
().
apply
{
timeInMillis
=
message
.
timestamp
}
val
calendar2
=
Calendar
.
getInstance
().
apply
{
timeInMillis
=
previousMessageTimestamp
}
// Compare the year, month, and day of year to check if they are different days
return
calendar1
.
get
(
Calendar
.
YEAR
)
!=
calendar2
.
get
(
Calendar
.
YEAR
)
||
calendar1
.
get
(
Calendar
.
DAY_OF_YEAR
)
!=
calendar2
.
get
(
Calendar
.
DAY_OF_YEAR
)
}
private
enum
class
SequenceType
{
FIRST
,
MIDDLE
,
LAST
,
SINGLE
}
companion
object
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment