<?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.enter.PDAEnterViewModel" />
    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/backgroud_gray"
        tools:context=".ui.enter.PDAEnterActivity">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="50dp">

            <androidx.viewpager2.widget.ViewPager2
                android:id="@+id/vp"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <RelativeLayout
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="10dp"
                android:onClick="@{() -> viewModel.onMessageClick()}">

                <ImageView
                    android:layout_width="35dp"
                    android:layout_height="35dp"
                    android:layout_centerInParent="true"
                    android:layout_marginRight="10dp"
                    android:padding="5dp"
                    android:src="@drawable/img_message_svg" />

                <TextView
                    android:id="@+id/tv_message"
                    shape_bg_color="@{@color/red}"
                    shape_radius="@{10}"
                    android:layout_width="wrap_content"
                    android:layout_height="20dp"
                    android:layout_alignParentRight="true"
                    android:layout_marginTop="5dp"
                    android:background="@color/red"
                    android:gravity="center"
                    android:minWidth="20dp"
                    android:paddingHorizontal="3dp"
                    android:text="2"
                    android:textColor="@color/white"
                    android:textSize="11sp"
                    android:visibility="gone" />

            </RelativeLayout>

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            android:background="@color/white">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:onClick="@{()->viewModel.onIndexChanged(0)}"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@{viewModel.index == 0 ? @drawable/img_pda_tab_1_s : @drawable/img_pda_tab_1_n}"
                    tools:src="@drawable/img_pda_tab_1_s" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="首页"
                    android:textColor="@{viewModel.index == 0 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="12sp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:onClick="@{()->viewModel.onIndexChanged(1)}"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@{viewModel.index == 1 ? @drawable/img_pda_tab_2_s : @drawable/img_pda_tab_2_n}"
                    tools:src="@drawable/img_pda_tab_2_s" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="国内"
                    android:textColor="@{viewModel.index == 1 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:onClick="@{()->viewModel.onIndexChanged(2)}"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@{viewModel.index == 2 ? @drawable/img_pda_tab_3_s : @drawable/img_pda_tab_3_n}"
                    tools:src="@drawable/img_pda_tab_3_s" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="国际"
                    android:textColor="@{viewModel.index == 2 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center"
                android:onClick="@{()->viewModel.onIndexChanged(3)}"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:src="@{viewModel.index == 3 ? @drawable/img_pda_tab_4_s : @drawable/img_pda_tab_4_n}"
                    tools:src="@drawable/img_pda_tab_4_s" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="我的"
                    android:textColor="@{viewModel.index == 3 ? @color/colorPrimary : @color/text_gray}"
                    android:textSize="12sp" />
            </LinearLayout>

        </LinearLayout>

    </RelativeLayout>
</layout>