Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
QuasselDroid-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Janne Mareike Koschinski
QuasselDroid-ng
Commits
08dc2bf2
Commit
08dc2bf2
authored
7 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Do not colorize links in highlights
parent
376d447b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/messages/QuasselMessageRenderer.kt
+19
-7
19 additions, 7 deletions
...uasseldroid_ng/ui/chat/messages/QuasselMessageRenderer.kt
with
19 additions
and
7 deletions
app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/messages/QuasselMessageRenderer.kt
+
19
−
7
View file @
08dc2bf2
...
...
@@ -4,6 +4,7 @@ import android.content.Context
import
android.graphics.Typeface
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.TextPaint
import
android.text.style.ForegroundColorSpan
import
android.text.style.StyleSpan
import
android.text.style.URLSpan
...
...
@@ -105,7 +106,7 @@ class QuasselMessageRenderer(
context
.
getString
(
R
.
string
.
message_format_plain
),
formatPrefix
(
message
.
senderPrefixes
,
highlight
),
formatNick
(
message
.
sender
,
self
,
highlight
),
formatContent
(
message
.
content
)
formatContent
(
message
.
content
,
highlight
)
),
message
.
messageId
==
markerLine
)
...
...
@@ -116,7 +117,7 @@ class QuasselMessageRenderer(
context
.
getString
(
R
.
string
.
message_format_action
),
formatPrefix
(
message
.
senderPrefixes
,
highlight
),
formatNick
(
message
.
sender
,
self
,
highlight
),
formatContent
(
message
.
content
)
formatContent
(
message
.
content
,
highlight
)
),
message
.
messageId
==
markerLine
)
...
...
@@ -127,7 +128,7 @@ class QuasselMessageRenderer(
context
.
getString
(
R
.
string
.
message_format_notice
),
formatPrefix
(
message
.
senderPrefixes
,
highlight
),
formatNick
(
message
.
sender
,
self
,
highlight
),
formatContent
(
message
.
content
)
formatContent
(
message
.
content
,
highlight
)
),
message
.
messageId
==
markerLine
)
...
...
@@ -244,13 +245,13 @@ class QuasselMessageRenderer(
Message_Type
.
Error
->
FormattedMessage
(
message
.
messageId
,
timeFormatter
.
format
(
message
.
time
.
atZone
(
zoneId
)),
formatContent
(
message
.
content
),
formatContent
(
message
.
content
,
highlight
),
message
.
messageId
==
markerLine
)
Message_Type
.
Topic
->
FormattedMessage
(
message
.
messageId
,
timeFormatter
.
format
(
message
.
time
.
atZone
(
zoneId
)),
formatContent
(
message
.
content
),
formatContent
(
message
.
content
,
highlight
),
message
.
messageId
==
markerLine
)
else
->
FormattedMessage
(
...
...
@@ -287,7 +288,7 @@ class QuasselMessageRenderer(
RegexOption
.
IGNORE_CASE
)
private
fun
formatContent
(
content
:
String
):
CharSequence
{
private
fun
formatContent
(
content
:
String
,
highlight
:
Boolean
):
CharSequence
{
val
formattedText
=
ircFormatDeserializer
.
formatString
(
content
,
appearanceSettings
.
colorizeMirc
)
val
text
=
SpannableString
(
formattedText
)
...
...
@@ -295,7 +296,8 @@ class QuasselMessageRenderer(
val
group
=
result
.
groups
[
1
]
if
(
group
!=
null
)
{
text
.
setSpan
(
URLSpan
(
group
.
value
),
group
.
range
.
start
,
group
.
range
.
start
+
group
.
value
.
length
,
QuasselURLSpan
(
group
.
value
,
highlight
),
group
.
range
.
start
,
group
.
range
.
start
+
group
.
value
.
length
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
}
...
...
@@ -309,6 +311,16 @@ class QuasselMessageRenderer(
return
text
}
class
QuasselURLSpan
(
text
:
String
,
private
val
highlight
:
Boolean
)
:
URLSpan
(
text
)
{
override
fun
updateDrawState
(
ds
:
TextPaint
?)
{
if
(
ds
!=
null
)
{
if
(!
highlight
)
ds
.
color
=
ds
.
linkColor
ds
.
isUnderlineText
=
true
}
}
}
private
fun
formatNickImpl
(
sender
:
String
,
colorize
:
Boolean
):
CharSequence
{
val
nick
=
IrcUserUtils
.
nick
(
sender
)
val
spannableString
=
SpannableString
(
nick
)
...
...
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