Fix crash (regression on develop) on the VerificationVectorAlert

And format code
This commit is contained in:
Benoit Marty 2021-06-16 16:45:50 +02:00
parent f313fbe88c
commit 58cd2aac13
3 changed files with 10 additions and 12 deletions

View File

@ -40,8 +40,7 @@ class IncomingCallAlert(uid: String,
private val avatarRenderer: AvatarRenderer,
private val isVideoCall: Boolean,
private val onAccept: () -> Unit,
private val onReject: () -> Unit)
: VectorAlert.ViewBinder {
private val onReject: () -> Unit) : VectorAlert.ViewBinder {
override fun bind(view: View) {
val (callKindText, callKindIcon) = if (isVideoCall) {

View File

@ -33,14 +33,11 @@ class VerificationVectorAlert(uid: String,
* Alert are displayed by default, but let this lambda return false to prevent displaying
*/
override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true }
) : DefaultVectorAlert(
uid, title, description, iconId, shouldBeDisplayedIn
) {
) : DefaultVectorAlert(uid, title, description, iconId, shouldBeDisplayedIn) {
override val layoutRes = R.layout.alerter_verification_layout
class ViewBinder(private val matrixItem: MatrixItem?,
private val avatarRenderer: AvatarRenderer)
: VectorAlert.ViewBinder {
private val avatarRenderer: AvatarRenderer) : VectorAlert.ViewBinder {
override fun bind(view: View) {
view.findViewById<ImageView>(R.id.ivUserAvatar)?.let { imageView ->

View File

@ -5,8 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
tools:background="@android:color/darker_gray"
tools:foreground="?android:attr/selectableItemBackground"
tools:background="?colorPrimary"
tools:style="@style/AlertStyle">
<ImageView
@ -20,7 +19,8 @@
app:layout_constraintTop_toTopOf="parent"
tools:src="@sample/user_round_avatars" />
<ImageView
<!-- Note: this is handled by the Alerter library, it has to be a AppCompatImageView -->
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivIcon"
android:layout_width="24dp"
android:layout_height="24dp"
@ -42,7 +42,8 @@
app:layout_constraintStart_toEndOf="@id/ivUserAvatar"
app:layout_constraintTop_toTopOf="parent">
<TextView
<!-- Note: this is handled by the Alerter library, it has to be a AppCompatTextView -->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvTitle"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="wrap_content"
@ -56,7 +57,8 @@
tools:text="Title"
tools:visibility="visible" />
<TextView
<!-- Note: this is handled by the Alerter library, it has to be a AppCompatTextView -->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvText"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="wrap_content"