Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
0e4b3810
Commit
0e4b3810
authored
Dec 07, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shows mentions with @ symbol
parent
92832192
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
ChatRoomFragmentModule.kt
...chat/rocket/android/chatroom/di/ChatRoomFragmentModule.kt
+0
-2
RoomUiModelMapper.kt
...hat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
+11
-1
RoomViewHolder.kt
...a/chat/rocket/android/chatrooms/adapter/RoomViewHolder.kt
+8
-18
RoomUiModel.kt
...hat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
+1
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/di/ChatRoomFragmentModule.kt
View file @
0e4b3810
...
...
@@ -9,9 +9,7 @@ import chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.db.ChatRoomDao
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.DatabaseManagerFactory
import
chat.rocket.android.db.UserDao
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentUserInteractor
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.SettingsRepository
...
...
app/src/main/java/chat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
View file @
0e4b3810
...
...
@@ -126,8 +126,8 @@ class RoomUiModelMapper(
}
else
{
null
}
val
hasMentions
=
mapMentions
(
userMentions
,
groupMentions
)
val
open
=
open
val
lastMessageMarkdown
=
lastMessage
?.
let
{
Markwon
.
markdown
(
context
,
it
.
toString
()).
toString
()
}
...
...
@@ -139,6 +139,7 @@ class RoomUiModelMapper(
open
=
open
,
date
=
timestamp
,
unread
=
unread
,
mentions
=
hasMentions
,
alert
=
isUnread
,
lastMessage
=
lastMessageMarkdown
,
status
=
status
,
...
...
@@ -203,5 +204,14 @@ class RoomUiModelMapper(
}
}
private
fun
mapMentions
(
userMentions
:
Long
?,
groupMentions
:
Long
?):
Boolean
{
if
(
userMentions
!=
null
&&
groupMentions
!=
null
)
{
if
(
userMentions
>
0
||
groupMentions
>
0
)
{
return
true
}
}
return
false
}
private
fun
mapDate
(
date
:
Long
?):
CharSequence
?
=
date
?.
localDateTime
()
?.
date
(
context
)
}
app/src/main/java/chat/rocket/android/chatrooms/adapter/RoomViewHolder.kt
View file @
0e4b3810
...
...
@@ -49,29 +49,19 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
text_timestamp
.
isInvisible
=
true
}
if
(
room
.
unread
!=
null
)
{
text_total_unread_messages
.
text
=
room
.
unread
if
(
room
.
alert
)
{
if
(
room
.
unread
==
null
)
text_total_unread_messages
.
text
=
"!"
if
(
room
.
unread
!=
null
)
text_total_unread_messages
.
text
=
room
.
unread
if
(
room
.
mentions
)
text_total_unread_messages
.
text
=
"@${room.unread}"
text_timestamp
.
setTextAppearance
(
context
,
R
.
style
.
ChatList_Timestamp_Unread_TextView
)
text_last_message
.
setTextAppearance
(
context
,
R
.
style
.
ChatList_LastMessage_Unread_TextView
)
text_total_unread_messages
.
isVisible
=
true
}
else
{
text_timestamp
.
setTextAppearance
(
context
,
R
.
style
.
ChatList_Timestamp_TextView
)
text_last_message
.
setTextAppearance
(
context
,
R
.
style
.
ChatList_LastMessage_TextView
)
text_total_unread_messages
.
isInvisible
=
true
}
context
?.
let
{
if
(
room
.
alert
||
room
.
unread
!=
null
)
{
text_timestamp
.
setTextAppearance
(
it
,
R
.
style
.
ChatList_Timestamp_Unread_TextView
)
text_last_message
.
setTextAppearance
(
it
,
R
.
style
.
ChatList_LastMessage_Unread_TextView
)
text_total_unread_messages
.
text
=
"!"
text_total_unread_messages
.
isVisible
=
true
}
else
{
text_timestamp
.
setTextAppearance
(
it
,
R
.
style
.
ChatList_Timestamp_TextView
)
text_last_message
.
setTextAppearance
(
it
,
R
.
style
.
ChatList_LastMessage_TextView
)
text_total_unread_messages
.
isInvisible
=
true
}
}
setOnClickListener
{
listener
(
room
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
View file @
0e4b3810
...
...
@@ -12,6 +12,7 @@ data class RoomUiModel(
val
date
:
CharSequence
?
=
null
,
val
unread
:
String
?
=
null
,
val
alert
:
Boolean
=
false
,
val
mentions
:
Boolean
=
false
,
val
lastMessage
:
CharSequence
?
=
null
,
val
status
:
UserStatus
?
=
null
,
val
username
:
String
?
=
null
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment