<?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.ui.module.SectionTitle" />

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

    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateLayoutChanges="true"
        android:gravity="center_vertical">

        <TextView
            android:id="@+id/module_title"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@{item.title}"
            android:textAppearance="@style/AppearanceFoundation.Large"
            android:textColor="@color/color_primary_transient"
            android:textStyle="bold"
            tools:text="Installed" />

        <Button
            android:id="@+id/module_button"
            style="@style/WidgetFoundation.Button.Text.Secondary"
            invisible="@{!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}"
            android:textAllCaps="false"
            app:icon="@{item.icon}"
            tools:text="Reboot" />

    </LinearLayout>

</layout>
