Merge pull request #2592 from vector-im/feature/bma/fix_viwe_bindings

Fix crash after migration to view bindings
This commit is contained in:
Benoit Marty 2020-12-29 09:49:49 +01:00 committed by GitHub
commit 68dd206140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 166 additions and 74 deletions

View File

@ -28,7 +28,7 @@ import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.databinding.ItemVerificationActionBinding
import im.vector.app.databinding.ViewBottomSheetActionButtonBinding
import im.vector.app.features.themes.ThemeUtils
class BottomSheetActionButton @JvmOverloads constructor(
@ -36,7 +36,7 @@ class BottomSheetActionButton @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
val views : ItemVerificationActionBinding
val views: ViewBottomSheetActionButtonBinding
var title: String? = null
set(value) {
@ -97,8 +97,8 @@ class BottomSheetActionButton @JvmOverloads constructor(
}
init {
inflate(context, R.layout.item_verification_action, this)
views = ItemVerificationActionBinding.bind(this)
inflate(context, R.layout.view_bottom_sheet_action_button, this)
views = ViewBottomSheetActionButtonBinding.bind(this)
context.withStyledAttributes(attrs, R.styleable.BottomSheetActionButton) {
title = getString(R.styleable.BottomSheetActionButton_actionTitle) ?: ""

View File

@ -18,7 +18,7 @@ package im.vector.app.features.call
import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
import android.widget.FrameLayout
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.databinding.ViewCallControlsBinding
@ -28,7 +28,7 @@ import org.webrtc.PeerConnection
class CallControlsView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
) : FrameLayout(context, attrs, defStyleAttr) {
private val views: ViewCallControlsBinding

View File

@ -23,7 +23,7 @@ import android.widget.LinearLayout
import androidx.core.content.withStyledAttributes
import im.vector.app.R
import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.databinding.ItemTimelineEventPollResultItemBinding
import im.vector.app.databinding.ViewPollResultLineBinding
class PollResultLineView @JvmOverloads constructor(
context: Context,
@ -31,7 +31,7 @@ class PollResultLineView @JvmOverloads constructor(
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
private val views: ItemTimelineEventPollResultItemBinding
private val views: ViewPollResultLineBinding
var label: String? = null
set(value) {
@ -60,8 +60,8 @@ class PollResultLineView @JvmOverloads constructor(
}
init {
inflate(context, R.layout.item_timeline_event_poll_result_item, this)
views = ItemTimelineEventPollResultItemBinding.bind(this)
inflate(context, R.layout.view_poll_result_line, this)
views = ViewPollResultLineBinding.bind(this)
orientation = HORIZONTAL
context.withStyledAttributes(attrs, R.styleable.PollResultLineView) {

View File

@ -20,19 +20,19 @@ import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.widget.LinearLayout
import android.widget.FrameLayout
import androidx.core.content.withStyledAttributes
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.databinding.ItemSignoutActionBinding
import im.vector.app.databinding.ViewSignOutBottomSheetActionButtonBinding
import im.vector.app.features.themes.ThemeUtils
class SignOutBottomSheetActionButton @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
) : FrameLayout(context, attrs, defStyleAttr) {
private val views: ItemSignoutActionBinding
private val views: ViewSignOutBottomSheetActionButtonBinding
var action: (() -> Unit)? = null
@ -67,8 +67,8 @@ class SignOutBottomSheetActionButton @JvmOverloads constructor(
}
init {
inflate(context, R.layout.item_signout_action, this)
views = ItemSignoutActionBinding.bind(this)
inflate(context, R.layout.view_sign_out_bottom_sheet_action_button, this)
views = ViewSignOutBottomSheetActionButtonBinding.bind(this)
context.withStyledAttributes(attrs, R.styleable.SignOutBottomSheetActionButton) {
title = getString(R.styleable.SignOutBottomSheetActionButton_actionTitle) ?: ""

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/signedOutActionClickable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:minHeight="50dp"
android:orientation="horizontal"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
<ImageView
android:id="@+id/actionIconImageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_secure_backup"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix" />
<TextView
android:id="@+id/actionTitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/secure_backup_setup"
android:textColor="?riotx_text_secondary"
android:textSize="17sp" />
</LinearLayout>

View File

@ -24,10 +24,10 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_share"
tools:visibility="visible"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix" />
tools:ignore="MissingPrefix"
tools:src="@drawable/ic_share"
tools:visibility="visible" />
<TextView
@ -70,8 +70,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_arrow_right"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix" />
tools:ignore="MissingPrefix"
tools:src="@drawable/ic_arrow_right" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:parentTag="android.widget.FrameLayout">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/itemVerificationClickableZone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?riotx_bottom_sheet_background"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:minHeight="64dp"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
<ImageView
android:id="@+id/itemVerificationLeftIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix"
tools:src="@drawable/ic_share"
tools:visibility="visible" />
<TextView
android:id="@+id/itemVerificationActionTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textColor="@color/riotx_accent"
android:textSize="16sp"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/itemVerificationActionSubTitle"
app:layout_constraintEnd_toStartOf="@+id/itemVerificationActionIcon"
app:layout_constraintStart_toEndOf="@+id/itemVerificationLeftIcon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
app:layout_goneMarginStart="0dp"
tools:text="@string/start_verification" />
<TextView
android:id="@+id/itemVerificationActionSubTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textColor="?riotx_text_secondary"
android:textSize="12sp"
android:visibility="gone"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/itemVerificationActionIcon"
app:layout_constraintStart_toStartOf="@+id/itemVerificationActionTitle"
app:layout_constraintTop_toBottomOf="@+id/itemVerificationActionTitle"
tools:text="For maximum security, do this in person"
tools:visibility="visible" />
<ImageView
android:id="@+id/itemVerificationActionIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix"
tools:src="@drawable/ic_arrow_right" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
tools:parentTag="android.widget.FrameLayout">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ringingControls"
@ -23,8 +24,8 @@
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_call"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="@color/white" />
app:tint="@color/white"
tools:ignore="MissingConstraints,MissingPrefix" />
<ImageView
android:id="@+id/ringingControlDecline"
@ -36,8 +37,8 @@
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_call_end"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="@color/white" />
app:tint="@color/white"
tools:ignore="MissingConstraints,MissingPrefix" />
<androidx.constraintlayout.helper.widget.Flow
android:layout_width="match_parent"
@ -69,8 +70,8 @@
android:padding="10dp"
android:src="@drawable/ic_home_bottom_chat"
app:backgroundTint="?attr/riotx_background"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="?attr/riotx_text_primary" />
app:tint="?attr/riotx_text_primary"
tools:ignore="MissingConstraints,MissingPrefix" />
<ImageView
android:id="@+id/muteIcon"
@ -82,10 +83,10 @@
android:padding="16dp"
android:src="@drawable/ic_microphone_off"
app:backgroundTint="?attr/riotx_background"
app:tint="?attr/riotx_text_primary"
tools:contentDescription="@string/a11y_mute_microphone"
tools:ignore="MissingConstraints,MissingPrefix"
tools:src="@drawable/ic_microphone_on"
app:tint="?attr/riotx_text_primary" />
tools:src="@drawable/ic_microphone_on" />
<ImageView
android:id="@+id/iv_end_call"
@ -97,8 +98,8 @@
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_call_end"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="@color/white" />
app:tint="@color/white"
tools:ignore="MissingConstraints,MissingPrefix" />
<ImageView
android:id="@+id/videoToggleIcon"
@ -110,9 +111,9 @@
android:padding="16dp"
android:src="@drawable/ic_call_videocam_off_default"
app:backgroundTint="?attr/riotx_background"
app:tint="?attr/riotx_text_primary"
tools:contentDescription="@string/a11y_stop_camera"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="?attr/riotx_text_primary" />
tools:ignore="MissingConstraints,MissingPrefix" />
<ImageView
android:id="@+id/iv_more"
@ -125,8 +126,8 @@
android:padding="8dp"
android:src="@drawable/ic_more_vertical"
app:backgroundTint="?attr/riotx_background"
tools:ignore="MissingConstraints,MissingPrefix"
app:tint="?attr/riotx_text_primary" />
app:tint="?attr/riotx_text_primary"
tools:ignore="MissingConstraints,MissingPrefix" />
<androidx.constraintlayout.helper.widget.Flow
android:layout_width="match_parent"
@ -202,4 +203,4 @@
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
</FrameLayout>
</merge>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:parentTag="android.widget.FrameLayout">
<LinearLayout
android:id="@+id/signedOutActionClickable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:minHeight="50dp"
android:orientation="horizontal"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingTop="8dp"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingBottom="8dp">
<ImageView
android:id="@+id/actionIconImageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_secure_backup"
app:tint="?riotx_text_primary"
tools:ignore="MissingPrefix" />
<TextView
android:id="@+id/actionTitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/secure_backup_setup"
android:textColor="?riotx_text_secondary"
android:textSize="17sp" />
</LinearLayout>
</merge>