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
2731b019
Commit
2731b019
authored
Feb 06, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactoring
parent
80923948
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
MessageViewModel.kt
...hat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
+18
-14
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/MessageViewModel.kt
View file @
2731b019
...
...
@@ -178,25 +178,29 @@ data class MessageViewModel(val context: Context,
spannableMsg
.
setSpan
(
StyleSpan
(
Typeface
.
BOLD_ITALIC
),
messageTextStartIndex
,
messageTextEndIndex
,
0
)
}
}
else
{
spannableMsg
.
apply
{
var
header
=
"\n$attachmentMessageAuthor ${getTime(attachmentTimestamp!!)}\n"
}
else
if
(
attachmentType
==
AttachmentType
.
Message
)
{
spannableMsg
.
append
(
quoteMessage
(
attachmentMessageAuthor
!!
,
attachmentMessageText
!!
,
attachmentTimestamp
!!
))
}
return
spannableMsg
}
private
fun
quoteMessage
(
author
:
String
,
text
:
String
,
timestamp
:
Long
):
CharSequence
{
return
SpannableStringBuilder
().
apply
{
val
header
=
"\n$author ${getTime(timestamp)}\n"
append
(
SpannableString
(
header
).
apply
{
setSpan
(
StyleSpan
(
Typeface
.
BOLD
),
1
,
attachmentMessageAuthor
!!
.
length
+
1
,
0
)
setSpan
(
StyleSpan
(
Typeface
.
BOLD
),
1
,
author
.
length
+
1
,
0
)
setSpan
(
MessageParser
.
QuoteMarginSpan
(
context
.
getDrawable
(
R
.
drawable
.
quote
),
10
),
1
,
length
,
0
)
setSpan
(
AbsoluteSizeSpan
(
context
.
resources
.
getDimensionPixelSize
(
R
.
dimen
.
message_time_text_size
)),
attachmentMessageAuthor
!!
.
length
+
1
,
length
,
0
)
author
.
length
+
1
,
length
,
0
)
})
append
(
SpannableString
(
parser
.
renderMarkdown
(
attachmentMessageText
!!
)).
apply
{
append
(
SpannableString
(
parser
.
renderMarkdown
(
text
)).
apply
{
setSpan
(
MessageParser
.
QuoteMarginSpan
(
context
.
getDrawable
(
R
.
drawable
.
quote
),
10
),
0
,
length
,
0
)
})
}
}
return
spannableMsg
}
private
fun
attachmentUrl
(
url
:
String
):
String
{
var
response
=
url
val
httpUrl
=
HttpUrl
.
parse
(
url
)
...
...
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