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
df089349
Commit
df089349
authored
Oct 18, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show last message on chats list with stripped markdown syntax
parent
71410e16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
RoomViewHolder.kt
...a/chat/rocket/android/chatrooms/adapter/RoomViewHolder.kt
+2
-1
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+2
-1
No files found.
app/src/main/java/chat/rocket/android/chatrooms/adapter/RoomViewHolder.kt
View file @
df089349
...
@@ -11,6 +11,7 @@ import chat.rocket.common.model.RoomType
...
@@ -11,6 +11,7 @@ import chat.rocket.common.model.RoomType
import
chat.rocket.common.model.UserStatus
import
chat.rocket.common.model.UserStatus
import
kotlinx.android.synthetic.main.item_chat.view.*
import
kotlinx.android.synthetic.main.item_chat.view.*
import
kotlinx.android.synthetic.main.unread_messages_badge.view.*
import
kotlinx.android.synthetic.main.unread_messages_badge.view.*
import
ru.noties.markwon.Markwon
class
RoomViewHolder
(
itemView
:
View
,
private
val
listener
:
(
RoomUiModel
)
->
Unit
)
:
ViewHolder
<
RoomItemHolder
>(
itemView
)
{
class
RoomViewHolder
(
itemView
:
View
,
private
val
listener
:
(
RoomUiModel
)
->
Unit
)
:
ViewHolder
<
RoomItemHolder
>(
itemView
)
{
...
@@ -32,7 +33,7 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
...
@@ -32,7 +33,7 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
if
(
room
.
lastMessage
!=
null
)
{
if
(
room
.
lastMessage
!=
null
)
{
text_last_message
.
isVisible
=
true
text_last_message
.
isVisible
=
true
text_last_message
.
text
=
room
.
lastMessage
text_last_message
.
text
=
Markwon
.
markdown
(
context
,
room
.
lastMessage
.
toString
()).
toString
()
}
else
{
}
else
{
text_last_message
.
isGone
=
true
text_last_message
.
isGone
=
true
}
}
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
df089349
...
@@ -115,6 +115,7 @@ class MessageParser @Inject constructor(
...
@@ -115,6 +115,7 @@ class MessageParser @Inject constructor(
}
}
class
StrongEmphasisVisitor
:
AbstractVisitor
()
{
class
StrongEmphasisVisitor
:
AbstractVisitor
()
{
override
fun
visit
(
strongEmphasis
:
StrongEmphasis
)
{
override
fun
visit
(
strongEmphasis
:
StrongEmphasis
)
{
if
(
strongEmphasis
.
openingDelimiter
==
"__"
&&
strongEmphasis
.
firstChild
!=
null
)
{
if
(
strongEmphasis
.
openingDelimiter
==
"__"
&&
strongEmphasis
.
firstChild
!=
null
)
{
val
child
=
strongEmphasis
.
firstChild
val
child
=
strongEmphasis
.
firstChild
...
@@ -145,7 +146,7 @@ class MessageParser @Inject constructor(
...
@@ -145,7 +146,7 @@ class MessageParser @Inject constructor(
var
offset
=
0
var
offset
=
0
mentions
.
forEach
{
mentions
.
forEach
{
val
mentionMe
=
it
==
currentUser
||
it
==
"@all"
||
it
==
"@here"
val
mentionMe
=
it
==
"@$currentUser"
||
it
==
"@all"
||
it
==
"@here"
offset
=
text
.
indexOf
(
string
=
it
,
startIndex
=
offset
,
ignoreCase
=
false
)
offset
=
text
.
indexOf
(
string
=
it
,
startIndex
=
offset
,
ignoreCase
=
false
)
while
(
offset
>
-
1
)
{
while
(
offset
>
-
1
)
{
val
textColor
=
if
(
mentionMe
)
myselfTextColor
else
othersTextColor
val
textColor
=
if
(
mentionMe
)
myselfTextColor
else
othersTextColor
...
...
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