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

        <variable
            name="adapter"
            type="com.example.beijing_daxing.adapter.InAdapter" />

        <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=".InActivity">

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

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="12dp"
            android:layout_weight="1"
            android:adapter="@{adapter}"
            android:background="@color/white"
            android:padding="10dp"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="扫描轮挡数量：" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text='@={vm.sanLength+""}' />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="52dp"
            android:background="@color/bg1"
            android:focusable="true"
            android:focusableInTouchMode="true">

            <TextView
                style="@style/info_text"
                android:layout_width="110dp"
                android:layout_height="45dp"
                android:layout_gravity="center"
                android:text="输入批次:" />

            <EditText
                style="@style/info_text1"
                android:layout_width="match_parent"
                android:layout_height="45dp"
                android:layout_gravity="center"
                android:text="@={vm.binchCode}" />
        </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="选择厂家:" />

            <Spinner
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:entries="@{vm.manus}"
                android:onItemSelected="@{vm.selectManus}" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="45dp">

            <TextView
                style="@style/info_text"
                android:layout_width="110dp"
                android:layout_height="match_parent"
                android:text="选择库位:" />

            <Spinner
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:entries="@{vm.locations}"
                android:onItemSelected="@{vm.selectLocation}" />
        </LinearLayout>

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

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="20dp"
                android:layout_weight="1"
                android:backgroundTint="@{checkState?@color/yellow:@color/black}"
                android:onClick="instore_check"
                android:text='@{checkState?"停止读取":"开始盘点"}'
                android:textSize="20sp" />

            <Button
                style="@style/button_style"
                android:layout_width="match_parent"
                android:layout_height="55dp"
                android:layout_marginBottom="12dp"
                android:layout_weight="1"
                android:onClick="in_submit"
                android:text="提交"
                app:layout_constraintTop_toBottomOf="@+id/linearLayout4"
                tools:layout_editor_absoluteX="16dp" />
        </LinearLayout>
    </LinearLayout>
</layout>