<?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="viewModel"
            type="com.sixin.module_p.ui.lihuo.PdaLiHuoViewModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/backgroud_gray"
        android:orientation="vertical"
        tools:context=".ui.lihuo.PdaLiHuoActivity">

        <include layout="@layout/title_tool_bar" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginHorizontal="10dp"
            android:layout_weight="1"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center_vertical">

                <EditText
                    setFocusChangedListener="@{viewModel::onCarChange}"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="@drawable/bg_input"
                    android:drawableRight="@mipmap/scan_code"
                    android:gravity="center_vertical"
                    android:hint="请扫描平板车"
                    android:paddingHorizontal="10dp"
                    android:text="@={viewModel.car}"
                    android:textSize="15sp" />

                <TextView
                    shape_bg_color="@{@color/colorPrimary}"
                    shape_radius="@{4}"
                    android:layout_width="80dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="10dp"
                    android:gravity="center"
                    android:onClick="@{()->viewModel.clearClick()}"
                    android:text="清 空"
                    android:textColor="@color/white"
                    android:textSize="15sp" />

            </LinearLayout>

            <EditText
                setFocusChangedListener="@{viewModel::onWaybillChange}"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/bg_input"
                android:drawableRight="@mipmap/scan_code"
                android:gravity="center_vertical"
                android:hint="请扫描运单"
                android:paddingHorizontal="10dp"
                android:text="@={viewModel.waybill}"
                android:textSize="15sp" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:background="@drawable/bg_input"
                android:orientation="vertical"
                android:padding="10dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:gravity="center_vertical">

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:gravity="center"
                        android:text='@{"平板车: " + (viewModel.flatcarBean.carId ?? "")}'
                        android:textColor="#333"
                        android:textSize="18sp"
                        android:textStyle="bold"
                        tools:text="平板车: 083" />

                </LinearLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:background="#AAA" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_pda_zu_zhuang" />

            </LinearLayout>

        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/colorPrimary"
            android:gravity="center"
            android:onClick="@{()->viewModel.confirmClick()}"
            android:text="确认理货"
            android:textColor="@color/white"
            android:textSize="16sp" />

    </LinearLayout>
</layout>