<?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.goods.transport.list.PdaGoodsTransportListViewModel" />
    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/backgroud_gray"
            android:orientation="vertical">

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

            <LinearLayout
                shape_bg_color="@{@color/white}"
                shape_radius="@{8}"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginHorizontal="10dp"
                android:layout_marginTop="10dp"
                android:background="@color/white"
                android:gravity="center_vertical"
                android:paddingHorizontal="10dp">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@drawable/search" />

                <!--setFocusChangedListener="@{viewModel::onCarChange}"-->
                <EditText
                    android:id="@+id/etCarNo"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="@null"
                    android:hint="请输入平板车"
                    android:paddingHorizontal="10dp"
                    android:text="@={viewModel.keyWord}"
                    android:textColorHint="@color/text_gray_l"
                    android:textSize="15sp" />

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:onClick="@{()-> viewModel.scanClick()}"
                    android:src="@mipmap/scan_code" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="10dp"
                android:layout_marginTop="10dp">

                <LinearLayout
                    android:layout_width="201dp"
                    android:layout_height="30dp">

                    <TextView
                        shape_bg_color='@{viewModel.index == 0 ? "#1ed4b3" : @color/white}'
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center_vertical"
                        android:layout_weight="1"
                        android:background="#1ed4b3"
                        android:gravity="center"
                        android:onClick="@{()-> viewModel.onTabChanged(0)}"
                        android:text="待运输"
                        android:textColor="@{viewModel.index == 0 ? @color/white : @color/text_normal}" />

                    <TextView
                        shape_bg_color='@{viewModel.index == 1 ? "#1ed4b3" : @color/white}'
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center_vertical"
                        android:layout_weight="1"
                        android:background="@color/white"
                        android:gravity="center"
                        android:onClick="@{()-> viewModel.onTabChanged(1)}"
                        android:text="运输中"
                        android:textColor="@{viewModel.index == 1 ? @color/white : @color/text_normal}" />

                    <TextView
                        shape_bg_color='@{viewModel.index == 2 ? "#1ed4b3" : @color/white}'
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center_vertical"
                        android:layout_weight="1"
                        android:background="@color/white"
                        android:gravity="center"
                        android:onClick="@{()-> viewModel.onTabChanged(2)}"
                        android:text="完成运输"
                        android:textColor="@{viewModel.index == 2 ? @color/white : @color/text_normal}" />



                </LinearLayout>

                <View
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_weight="1" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center_horizontal"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@color/colorPrimary"
                        android:paddingHorizontal="20dp"
                        android:paddingVertical="4dp"
                        android:text='@{"数量 "+viewModel.count}'
                        android:textColor="@color/white"
                        tools:text="数量 0" />

                    <ImageView
                        android:layout_width="10dp"
                        android:layout_height="10dp"
                        android:layout_marginTop="-3dp"
                        android:scaleType="fitXY"
                        android:src="@drawable/img_daosanjiao" />

                </LinearLayout>


            </LinearLayout>

            <com.scwang.smart.refresh.layout.SmartRefreshLayout
                android:id="@+id/srl"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv"
                    itemLayoutId="@{viewModel.itemLayoutId}"
                    viewHolder="@{viewModel.itemViewHolder}"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_pda_zhuanyun_list" />

            </com.scwang.smart.refresh.layout.SmartRefreshLayout>


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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="start"
                    android:drawableRight="@drawable/img_shaixuan"
                    android:drawablePadding="5dp"
                    android:gravity="start"
                    android:onClick="@{()->viewModel.onFilterClick()}"
                    android:padding="10dp"
                    android:text="筛选"
                    android:textColor="@color/red"
                    android:textSize="25sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1" />

                <TextView
                    visible="@{viewModel.supplementEnable}"
                    android:layout_width="120dp"
                    android:layout_height="match_parent"
                    android:layout_gravity="end"
                    android:background="@color/colorPrimary"
                    android:gravity="center"
                    android:onClick="@{()-> viewModel.onSupplementClick()}"
                    android:textColor="@color/white"
                    android:textSize="18sp"
                    android:text="补充机位" />

                <TextView
                    visible="@{viewModel.confirmEnable}"
                    android:layout_width="120dp"
                    android:layout_height="match_parent"
                    android:layout_gravity="end"
                    android:background="@color/colorPrimary"
                    android:gravity="center"
                    android:onClick="@{()-> viewModel.onConfirmClick()}"
                    android:text="@{viewModel.confirmText}"
                    android:textColor="@color/white"
                    android:textSize="18sp"
                    tools:text="开始运输" />
            </LinearLayout>

        </LinearLayout>

        <ImageView
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true"
            android:layout_marginRight="20dp"
            android:onClick="@{()-> viewModel.onAddCargo()}"
            android:layout_marginBottom="80dp"
            android:background="@drawable/bg_white_circle"
            android:padding="10dp"
            android:src="@drawable/img_add_cargo" />

        <!--<ImageView
            shape_bg_color="@{@color/colorPrimary}"
            shape_radius="@{25}"
            visible="@{viewModel.supplementEnable}"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_marginRight="30dp"
            android:layout_marginBottom="80dp"
            android:background="@color/colorPrimary"
            android:onClick="@{()->viewModel.onSupplementClick()}"
            android:padding="12dp"
            android:src="@drawable/img_edit" />-->


    </RelativeLayout>

</layout>