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
Show 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
...
@@ -9,9 +9,7 @@ import chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.db.ChatRoomDao
import
chat.rocket.android.db.ChatRoomDao
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.DatabaseManagerFactory
import
chat.rocket.android.db.UserDao
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.GetCurrentUserInteractor
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.SettingsRepository
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(
...
@@ -126,8 +126,8 @@ class RoomUiModelMapper(
}
else
{
}
else
{
null
null
}
}
val
hasMentions
=
mapMentions
(
userMentions
,
groupMentions
)
val
open
=
open
val
open
=
open
val
lastMessageMarkdown
=
val
lastMessageMarkdown
=
lastMessage
?.
let
{
Markwon
.
markdown
(
context
,
it
.
toString
()).
toString
()
}
lastMessage
?.
let
{
Markwon
.
markdown
(
context
,
it
.
toString
()).
toString
()
}
...
@@ -139,6 +139,7 @@ class RoomUiModelMapper(
...
@@ -139,6 +139,7 @@ class RoomUiModelMapper(
open
=
open
,
open
=
open
,
date
=
timestamp
,
date
=
timestamp
,
unread
=
unread
,
unread
=
unread
,
mentions
=
hasMentions
,
alert
=
isUnread
,
alert
=
isUnread
,
lastMessage
=
lastMessageMarkdown
,
lastMessage
=
lastMessageMarkdown
,
status
=
status
,
status
=
status
,
...
@@ -203,5 +204,14 @@ class RoomUiModelMapper(
...
@@ -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
)
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
...
@@ -49,29 +49,19 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
text_timestamp
.
isInvisible
=
true
text_timestamp
.
isInvisible
=
true
}
}
if
(
room
.
unread
!=
null
)
{
if
(
room
.
alert
)
{
text_total_unread_messages
.
text
=
room
.
unread
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
text_total_unread_messages
.
isVisible
=
true
}
else
{
}
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
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
)
}
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(
...
@@ -12,6 +12,7 @@ data class RoomUiModel(
val
date
:
CharSequence
?
=
null
,
val
date
:
CharSequence
?
=
null
,
val
unread
:
String
?
=
null
,
val
unread
:
String
?
=
null
,
val
alert
:
Boolean
=
false
,
val
alert
:
Boolean
=
false
,
val
mentions
:
Boolean
=
false
,
val
lastMessage
:
CharSequence
?
=
null
,
val
lastMessage
:
CharSequence
?
=
null
,
val
status
:
UserStatus
?
=
null
,
val
status
:
UserStatus
?
=
null
,
val
username
:
String
?
=
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