From d1bec21759f2a534bd955972b1adabf825bccbcb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 28 Dec 2020 12:23:06 +0100 Subject: [PATCH] Fix crash after migration to view bindings Also rename some layouts to follow convention --- .../core/ui/views/BottomSheetActionButton.kt | 8 +- .../app/features/call/CallControlsView.kt | 4 +- .../timeline/item/PollResultLineView.kt | 8 +- .../signout/SignOutBottomSheetActionButton.kt | 12 +-- .../main/res/layout/item_signout_action.xml | 36 -------- .../res/layout/item_verification_action.xml | 10 +-- .../view_bottom_sheet_action_button.xml | 84 +++++++++++++++++++ .../main/res/layout/view_call_controls.xml | 35 ++++---- ...ult_item.xml => view_poll_result_line.xml} | 0 ...ew_sign_out_bottom_sheet_action_button.xml | 43 ++++++++++ 10 files changed, 166 insertions(+), 74 deletions(-) delete mode 100644 vector/src/main/res/layout/item_signout_action.xml create mode 100644 vector/src/main/res/layout/view_bottom_sheet_action_button.xml rename vector/src/main/res/layout/{item_timeline_event_poll_result_item.xml => view_poll_result_line.xml} (100%) create mode 100644 vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml diff --git a/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt b/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt index 6f261ad717..f86825750a 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt @@ -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) ?: "" diff --git a/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt b/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt index 5fdc70c539..9aa6ccd298 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollResultLineView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollResultLineView.kt index d5996a65ba..aa864851cd 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollResultLineView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollResultLineView.kt @@ -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) { diff --git a/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetActionButton.kt b/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetActionButton.kt index 00df261095..61bef29d54 100644 --- a/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetActionButton.kt +++ b/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetActionButton.kt @@ -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) ?: "" diff --git a/vector/src/main/res/layout/item_signout_action.xml b/vector/src/main/res/layout/item_signout_action.xml deleted file mode 100644 index b1eb8c1f62..0000000000 --- a/vector/src/main/res/layout/item_signout_action.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/vector/src/main/res/layout/item_verification_action.xml b/vector/src/main/res/layout/item_verification_action.xml index ae49893792..68ee392cff 100644 --- a/vector/src/main/res/layout/item_verification_action.xml +++ b/vector/src/main/res/layout/item_verification_action.xml @@ -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" /> + tools:ignore="MissingPrefix" + tools:src="@drawable/ic_arrow_right" /> diff --git a/vector/src/main/res/layout/view_bottom_sheet_action_button.xml b/vector/src/main/res/layout/view_bottom_sheet_action_button.xml new file mode 100644 index 0000000000..c0f55df9e6 --- /dev/null +++ b/vector/src/main/res/layout/view_bottom_sheet_action_button.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/layout/view_call_controls.xml b/vector/src/main/res/layout/view_call_controls.xml index 435520b9ef..2487f131e3 100644 --- a/vector/src/main/res/layout/view_call_controls.xml +++ b/vector/src/main/res/layout/view_call_controls.xml @@ -1,9 +1,10 @@ - + android:layout_height="wrap_content" + tools:parentTag="android.widget.FrameLayout"> + app:tint="@color/white" + tools:ignore="MissingConstraints,MissingPrefix" /> + app:tint="@color/white" + tools:ignore="MissingConstraints,MissingPrefix" /> + app:tint="?attr/riotx_text_primary" + tools:ignore="MissingConstraints,MissingPrefix" /> + tools:src="@drawable/ic_microphone_on" /> + app:tint="@color/white" + tools:ignore="MissingConstraints,MissingPrefix" /> + tools:ignore="MissingConstraints,MissingPrefix" /> + app:tint="?attr/riotx_text_primary" + tools:ignore="MissingConstraints,MissingPrefix" /> - \ No newline at end of file + \ No newline at end of file diff --git a/vector/src/main/res/layout/item_timeline_event_poll_result_item.xml b/vector/src/main/res/layout/view_poll_result_line.xml similarity index 100% rename from vector/src/main/res/layout/item_timeline_event_poll_result_item.xml rename to vector/src/main/res/layout/view_poll_result_line.xml diff --git a/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml b/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml new file mode 100644 index 0000000000..6809cfd119 --- /dev/null +++ b/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + +