<?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="title"
            type="String" />

        <variable
            name="status"
            type="androidx.databinding.ObservableBoolean" />

        <variable
            name="adapter"
            type="com.example.tyre.maintenance.adapter.OrderAdapter" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".maintenance.WorkOrderActivity">

        <include
            layout="@layout/layout_activity_title"
            app:title='@{title??"总工单列表"}' />


        <androidx.gridlayout.widget.GridLayout
            style="@style/layout_card_style"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="12dp"
            app:columnCount="3"
            app:rowCount="5">

            <TextView
                android:layout_height="45dp"
                android:gravity="left|center"
                android:text="选择保养周期查询："
                android:textColor="@color/textColor1"
                app:layout_columnSpan="3" />

            <TextView
                android:id="@+id/work_order_date_start"
                android:layout_height="45dp"
                android:gravity="left|center"
                android:onClick="selectDate1"
                android:paddingEnd="10dp"
                android:text="开始保养日期"
                android:textColor="@color/textColor2"
                android:textStyle="bold"
                app:layout_columnWeight="1" />

            <TextView
                android:id="@+id/work_order_date_end"
                android:layout_height="45dp"
                android:gravity="right|center"
                android:onClick="selectDate2"
                android:paddingEnd="10dp"
                android:text="结束保养日期"
                android:textColor="@color/textColor2"
                android:textStyle="bold"
                app:layout_columnWeight="1" />

            <ImageView
                android:layout_width="20dp"
                android:layout_height="45dp"
                android:padding="5dp"
                android:src="@drawable/ic_sanjiao"
                tools:ignore="UseAppTint" />

            <View
                android:layout_height="1dp"
                android:background="#F1F1F1"
                app:layout_columnSpan="3" />

            <TextView
                android:layout_height="45dp"
                android:gravity="left|center"
                android:text="站点"
                android:textColor="@color/textColor1"
                app:layout_columnWeight="1" />

            <TextView
                android:id="@+id/work_order_site"
                android:layout_height="45dp"
                android:gravity="right|center"
                android:onClick="selectOrderSite"
                android:paddingEnd="10dp"
                android:text="光明修理厂"
                android:textColor="@color/textColor2"
                android:textStyle="bold"
                app:layout_columnWeight="1"
                tools:ignore="RtlHardcoded,RtlSymmetry" />

            <ImageView
                android:layout_width="20dp"
                android:layout_height="45dp"
                android:padding="5dp"
                android:src="@drawable/ic_sanjiao"
                tools:ignore="UseAppTint" />

            <View
                android:layout_height="1dp"
                android:background="#F1F1F1"
                app:layout_columnSpan="3" />

            <TextView
                android:layout_height="45dp"
                android:gravity="left|center"
                android:text="维保状态"

                android:textColor="@color/textColor1"
                app:layout_columnWeight="1" />

            <TextView
                android:layout_height="45dp"
                android:gravity="right|center"
                android:onClick="switchStatus"
                android:paddingEnd="10dp"
                android:text='@{status?"已完成(点击切换)":"未完成(点击切换)"}'
                android:textColor='@{status? @color/buttonColor2:@color/buttonColor}'
                android:textStyle="bold"
                app:layout_columnWeight="1" />

            <ImageView
                android:layout_width="20dp"
                android:layout_height="45dp"
                android:padding="5dp"
                android:src="@drawable/ic_sanjiao"
                android:tint='@{status? @color/buttonColor2:@color/buttonColor}'
                tools:ignore="UseAppTint" />


        </androidx.gridlayout.widget.GridLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:text="点击下表的车辆，进行处理" />

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <androidx.recyclerview.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:adapter="@{adapter}"
                android:padding="12dp"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

            <com.google.android.material.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:layout_marginEnd="20dp"
                android:layout_marginBottom="20dp"
                android:backgroundTint="@color/blue1_1"
                android:onClick="goCreateWorkOrder"
                android:src="@mipmap/plus"
                android:tint="@android:color/white" />
        </androidx.coordinatorlayout.widget.CoordinatorLayout>

    </LinearLayout>
</layout>