diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt index decb9eaad5..e1b703e0fc 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/epoxy/BottomSheetVerificationEmojisItem.kt @@ -18,8 +18,6 @@ package im.vector.app.features.crypto.verification.epoxy import android.content.Context import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute @@ -27,6 +25,7 @@ import com.airbnb.epoxy.EpoxyModelClass import im.vector.app.R import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyModel +import im.vector.app.databinding.ItemEmojiVerifBinding import me.gujun.android.span.Span import me.gujun.android.span.image import me.gujun.android.span.span @@ -68,16 +67,18 @@ abstract class BottomSheetVerificationEmojisItem : VectorEpoxyModel(R.id.item_emoji_tv).isVisible = false - view.findViewById(R.id.item_emoji_image).isVisible = true - view.findViewById(R.id.item_emoji_image).setImageDrawable(ContextCompat.getDrawable(view.context, it)) - } ?: run { - view.findViewById(R.id.item_emoji_tv).isVisible = true - view.findViewById(R.id.item_emoji_image).isVisible = false - view.findViewById(R.id.item_emoji_tv).text = rep.emoji + val views = ItemEmojiVerifBinding.bind(view) + val drawableRes = rep.drawableRes + if (drawableRes != null) { + views.itemEmojiTv.isVisible = false + views.itemEmojiImage.isVisible = true + views.itemEmojiImage.setImageDrawable(ContextCompat.getDrawable(view.context, drawableRes)) + } else { + views.itemEmojiTv.isVisible = true + views.itemEmojiImage.isVisible = false + views.itemEmojiTv.text = rep.emoji } - view.findViewById(R.id.item_emoji_name_tv).setText(rep.nameResId) + views.itemEmojiNameTv.setText(rep.nameResId) } class Holder : VectorEpoxyHolder() { diff --git a/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt b/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt index 33202403f9..17ad35f07a 100644 --- a/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt +++ b/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt @@ -18,11 +18,10 @@ package im.vector.app.features.popup import android.app.Activity import android.view.View -import android.widget.ImageView -import android.widget.TextView import im.vector.app.R import im.vector.app.core.extensions.setLeftDrawable import im.vector.app.core.glide.GlideApp +import im.vector.app.databinding.AlerterIncomingCallLayoutBinding import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.util.MatrixItem @@ -43,26 +42,21 @@ class IncomingCallAlert(uid: String, private val onReject: () -> Unit) : VectorAlert.ViewBinder { override fun bind(view: View) { + val views = AlerterIncomingCallLayoutBinding.bind(view) val (callKindText, callKindIcon, callKindActionIcon) = if (isVideoCall) { Triple(R.string.action_video_call, R.drawable.ic_call_video_small, R.drawable.ic_call_answer_video) } else { Triple(R.string.action_voice_call, R.drawable.ic_call_audio_small, R.drawable.ic_call_answer) } - view.findViewById(R.id.incomingCallKindView).apply { - setText(callKindText) - setLeftDrawable(callKindIcon) + views.incomingCallKindView.setText(callKindText) + views.incomingCallKindView.setLeftDrawable(callKindIcon) + views.incomingCallNameView.text = matrixItem?.getBestName() + matrixItem?.let { avatarRenderer.render(it, views.incomingCallAvatar, GlideApp.with(view.context.applicationContext)) } + views.incomingCallAcceptView.setOnClickListener { + onAccept() } - view.findViewById(R.id.incomingCallNameView).text = matrixItem?.getBestName() - view.findViewById(R.id.incomingCallAvatar)?.let { imageView -> - matrixItem?.let { avatarRenderer.render(it, imageView, GlideApp.with(view.context.applicationContext)) } - } - view.findViewById(R.id.incomingCallAcceptView).apply { - setOnClickListener { - onAccept() - } - setImageResource(callKindActionIcon) - } - view.findViewById(R.id.incomingCallRejectView).setOnClickListener { + views.incomingCallAcceptView.setImageResource(callKindActionIcon) + views.incomingCallRejectView.setOnClickListener { onReject() } } diff --git a/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt b/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt index 70663ec58d..228c629161 100644 --- a/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt +++ b/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt @@ -18,10 +18,10 @@ package im.vector.app.features.popup import android.app.Activity import android.view.View -import android.widget.ImageView import androidx.annotation.DrawableRes import im.vector.app.R import im.vector.app.core.glide.GlideApp +import im.vector.app.databinding.AlerterVerificationLayoutBinding import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.util.MatrixItem @@ -40,9 +40,8 @@ class VerificationVectorAlert(uid: String, private val avatarRenderer: AvatarRenderer) : VectorAlert.ViewBinder { override fun bind(view: View) { - view.findViewById(R.id.ivUserAvatar)?.let { imageView -> - matrixItem?.let { avatarRenderer.render(it, imageView, GlideApp.with(view.context.applicationContext)) } - } + val views = AlerterVerificationLayoutBinding.bind(view) + matrixItem?.let { avatarRenderer.render(it, views.ivUserAvatar, GlideApp.with(view.context.applicationContext)) } } } } diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt index fd7e3cbb6a..70e5bdff10 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt @@ -18,13 +18,10 @@ package im.vector.app.features.settings.troubleshoot import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button -import android.widget.ImageView -import android.widget.ProgressBar -import android.widget.TextView import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import im.vector.app.R +import im.vector.app.databinding.ItemNotificationTroubleshootBinding import im.vector.app.features.themes.ThemeUtils class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList) @@ -46,71 +43,67 @@ class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList(R.id.troubleshootProgressBar) - private val troubleshootTestTitle = itemView.findViewById(R.id.troubleshootTestTitle) - private val troubleshootTestDescription = itemView.findViewById(R.id.troubleshootTestDescription) - private val troubleshootStatusIcon = itemView.findViewById(R.id.troubleshootStatusIcon) - private val troubleshootTestButton = itemView.findViewById