mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
fix detekt
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
f418955e1d
commit
edcadbcd37
@ -29,8 +29,7 @@ class ChatUtils {
|
|||||||
|
|
||||||
if (individualHashMap != null) {
|
if (individualHashMap != null) {
|
||||||
val type = individualHashMap["type"]
|
val type = individualHashMap["type"]
|
||||||
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email" ||
|
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email"
|
||||||
type == "circle"
|
|
||||||
) {
|
) {
|
||||||
resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
||||||
} else if (type == "geo-location") {
|
} else if (type == "geo-location") {
|
||||||
|
@ -144,7 +144,20 @@ class MessageUtils(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val spannable = SpannableStringBuilder(messageStringInternal)
|
messageStringInternal = defaultMessageParameters(messageStringInternal, individualHashMap, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return messageStringInternal
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun defaultMessageParameters(
|
||||||
|
messageString: Spanned,
|
||||||
|
individualHashMap: HashMap<String?, String?>,
|
||||||
|
key: String?
|
||||||
|
):Spanned {
|
||||||
|
val spannable = SpannableStringBuilder(messageString)
|
||||||
val placeholder = "{$key}"
|
val placeholder = "{$key}"
|
||||||
val replacementText = individualHashMap["name"]
|
val replacementText = individualHashMap["name"]
|
||||||
var start = spannable.indexOf(placeholder)
|
var start = spannable.indexOf(placeholder)
|
||||||
@ -154,18 +167,12 @@ class MessageUtils(val context: Context) {
|
|||||||
spannable.setSpan(
|
spannable.setSpan(
|
||||||
StyleSpan(Typeface.BOLD),
|
StyleSpan(Typeface.BOLD),
|
||||||
start,
|
start,
|
||||||
start + replacementText!!
|
start + replacementText!!.length,
|
||||||
.length,
|
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
)
|
)
|
||||||
start = spannable.indexOf(placeholder, start + replacementText.length)
|
start = spannable.indexOf(placeholder, start + replacementText.length)
|
||||||
}
|
}
|
||||||
messageStringInternal = spannable
|
return spannable
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return messageStringInternal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRenderedMarkdownText(context: Context, markdown: String, textColor: Int): Spanned {
|
fun getRenderedMarkdownText(context: Context, markdown: String, textColor: Int): Spanned {
|
||||||
|
Loading…
Reference in New Issue
Block a user