Code review

This commit is contained in:
Valere 2020-04-14 10:55:21 +02:00
parent c35d854776
commit 1deacfbb34
1 changed files with 5 additions and 9 deletions

View File

@ -167,16 +167,12 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
if (isEncrypted) { if (isEncrypted) {
composerEditText.setHint(R.string.room_message_placeholder_encrypted) composerEditText.setHint(R.string.room_message_placeholder_encrypted)
composerShieldImageView.isVisible = true composerShieldImageView.isVisible = true
val shield = when (roomEncryptionTrustLevel) { val shieldRes = when (roomEncryptionTrustLevel) {
RoomEncryptionTrustLevel.Trusted -> { RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
ContextCompat.getDrawable(context, R.drawable.ic_shield_trusted) RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
} else -> R.drawable.ic_shield_black
RoomEncryptionTrustLevel.Warning -> {
ContextCompat.getDrawable(context, R.drawable.ic_shield_warning)
}
else -> ContextCompat.getDrawable(context, R.drawable.ic_shield_black)
} }
composerShieldImageView.setImageDrawable(shield) composerShieldImageView.setImageDrawable(ContextCompat.getDrawable(context, shieldRes))
} else { } else {
composerEditText.setHint(R.string.room_message_placeholder_not_encrypted) composerEditText.setHint(R.string.room_message_placeholder_not_encrypted)
composerShieldImageView.isVisible = false composerShieldImageView.isVisible = false