mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +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) {
|
||||
val type = individualHashMap["type"]
|
||||
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email" ||
|
||||
type == "circle"
|
||||
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email"
|
||||
) {
|
||||
resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
||||
} else if (type == "geo-location") {
|
||||
|
@ -144,7 +144,20 @@ class MessageUtils(val context: Context) {
|
||||
}
|
||||
}
|
||||
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 replacementText = individualHashMap["name"]
|
||||
var start = spannable.indexOf(placeholder)
|
||||
@ -154,18 +167,12 @@ class MessageUtils(val context: Context) {
|
||||
spannable.setSpan(
|
||||
StyleSpan(Typeface.BOLD),
|
||||
start,
|
||||
start + replacementText!!
|
||||
.length,
|
||||
start + replacementText!!.length,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
start = spannable.indexOf(placeholder, start + replacementText.length)
|
||||
}
|
||||
messageStringInternal = spannable
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return messageStringInternal
|
||||
return spannable
|
||||
}
|
||||
|
||||
fun getRenderedMarkdownText(context: Context, markdown: String, textColor: Int): Spanned {
|
||||
|
Loading…
Reference in New Issue
Block a user