<?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <data>

        <variable
            name="item"
            type="com.topjohnwu.magisk.model.entity.recycler.SectionTitle" />

        <variable
            name="viewModel"
            type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:animateLayoutChanges="true"
        android:layout_height="wrap_content">

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/module_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@{item.title}"
            android:textAppearance="@style/AppearanceFoundation.Body"
            android:textColor="@color/color_primary_transient"
            android:textStyle="bold"
            tools:text="@tools:sample/lorem/random"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/module_button"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/module_button"
            style="@style/WidgetFoundation.Button.Text.Secondary"
            gone="@{!item.hasButton}"
            android:onClick="@{() -> viewModel.sectionPressed(item)}"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/l1"
            android:text="@{item.button}"
            tools:text="@tools:sample/lorem"
            android:textAllCaps="false"
            app:icon="@{item.icon}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/module_title"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>