<?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:binding="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="RtlHardcoded">

    <data>

        <variable
            name="viewModel"
            type="com.hongyegroup.cpt_parttime.mvvm.PartTimeMainViewModel" />

        <variable
            name="click"
            type="com.hongyegroup.cpt_parttime.ui.PartTimeMainFragment.ClickProxy" />

        <import type="android.text.TextUtils" />

    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical">

        <com.guadou.lib_baselib.view.titlebar.StatusbarGrayView
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/d_46dp"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="@dimen/d_15dp"
            android:paddingRight="@dimen/d_15dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                binding:clicks="@{click.gotoChooseCityPage}">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/d_2dp"
                    android:src="@drawable/location_address_icon" />

                <com.guadou.lib_baselib.font_text_view.TextViewMedium
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/d_5dp"
                    android:gravity="center"
                    android:text="武汉"
                    android:textColor="@color/black"
                    android:textSize="@dimen/d_15sp" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="32dp"
                android:layout_marginLeft="@dimen/d_15dp"
                android:background="@drawable/shape_search_gray_bg_corners20"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="@dimen/d_16dp"
                    android:layout_height="@dimen/d_16dp"
                    android:layout_marginLeft="@dimen/d_12dp"
                    android:src="@drawable/search_icon"
                    binding:clicks="@{click.doSearch}" />

                <EditText
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/d_12dp"
                    android:layout_weight="1"
                    android:background="@color/transparent"
                    android:hint="大家都在搜"
                    android:imeOptions="actionSearch"
                    android:singleLine="true"
                    android:text="@={viewModel.mKeywordLiveData}"
                    android:textColor="@color/black"
                    android:textColorHint="@color/gray_99"
                    android:textSize="@dimen/d_14sp"
                    binding:onKeyEnter="@{click.doSearch}"
                    binding:typefaceMedium="@{true}" />

                <ImageView
                    android:layout_width="@dimen/d_16dp"
                    android:layout_height="@dimen/d_16dp"
                    android:layout_marginRight="@dimen/d_10dp"
                    android:src="@drawable/search_delete"
                    android:visibility="gone"
                    binding:clicks="@{click.searchDel}"
                    binding:isVisibleGone="@{!TextUtils.isEmpty(viewModel.MKeywordLiveData)}" />

            </LinearLayout>

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/d_1dp"
            android:background="@color/main_divider" />

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <!--    顶部的筛选     -->
            <com.google.android.material.appbar.AppBarLayout
                android:id="@+id/app_bar_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:orientation="vertical"
                    app:layout_scrollFlags="scroll|snap|enterAlways">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/d_12dp"
                        android:layout_marginTop="@dimen/d_12dp"
                        android:layout_marginRight="@dimen/d_12dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="兼职推荐"
                            android:textColor="@color/black_33"
                            android:textSize="@{viewModel.mSortTypeLD == 1?@dimen/d_17sp:@dimen/d_15sp}"
                            binding:clicks="@{click.switchReCommend}"
                            binding:typefaceMediumOrBold="@{viewModel.mSortTypeLD == 1}"
                            tools:textSize="@dimen/d_17sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="@dimen/d_15dp"
                            android:text="最新"
                            android:textColor="@color/black_33"
                            android:textSize="@{viewModel.mSortTypeLD == 2?@dimen/d_17sp:@dimen/d_15sp}"
                            binding:clicks="@{click.switchlatested}"
                            binding:typefaceMediumOrBold="@{viewModel.mSortTypeLD == 2}" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="@dimen/d_15dp"
                            android:text="附近"
                            android:textColor="@color/black_33"
                            android:textSize="@{viewModel.mSortTypeLD == 3?@dimen/d_17sp:@dimen/d_15sp}"
                            binding:clicks="@{click.switchNearby}"
                            binding:typefaceMediumOrBold="@{viewModel.mSortTypeLD == 3}" />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/d_8dp"
                        android:orientation="horizontal"
                        android:paddingLeft="@dimen/d_15dp"
                        android:paddingRight="@dimen/d_15dp">

                        <com.guadou.lib_baselib.font_text_view.TextViewMedium
                            android:layout_width="0dp"
                            android:layout_height="@dimen/d_27dp"
                            android:layout_weight="1"
                            android:background="@{viewModel.MPopupPositionTypeLD==1?@drawable/shape_blue_round2_border:@drawable/shape_white_gray_round2}"
                            android:drawableRight="@{viewModel.MPopupPositionTypeLD==1?@drawable/ic_drop_up_blue:@drawable/ic_drop_down_gray}"
                            android:gravity="center"
                            android:paddingLeft="@dimen/d_8dp"
                            android:paddingRight="@dimen/d_8dp"
                            android:text="全武汉"
                            android:textColor="@{viewModel.MPopupPositionTypeLD==1?@color/app_blue:@color/gray_66}"
                            android:textSize="@dimen/d_12sp"
                            tools:drawableRight="@drawable/ic_drop_down_gray" />

                        <com.guadou.lib_baselib.font_text_view.TextViewMedium
                            android:layout_width="0dp"
                            android:layout_height="@dimen/d_27dp"
                            android:layout_marginLeft="@dimen/d_5dp"
                            android:layout_weight="1"
                            android:background="@{viewModel.MPopupPositionTypeLD==2?@drawable/shape_blue_round2_border:@drawable/shape_white_gray_round2}"
                            android:drawableRight="@{viewModel.MPopupPositionTypeLD==2?@drawable/ic_drop_up_blue:@drawable/ic_drop_down_gray}"
                            android:gravity="center"
                            android:paddingLeft="@dimen/d_8dp"
                            android:paddingRight="@dimen/d_8dp"
                            android:text="职位类型"
                            android:textColor="@{viewModel.MPopupPositionTypeLD==2?@color/app_blue:@color/gray_66}"
                            android:textSize="@dimen/d_12sp"
                            tools:drawableRight="@drawable/ic_drop_down_gray" />

                        <com.guadou.lib_baselib.font_text_view.TextViewMedium
                            android:layout_width="0dp"
                            android:layout_height="@dimen/d_27dp"
                            android:layout_marginLeft="@dimen/d_5dp"
                            android:layout_weight="1"
                            android:background="@{viewModel.MPopupPositionTypeLD==3?@drawable/shape_blue_round2_border:@drawable/shape_white_gray_round2}"
                            android:drawableRight="@{viewModel.MPopupPositionTypeLD==3?@drawable/ic_drop_up_blue:@drawable/ic_drop_down_gray}"
                            android:gravity="center"
                            android:paddingLeft="@dimen/d_8dp"
                            android:paddingRight="@dimen/d_8dp"
                            android:text="日期"
                            android:textColor="@{viewModel.MPopupPositionTypeLD==3?@color/app_blue:@color/gray_66}"
                            android:textSize="@dimen/d_12sp"
                            tools:drawableRight="@drawable/ic_drop_down_gray" />

                        <com.guadou.lib_baselib.font_text_view.TextViewMedium
                            android:layout_width="0dp"
                            android:layout_height="@dimen/d_27dp"
                            android:layout_marginLeft="@dimen/d_5dp"
                            android:layout_weight="1"
                            android:background="@{viewModel.MPopupPositionTypeLD==4?@drawable/shape_blue_round2_border:@drawable/shape_white_gray_round2}"
                            android:drawableRight="@{viewModel.MPopupPositionTypeLD==4?@drawable/ic_drop_up_blue:@drawable/ic_drop_down_gray}"
                            android:gravity="center"
                            android:paddingLeft="@dimen/d_8dp"
                            android:paddingRight="@dimen/d_8dp"
                            android:text="筛选"
                            android:textColor="@{viewModel.MPopupPositionTypeLD==4?@color/app_blue:@color/gray_66}"
                            android:textSize="@dimen/d_12sp"
                            tools:drawableRight="@drawable/ic_drop_down_gray" />

                    </LinearLayout>

                    <View
                        android:id="@+id/view_popup_divider"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/d_1dp"
                        android:layout_marginTop="@dimen/d_10dp"
                        android:background="@color/main_divider" />

                </LinearLayout>

            </com.google.android.material.appbar.AppBarLayout>

            <!--   刷新+列表   -->
            <com.scwang.smart.refresh.layout.SmartRefreshLayout
                android:id="@+id/refresh_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:focusable="true"
                android:focusableInTouchMode="true"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                app:srlEnablePreviewInEditMode="true"
                app:srlPrimaryColor="@color/white"
                tools:visibility="gone">

                <com.scwang.smart.refresh.header.ClassicsHeader
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recycler_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:overScrollMode="never"
                    android:scrollbars="vertical">

                </androidx.recyclerview.widget.RecyclerView>

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

        </androidx.coordinatorlayout.widget.CoordinatorLayout>

    </LinearLayout>

</layout>
