This commit is contained in:
Benoit Marty 2021-02-12 19:02:19 +01:00
parent f378d46c9a
commit 624541af1c
4 changed files with 5 additions and 12 deletions

View file

@ -24,7 +24,6 @@ import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.text.toSpannable
import androidx.core.view.isVisible
import androidx.transition.ChangeBounds
import androidx.transition.Fade
import androidx.transition.Transition
@ -143,16 +142,10 @@ class TextComposerView @JvmOverloads constructor(
fun setRoomEncrypted(isEncrypted: Boolean, roomEncryptionTrustLevel: RoomEncryptionTrustLevel?) {
if (isEncrypted) {
views.composerEditText.setHint(R.string.room_message_placeholder)
views.composerShieldImageView.isVisible = true
val shieldRes = when (roomEncryptionTrustLevel) {
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
else -> R.drawable.ic_shield_black
}
views.composerShieldImageView.setImageResource(shieldRes)
views.composerShieldImageView.render(roomEncryptionTrustLevel)
} else {
views.composerEditText.setHint(R.string.room_message_placeholder)
views.composerShieldImageView.isVisible = false
views.composerShieldImageView.render(null)
}
}
}

View file

@ -97,7 +97,7 @@
android:src="@drawable/ic_attachment"
tools:ignore="MissingConstraints" />
<ImageView
<im.vector.app.core.ui.views.ShieldImageView
android:id="@+id/composerShieldImageView"
android:layout_width="0dp"
android:layout_height="0dp"

View file

@ -120,7 +120,7 @@
app:layout_constraintTop_toTopOf="@id/sendButton"
tools:ignore="MissingPrefix" />
<ImageView
<im.vector.app.core.ui.views.ShieldImageView
android:id="@+id/composerShieldImageView"
android:layout_width="16dp"
android:layout_height="16dp"

View file

@ -125,7 +125,7 @@
app:layout_constraintTop_toTopOf="@+id/sendButton"
tools:ignore="MissingPrefix" />
<ImageView
<im.vector.app.core.ui.views.ShieldImageView
android:id="@+id/composerShieldImageView"
android:layout_width="16dp"
android:layout_height="16dp"