<?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>

        <import type="com.gingersoft.gsa.cloud.common.utils.time.TimeUtils" />

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

        <variable
            name="data"
            type="com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderList.DataBeanX.DataBean" />

        <variable
            name="delivery_state"
            type="String" />

        <variable
            name="state"
            type="String" />

        <variable
            name="orderingMethod"
            type="String" />

        <variable
            name="payMethod"
            type="String" />

        <variable
            name="orderingMethodBg"
            type="android.graphics.drawable.Drawable" />

        <variable
            name="stateBg"
            type="android.graphics.drawable.Drawable" />

        <variable
            name="payMethodBg"
            type="android.graphics.drawable.Drawable" />

        <!-- 是否自取-->
        <variable
            name="isSelf"
            type="Boolean" />
    </data>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/dp_3"
        android:layout_marginTop="@dimen/dp_7"
        android:layout_marginRight="@dimen/dp_3">

        <com.lihang.ShadowLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:hl_cornerRadius="@dimen/dp_8"
            app:hl_shadowLimit="@dimen/dp_3">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/tv_delivery_method"
                    android:layout_width="@dimen/dp_19"
                    android:layout_height="0dp"
                    android:background="@{orderingMethodBg}"
                    android:gravity="center"
                    android:text="@{orderingMethod}"
                    android:textColor="@color/white"
                    android:textSize="@dimen/dp_14"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="外送"
                    tools:textColor="@color/theme_333_color" />

                <FrameLayout
                    android:id="@+id/fl_payment_method"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/dp_10"
                    android:layout_marginTop="@dimen/dp_5"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/tv_delivery_method"
                    app:layout_constraintRight_toLeftOf="@id/tv_order_time"
                    app:layout_constraintTop_toTopOf="parent">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@{payMethodBg}"
                        android:paddingLeft="@dimen/dp_10"
                        android:paddingTop="@dimen/dp_2"
                        android:paddingRight="@dimen/dp_10"
                        android:paddingBottom="@dimen/dp_2"
                        android:text="@{payMethod}"
                        android:textColor="@color/white"
                        android:gravity="left"
                        android:layout_gravity="left"
                        android:textSize="@dimen/sp_10"
                        tools:text="支付方式"
                        tools:textColor="@color/theme_333_color" />
                </FrameLayout>

                <TextView
                    android:id="@+id/tv_order_time"
                    style="@style/otherOrder_item_create_time_textStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_marginEnd="@dimen/dp_10"
                    android:layout_toEndOf="@id/fl_payment_method"
                    android:gravity="right"
                    android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
                    android:textSize="@dimen/dp_10"
                    app:layout_constraintBottom_toBottomOf="@id/fl_payment_method"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/fl_payment_method"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/fl_payment_method"
                    tools:text="下單時間"
                    tools:textColor="@color/theme_333_color" />

                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_order_item_one"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="fl_payment_method,tv_order_time" />

                <TextView
                    android:id="@+id/tv_order_user_name"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_6"
                    android:layout_marginRight="@dimen/dp_10"
                    android:text="@{data.rECEIVER + @string/left_parenthesis+data.pHONE + @string/right_parenthesis}"
                    android:textColor="@color/theme_text_color"
                    android:textSize="@dimen/sp_14"
                    android:textStyle="bold"
                    app:layout_constraintHorizontal_weight="3"
                    app:layout_constraintLeft_toLeftOf="@id/fl_payment_method"
                    app:layout_constraintRight_toLeftOf="@id/tv_delivery_state"
                    app:layout_constraintTop_toBottomOf="@id/barrier_order_item_one"
                    tools:text="用戶名+手機號啊實打實啊實打實大阿打哈阿薩德達"
                    tools:textColor="@color/theme_333_color" />

                <TextView
                    android:id="@+id/tv_delivery_state"
                    style="@style/otherOrder_item_info_title_textStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"

                    android:layout_alignParentEnd="true"
                    android:layout_marginEnd="@dimen/dp_10"
                    android:layout_toEndOf="@id/tv_order_user_name"
                    android:gravity="end"
                    android:text="@{delivery_state}"
                    android:textColor="@color/color_3c"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/tv_order_user_name"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_order_user_name"
                    tools:text="已通知物流"
                    tools:textColor="@color/theme_333_color" />

                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_order_item_two"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="tv_order_user_name,tv_delivery_state" />

                <TextView
                    android:id="@+id/tv_delivery_time"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_5"
                    android:text="@{data.sendTime}"
                    android:textColor="#EC2D2D"
                    android:textSize="@dimen/dp_12"
                    android:visibility="@{(data.sendTime == null || data.sendTime.length() == 0)?View.GONE:View.VISIBLE}"
                    app:layout_constraintLeft_toLeftOf="@id/fl_payment_method"
                    app:layout_constraintTop_toBottomOf="@id/barrier_order_item_two"
                    tools:text="送達時間Adasd奧術大師大所多啊實打實大啊實打實大阿薩德"
                    tools:textColor="@color/theme_333_color" />

                <TextView
                    android:id="@+id/tv_order_num_text"
                    style="@style/otherOrder_item_info_title_textStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginTop="@dimen/dp_5"
                    android:text="取餐碼："
                    app:layout_constraintLeft_toLeftOf="@id/fl_payment_method"
                    app:layout_constraintTop_toBottomOf="@id/tv_delivery_time" />

                <TextView
                    android:id="@+id/tv_order_num"
                    style="@style/otherOrder_item_info_title_textStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="@dimen/dp_5"
                    android:gravity="left"
                    android:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
                    android:textSize="@dimen/dp_14"
                    android:textStyle="bold"
                    app:layout_constraintHorizontal_weight="2"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_item_right"
                    app:layout_constraintRight_toLeftOf="@id/rl_order_state"
                    app:layout_constraintTop_toBottomOf="@id/tv_delivery_time"
                    app:layout_constraintTop_toTopOf="@id/tv_order_num_text"
                    tools:text="0112121121"
                    tools:textColor="@color/theme_333_color" />

                <FrameLayout
                    android:id="@+id/rl_order_state"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/dp_10"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/tv_order_num"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_delivery_time"
                    app:layout_constraintTop_toTopOf="@id/tv_order_num_text">

                    <TextView
                        android:id="@+id/tv_order_state"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:background="@{stateBg}"
                        android:padding="@dimen/dp_5"
                        android:text="@{state}"
                        android:textColor="@color/white"
                        android:textSize="@dimen/dp_14"
                        tools:text="訂單狀態"
                        tools:textColor="@color/theme_333_color" />

                </FrameLayout>


                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_order_item_three"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="tv_order_num_text,tv_order_num,rl_order_state" />

                <TextView
                    android:id="@+id/tv_address_text"
                    style="@style/otherOrder_item_info_title_textStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_9"
                    android:layout_marginBottom="@dimen/dp_10"
                    android:text="@{@string/address}"
                    android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
                    app:layout_constraintLeft_toLeftOf="@id/fl_payment_method"
                    app:layout_constraintTop_toBottomOf="@id/barrier_order_item_three"
                    tools:text="地址："
                    tools:textColor="@color/theme_333_color" />

                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_order_item_right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:barrierDirection="right"
                    app:constraint_referenced_ids="tv_address_text,tv_order_num_text" />

                <TextView
                    android:id="@+id/tv_address"
                    style="@style/otherOrder_item_info_textStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/dp_5"
                    android:layout_marginBottom="@dimen/dp_10"
                    android:layout_toStartOf="@id/tv_order_amount"
                    android:layout_toEndOf="@id/tv_address_text"
                    android:text="@{data.aDDRESS_DETAIL}"
                    android:gravity="left"
                    android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
                    app:layout_constraintHorizontal_weight="2"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_item_right"
                    app:layout_constraintRight_toLeftOf="@id/tv_order_amount"
                    app:layout_constraintTop_toTopOf="@id/tv_address_text"
                    tools:text="收貨地址"
                    tools:textColor="@color/theme_333_color" />

                <TextView
                    android:id="@+id/tv_order_amount"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_centerVertical="true"
                    android:layout_marginStart="@dimen/dp_4"
                    android:layout_marginTop="@dimen/dp_9"
                    android:layout_marginEnd="@dimen/dp_10"
                    android:gravity="right"
                    android:text="@{@string/amount_unit + data.pAY_AMOUNT}"
                    android:textColor="@color/red_600"
                    android:textSize="@dimen/sp_16"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/tv_address"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/barrier_order_item_three"
                    tools:text="$14142"
                    tools:textColor="@color/theme_333_color" />


                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_order_item_bottom"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="tv_address,tv_order_amount" />

                <View
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:layout_marginBottom="@dimen/dp_10"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/barrier_order_item_bottom" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.lihang.ShadowLayout>

        <FrameLayout
            android:id="@+id/fl_border"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/shape_order_border"
            android:visibility="gone" />
    </FrameLayout>
</layout>