<?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="adapter"
            type="com.example.beijing_daxing.adapter.CheckAdapter" />

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

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

        <import type="android.view.View" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/bg1"
        android:orientation="vertical"
        tools:context=".CheckActivity">

        <TextView
            style="@style/title_text"
            android:layout_width="match_parent"
            android:layout_height="45dp"
            android:text="轮挡巡检" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="42dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:layout_marginTop="2dp">

            <TextView
                style="@style/item_text_style"
                android:layout_width="200dp"
                android:layout_height="match_parent"

                android:text="轮挡RFID" />
            <View
                android:layout_width="1dp"
                android:layout_height="28dp"
                android:layout_gravity="center"
                android:layout_marginTop="2dp"
                android:background="@color/white" />

            <TextView
                style="@style/item_text_style"
                android:layout_width="70dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="巡检状态" />

            <View
                android:layout_width="1dp"
                android:layout_height="28dp"
                android:layout_gravity="center"
                android:layout_marginTop="2dp"
                android:background="@color/white" />

            <TextView
                android:id="@+id/item_check_click"
                style="@style/item_text_style"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:letterSpacing="0.1"
                android:text="操作"
                android:textColor="@color/blue"
               />
        </LinearLayout>

        <!--    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="45dp"
            android:layout_marginTop="10dp">

            <TextView
                style="@style/info_text"
                android:layout_width="110dp"
                android:layout_height="match_parent"
                android:text="扫描RFID:" />

            <TextView
                android:id="@+id/check_epc"
                style="@style/san_text"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textAlignment="center" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginTop="10dp"
            android:layout_marginEnd="10dp"
            android:background="@color/white">

            <TextView
                style="@style/info_text"
                android:layout_width="110dp"
                android:layout_height="match_parent"
                android:background="@color/bg1"
                android:text="选择原因:" />

            <Spinner
                android:id="@+id/check_item_select"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:entries="@array/check_item"
                android:textAlignment="center" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/check_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:visibility='@{state ?  View.GONE :View.VISIBLE }'>

            <TextView
                style="@style/info_text"
                android:layout_width="110dp"
                android:layout_height="match_parent"
                android:text="输入原因:" />

            <EditText
                android:id="@+id/check_remark"
                style="@style/info_text1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:minHeight="48dp" />
        </LinearLayout>
        <Button
            style="@style/button_style"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginTop="10dp"
            android:onClick="check_stock"
            android:text="单次提交" />-->

        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="450dp"
            android:layout_weight="1"
            android:adapter="@{adapter}"
            android:background="@color/white"
            android:padding="5dp"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:layout_marginTop="5dp"
            android:orientation="horizontal">

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="5dp"
                android:layout_weight="1"
                android:backgroundTint="@{checkState?@color/yellow:@color/black}"
                android:onClick="offCheckRead"
                android:text='@{checkState?"停止读取":"开始扫描"}'
                android:textSize="20sp" />
            <ImageButton
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="5dp"

                android:src="@mipmap/icon_cromer"
                android:onClick="check_tackPhoto"/>

            <FrameLayout

                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"

                android:layout_marginLeft="10dp">
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:onClick="check_showPhoto"
                    android:text="查看照片"/>

                <TextView
                    android:id="@+id/confirm_picture_number2"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_gravity="right"
                    android:background="@drawable/bg_number"
                    android:gravity="center"
                    android:text="0"
                    android:textColor="@color/white"
                    android:textSize="18sp"
                  />
            </FrameLayout>

        </LinearLayout>

        <Button
            style="@style/button_style1"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_margin="10dp"
            android:backgroundTint="#009688"
            android:onClick="check_submit"
            android:text="完成巡检" />


    </LinearLayout>
</layout>