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

    <data>

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

        <variable
            name="viewModel"
            type="com.lukouguoji.gjc.viewModel.GjcQueryDetailsViewModel" />
    </data>

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

        <!-- 标题栏 -->
        <include layout="@layout/title_tool_bar" />

        <!-- Tab栏 (自定义,文字Tab + 底线) -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginHorizontal="15dp"
            android:layout_marginTop="15dp"
            android:background="@drawable/bg_white_radius_top_8"
            android:orientation="horizontal">

            <!-- Tab1: 运单信息 -->
            <LinearLayout
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:onClick="@{()->viewModel.onTabClick(0)}"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="运单信息"
                    android:textStyle="bold"
                    android:textColor="@{viewModel.currentTab == 0 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="16sp" />

                <!-- 选中底线 -->
                <View
                    android:layout_width="60dp"
                    android:layout_height="3dp"
                    android:background="@{viewModel.currentTab == 0 ? @color/colorPrimary : @color/transparent}"
                    android:visibility="@{viewModel.currentTab == 0 ? View.VISIBLE : View.INVISIBLE}" />
            </LinearLayout>

            <!-- Tab2: 仓库信息 -->
            <LinearLayout
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:onClick="@{()->viewModel.onTabClick(1)}"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:textStyle="bold"
                    android:text="仓库信息"
                    android:textColor="@{viewModel.currentTab == 1 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="16sp" />

                <View
                    android:layout_width="60dp"
                    android:layout_height="3dp"
                    android:background="@{viewModel.currentTab == 1 ? @color/colorPrimary : @color/transparent}"
                    android:visibility="@{viewModel.currentTab == 1 ? View.VISIBLE : View.INVISIBLE}" />
            </LinearLayout>

            <!-- Tab3: 库位信息 -->
            <LinearLayout
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:gravity="center"
                android:onClick="@{()->viewModel.onTabClick(2)}"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:textStyle="bold"
                    android:text="库位信息"
                    android:textColor="@{viewModel.currentTab == 2 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="16sp" />

                <View
                    android:layout_width="60dp"
                    android:layout_height="3dp"
                    android:background="@{viewModel.currentTab == 2 ? @color/colorPrimary : @color/transparent}"
                    android:visibility="@{viewModel.currentTab == 2 ? View.VISIBLE : View.INVISIBLE}" />
            </LinearLayout>

        </LinearLayout>

        <com.google.android.material.divider.MaterialDivider
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginStart="15dp"
            android:layout_marginEnd="23dp"
            android:background="@color/color_f2" />

        <!-- ViewPager2 -->
        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/vp"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

    </LinearLayout>
</layout>
