mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Using buildString{} inline method to improve readability
This commit is contained in:
parent
3970c2ec31
commit
51fba85a3a
2 changed files with 12 additions and 10 deletions
|
@ -92,13 +92,14 @@ class SessionInfoView @JvmOverloads constructor(
|
|||
private fun appendLearnMoreToVerificationStatus() {
|
||||
val status = views.sessionInfoVerificationStatusDetailTextView.text
|
||||
val learnMore = context.getString(R.string.action_learn_more)
|
||||
val stringBuilder = StringBuilder()
|
||||
stringBuilder.append(status)
|
||||
stringBuilder.append(" ")
|
||||
stringBuilder.append(learnMore)
|
||||
val statusText = buildString {
|
||||
append(status)
|
||||
append(" ")
|
||||
append(learnMore)
|
||||
}
|
||||
|
||||
views.sessionInfoVerificationStatusDetailTextView.setTextWithColoredPart(
|
||||
fullText = stringBuilder.toString(),
|
||||
fullText = statusText,
|
||||
coloredPart = learnMore,
|
||||
underline = false
|
||||
) {
|
||||
|
|
|
@ -65,14 +65,15 @@ class SessionsListHeaderView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
val learnMore = context.getString(R.string.action_learn_more)
|
||||
val stringBuilder = StringBuilder()
|
||||
stringBuilder.append(description)
|
||||
stringBuilder.append(" ")
|
||||
stringBuilder.append(learnMore)
|
||||
val fullDescription = buildString {
|
||||
append(description)
|
||||
append(" ")
|
||||
append(learnMore)
|
||||
}
|
||||
|
||||
binding.sessionsListHeaderDescription.isVisible = true
|
||||
binding.sessionsListHeaderDescription.setTextWithColoredPart(
|
||||
fullText = stringBuilder.toString(),
|
||||
fullText = fullDescription,
|
||||
coloredPart = learnMore,
|
||||
underline = false
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue