Browse Source

1.首页兼职列表的顶部布局
2.全部兼职列表的Item还需要改动

liukai 2 years ago
parent
commit
9897bb687d
22 changed files with 421 additions and 240 deletions
  1. 2 2
      cpt_ewallet/src/main/res/layout/item_ewallet_history.xml
  2. 0 1
      cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/adapter/PartTimeJobAdapter.kt
  3. 34 17
      cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/mvvm/PartTimeMainViewModel.kt
  4. 34 32
      cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/ui/PartTimeMainFragment.kt
  5. 11 0
      cpt_parttime/src/main/res/color/selector_filter_date.xml
  6. 11 0
      cpt_parttime/src/main/res/color/selector_filter_industry.xml
  7. 11 0
      cpt_parttime/src/main/res/color/selector_filter_option.xml
  8. BIN
      cpt_parttime/src/main/res/drawable-xhdpi/part_new_job_item_bg.webp
  9. BIN
      cpt_parttime/src/main/res/drawable-xxhdpi/date_black.webp
  10. BIN
      cpt_parttime/src/main/res/drawable-xxhdpi/industry_black.webp
  11. BIN
      cpt_parttime/src/main/res/drawable-xxhdpi/location_address_icon.webp
  12. BIN
      cpt_parttime/src/main/res/drawable-xxhdpi/part_filterby_white.png
  13. 112 171
      cpt_parttime/src/main/res/layout/fragment_parttime_main.xml
  14. 190 0
      cpt_parttime/src/main/res/layout/item_part_time_new_job.xml
  15. 1 0
      cs_baselib/src/main/res/values/colors.xml
  16. 1 1
      cs_baselib/src/main/res/values/styles.xml
  17. 5 0
      cs_cptServices/src/main/java/com/guadou/cs_cptservices/binding/BindingView.kt
  18. 0 0
      cs_cptServices/src/main/res/drawable-xhdpi/placeholder_img_job_img.webp
  19. 0 16
      cs_cptServices/src/main/res/drawable/selector_btn_white_gray_bg.xml
  20. 7 0
      cs_cptServices/src/main/res/drawable/selector_white_item_click_bg.xml
  21. 0 0
      cs_cptServices/src/main/res/drawable/selector_white_round10_item_click_bg.xml
  22. 2 0
      cs_cptServices/src/main/res/values/colors.xml

+ 2 - 2
cpt_ewallet/src/main/res/layout/item_ewallet_history.xml

@@ -32,7 +32,7 @@
                 android:layout_marginLeft="@dimen/d_14dp"
                 android:layout_marginTop="@dimen/d_16dp"
                 android:scaleType="centerCrop"
-                android:src="@drawable/plachholder_img_job_img" />
+                android:src="@drawable/placeholder_img_job_img" />
 
             <com.guadou.lib_baselib.font_text_view.TextViewMedium
                 android:layout_width="0dp"
@@ -70,7 +70,7 @@
                 android:layout_marginRight="@dimen/d_17dp"
                 android:text="+30.25"
                 android:textColor="@color/profile_red"
-                android:textSize="@dimen/d_24sp" />
+                android:textSize="@dimen/d_20sp" />
 
         </RelativeLayout>
 

+ 0 - 1
cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/adapter/PartTimeJobAdapter.kt

@@ -43,7 +43,6 @@ class PartTimeJobAdapter(br: Int, list: MutableList<PartJobResult>) :
         //不方便做DataBinding的操作 ↓
         if (holder.itemViewType == PartJobResult.TYPE_ITEM) {
 
-
         } else if (holder.itemViewType == PartJobResult.TYPE_BANNER) {
 
             val imageUrl = "http://i03piccdn.sogoucdn.com/dbbea331b73acd7d"

+ 34 - 17
cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/mvvm/PartTimeMainViewModel.kt

@@ -4,41 +4,59 @@ import android.annotation.SuppressLint
 import androidx.lifecycle.LiveData
 import androidx.lifecycle.MutableLiveData
 import androidx.lifecycle.SavedStateHandle
+import com.guadou.cs_cptservices.binding.BaseDataBindingAdapter
 import com.guadou.lib_baselib.base.vm.BaseViewModel
 import com.guadou.lib_baselib.ext.checkEmpty
 import com.hongyegroup.cpt_parttime.BR
+import com.hongyegroup.cpt_parttime.R
 import com.hongyegroup.cpt_parttime.adapter.PartTimeJobAdapter
 import com.hongyegroup.cpt_parttime.bean.PartJobResult
 import dagger.hilt.android.lifecycle.HiltViewModel
 import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.async
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.withContext
 import javax.inject.Inject
 
+@SuppressLint("NotifyDataSetChanged")
 @HiltViewModel
 class PartTimeMainViewModel @Inject constructor(
     private val savedStateHandle: SavedStateHandle
 ) : BaseViewModel() {
 
     val mKeywordLiveData = MutableLiveData<String>()  //搜索Key值
-    val mSortTypeLD = MutableLiveData(1)  //排序类型值 1.推荐 2.最新 3.附近
-    val mPopupPositionTypeLD = MutableLiveData(0)  //下拉选变色记录索引
-
     var mCurPage = 1
     private var isNeedPlaceHolder = true
     var isNeedCleanAllData = true
-    var mDatas = mutableListOf<PartJobResult>()
-    val mAdapter by lazy { PartTimeJobAdapter(BR.item, mDatas) }
+
+    var mNewsJobDataes = mutableListOf<String>()
+    val mNewJobAdapter by lazy { BaseDataBindingAdapter(R.layout.item_part_time_new_job, BR.item, mNewsJobDataes) }
+
+    var mAllJobDataes = mutableListOf<PartJobResult>()
+    val mAllJobAdapter by lazy { PartTimeJobAdapter(BR.item, mAllJobDataes) }
 
     /**
      * 获取兼职工作列表
      */
+
     fun requestJobList(): LiveData<Boolean> {
         val liveData = MutableLiveData<Boolean>()
 
         launchOnUI {
             //开始Loading
             if (isNeedPlaceHolder) loadStartLoading()
+
+
+            async {
+                if (mCurPage == 1) {
+                    mNewsJobDataes.clear()
+                    for (i in 1..5) {
+                        mNewsJobDataes.add(i.toString())
+                    }
+                }
+            }
+            mNewJobAdapter.notifyDataSetChanged()
+
             val result = withContext(Dispatchers.IO) {
                 delay(1000)
 
@@ -83,31 +101,30 @@ class PartTimeMainViewModel @Inject constructor(
     }
 
     //处理数据-添加或刷新
-    @SuppressLint("NotifyDataSetChanged")
     private fun handleData(list: List<PartJobResult>?) {
         if (!list.checkEmpty()) {
             //有数据,判断是刷新还是加载更多的数据
             if (isNeedCleanAllData) {
                 //刷新的方式
-                mDatas.clear()
-                mDatas.addAll(list!!)
-                mAdapter.notifyDataSetChanged()
+                mAllJobDataes.clear()
+                mAllJobDataes.addAll(list!!)
+                mAllJobAdapter.notifyDataSetChanged()
             } else {
                 //加载更多
-                mDatas.addAll(list!!)
-                mAdapter.notifyItemRangeInserted(mDatas.size - list.size, list.size)
-                mAdapter.loadMoreModule.loadMoreComplete()
+                mAllJobDataes.addAll(list!!)
+                mAllJobAdapter.notifyItemRangeInserted(mAllJobDataes.size - list.size, list.size)
+                mAllJobAdapter.loadMoreModule.loadMoreComplete()
             }
         } else {
             //展示无数据
             if (isNeedCleanAllData && mCurPage == 1) {
-                mDatas.clear()
-                mDatas.add(PartJobResult())  //空视图
-                mAdapter.notifyDataSetChanged()
-                mAdapter.loadMoreModule.loadMoreEnd()
+                mAllJobDataes.clear()
+                mAllJobDataes.add(PartJobResult())  //空视图
+                mAllJobAdapter.notifyDataSetChanged()
+                mAllJobAdapter.loadMoreModule.loadMoreEnd()
             } else {
                 //如果是加载更多,展示加载完成,没有更多数据了
-                mAdapter.loadMoreModule.loadMoreEnd()
+                mAllJobAdapter.loadMoreModule.loadMoreEnd()
             }
         }
         isNeedPlaceHolder = false

+ 34 - 32
cpt_parttime/src/main/java/com/hongyegroup/cpt_parttime/ui/PartTimeMainFragment.kt

@@ -12,6 +12,7 @@ import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
 import com.guadou.lib_baselib.bean.DataBindingConfig
 import com.guadou.lib_baselib.engine.toast
 import com.guadou.lib_baselib.ext.dp2px
+import com.guadou.lib_baselib.ext.horizontal
 import com.guadou.lib_baselib.ext.vertical
 import com.guadou.lib_baselib.utils.KeyboardUtils
 import com.hongyegroup.cpt_parttime.BR
@@ -20,6 +21,7 @@ import com.hongyegroup.cpt_parttime.databinding.FragmentParttimeMainBinding
 import com.hongyegroup.cpt_parttime.mvvm.PartTimeMainViewModel
 import com.scwang.smart.refresh.layout.api.RefreshLayout
 import com.scwang.smart.refresh.layout.listener.OnRefreshListener
+import kotlinx.coroutines.flow.MutableStateFlow
 
 /**
  * 兼职模块的首页Frgment
@@ -48,7 +50,7 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
     private fun initData() {
         mViewModel.requestJobList().observe(this) {
             mBinding.refreshLayout.finishRefresh()
-            mViewModel.mAdapter.loadMoreModule.isEnableLoadMore = true
+            mViewModel.mAllJobAdapter.loadMoreModule.isEnableLoadMore = true
 
             //清楚悬停头缓存
             if (mViewModel.isNeedCleanAllData) {
@@ -58,21 +60,23 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
     }
 
     private fun initRV() {
+        //顶部的横向RV使用
+        mBinding.rvNewJob.horizontal().adapter = mViewModel.mNewJobAdapter
 
         //悬停头的定义
         val listener: PowerGroupListener = object : PowerGroupListener {
             override fun getGroupName(position: Int): String? {
                 //获取组名,用于判断是否是同一组
-                return if (mViewModel.mDatas.size > position) {
-                    mViewModel.mDatas[position].groupDate
+                return if (mViewModel.mAllJobDataes.size > position) {
+                    mViewModel.mAllJobDataes[position].groupDate
                 } else null
             }
 
             override fun getGroupView(position: Int): View {
                 //获取自定定义的组View
-                return if (mViewModel.mDatas.size > position) {
+                return if (mViewModel.mAllJobDataes.size > position) {
                     layoutInflater.inflate(R.layout.item_header_job_date, null, false).apply {
-                        findViewById<TextView>(R.id.tv_head_job_date).text = mViewModel.mDatas[position].groupDate
+                        findViewById<TextView>(R.id.tv_head_job_date).text = mViewModel.mAllJobDataes[position].groupDate
                     }
                 } else {
                     View(mActivity).apply { setBackgroundColor(Color.WHITE) }
@@ -89,18 +93,18 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
             .build()
 
         //设置悬停头和Adapter
-        mBinding.recyclerView.vertical()
+        mBinding.rvAllJob.vertical()
             .apply {
                 addItemDecoration(mTopDecoration!!)
-                adapter = mViewModel.mAdapter
+                adapter = mViewModel.mAllJobAdapter
             }
     }
 
     private fun initListener() {
         //Adapter的滑动监听,监听加载更多
-        mViewModel.mAdapter.loadMoreModule.isEnableLoadMore = false
-        mViewModel.mAdapter.loadMoreModule.preLoadNumber = 4
-        mViewModel.mAdapter.loadMoreModule.setOnLoadMoreListener(this)
+        mViewModel.mAllJobAdapter.loadMoreModule.isEnableLoadMore = false
+        mViewModel.mAllJobAdapter.loadMoreModule.preLoadNumber = 4
+        mViewModel.mAllJobAdapter.loadMoreModule.setOnLoadMoreListener(this)
 
         //刷新控件初始化
         mBinding.refreshLayout.setEnableNestedScroll(true)
@@ -109,9 +113,9 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
         mBinding.refreshLayout.setOnRefreshListener(this)
 
         //Item点击
-        mViewModel.mAdapter.addChildClickViewIds(R.id.ll_job_root, R.id.cl_banner_root)
-        mViewModel.mAdapter.setOnItemChildClickListener { _, view, position ->
-            val item = mViewModel.mDatas[position]
+        mViewModel.mAllJobAdapter.addChildClickViewIds(R.id.ll_job_root, R.id.cl_banner_root)
+        mViewModel.mAllJobAdapter.setOnItemChildClickListener { _, view, position ->
+            val item = mViewModel.mAllJobDataes[position]
             when (view.id) {
                 R.id.ll_job_root -> {
                     mClickProxy.gotoJobDetailPage()
@@ -120,14 +124,18 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
                     toast("点击banner")
                 }
             }
+        }
 
+        //新工作的点击-进入详情
+        mViewModel.mNewJobAdapter.setOnItemClickListener { _, view, position ->
+            mClickProxy.gotoJobDetailPage()
         }
     }
 
     override fun onRefresh(refreshLayout: RefreshLayout) {
         mViewModel.isNeedCleanAllData = true
-        mViewModel.mAdapter.loadMoreModule.loadMoreComplete()
-        mViewModel.mAdapter.loadMoreModule.isEnableLoadMore = false
+        mViewModel.mAllJobAdapter.loadMoreModule.loadMoreComplete()
+        mViewModel.mAllJobAdapter.loadMoreModule.isEnableLoadMore = false
         //直接调用,参数从成员变量中获取
         mViewModel.mCurPage = 1
         initData()
@@ -141,10 +149,11 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
 
     //自动刷新
     override fun scrollTopRefresh() {
-        if (mViewModel.mDatas.size > 1) {
-            mBinding.recyclerView.scrollToPosition(0)
+        if (mViewModel.mAllJobDataes.size > 1) {
+            mBinding.rvAllJob.scrollToPosition(0)
         }
         mBinding.refreshLayout.autoRefresh()
+
     }
 
     /**
@@ -152,6 +161,8 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
      */
     inner class ClickProxy {
 
+        var filterIndex = MutableStateFlow(-1)
+
         //执行搜索
         fun doSearch() {
             KeyboardUtils.hideSoftInput(mActivity)
@@ -164,31 +175,22 @@ class PartTimeMainFragment : YYBaseVDBFragment<PartTimeMainViewModel, FragmentPa
             doSearch()
         }
 
-        //跳转页面-选择城市
-        fun gotoChooseCityPage() {
-
-        }
-
         //跳转页面-兼职工作详情
         fun gotoJobDetailPage() {
             PartTimeJobDetailActivity.startInstance()
         }
 
-        //推荐的排序
-        fun switchReCommend() {
-            mViewModel.mSortTypeLD.value = 1
+        fun filterIndustry() {
+            filterIndex.value = 0
         }
 
-        //最新的排序
-        fun switchlatested() {
-            mViewModel.mSortTypeLD.value = 2
+        fun filterDate() {
+            filterIndex.value = 1
         }
 
-        //附近的排序
-        fun switchNearby() {
-            mViewModel.mSortTypeLD.value = 3
+        fun filterOption() {
+            filterIndex.value = 2
         }
-
     }
 
 }

+ 11 - 0
cpt_parttime/src/main/res/color/selector_filter_date.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/white" android:state_selected="true" />
+    <item android:color="@color/white" android:state_active="true" />
+    <item android:color="@color/white" android:state_pressed="true" />
+    <item android:color="@color/white" android:state_checked="true" />
+    <item android:color="@color/app_blue" android:state_selected="false" />
+    <item android:color="@color/app_blue" android:state_active="false" />
+    <item android:color="@color/app_blue" android:state_pressed="false" />
+    <item android:color="@color/app_blue" android:state_checked="false" />
+</selector>

+ 11 - 0
cpt_parttime/src/main/res/color/selector_filter_industry.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/white" android:state_selected="true" />
+    <item android:color="@color/white" android:state_active="true" />
+    <item android:color="@color/white" android:state_pressed="true" />
+    <item android:color="@color/white" android:state_checked="true" />
+    <item android:color="@color/text_yellow_ff9300" android:state_selected="false" />
+    <item android:color="@color/text_yellow_ff9300" android:state_active="false" />
+    <item android:color="@color/text_yellow_ff9300" android:state_pressed="false" />
+    <item android:color="@color/text_yellow_ff9300" android:state_checked="false" />
+</selector>

+ 11 - 0
cpt_parttime/src/main/res/color/selector_filter_option.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/white" android:state_selected="true" />
+    <item android:color="@color/white" android:state_active="true" />
+    <item android:color="@color/white" android:state_pressed="true" />
+    <item android:color="@color/white" android:state_checked="true" />
+    <item android:color="@color/profile_red" android:state_selected="false" />
+    <item android:color="@color/profile_red" android:state_active="false" />
+    <item android:color="@color/profile_red" android:state_pressed="false" />
+    <item android:color="@color/profile_red" android:state_checked="false" />
+</selector>

BIN
cpt_parttime/src/main/res/drawable-xhdpi/part_new_job_item_bg.webp


BIN
cpt_parttime/src/main/res/drawable-xxhdpi/date_black.webp


BIN
cpt_parttime/src/main/res/drawable-xxhdpi/industry_black.webp


BIN
cpt_parttime/src/main/res/drawable-xxhdpi/location_address_icon.webp


BIN
cpt_parttime/src/main/res/drawable-xxhdpi/part_filterby_white.png


+ 112 - 171
cpt_parttime/src/main/res/layout/fragment_parttime_main.xml

@@ -40,31 +40,6 @@
             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"
@@ -106,180 +81,146 @@
 
             </LinearLayout>
 
+
         </LinearLayout>
 
         <View
             android:layout_width="match_parent"
-            android:layout_height="@dimen/d_1dp"
+            android:layout_height="@dimen/d_0.7dp"
             android:background="@color/main_divider" />
 
-        <androidx.coordinatorlayout.widget.CoordinatorLayout
+        <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:paddingTop="@dimen/d_8dp"
+            android:paddingBottom="@dimen/d_10dp">
 
-            <!--    顶部的筛选     -->
-            <com.google.android.material.appbar.AppBarLayout
-                android:id="@+id/app_bar_layout"
-                android:layout_width="match_parent"
+            <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                android:id="@+id/tv_filter_industry"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@{click.filterIndex == 0? @drawable/shape_blue_round5 : @drawable/shape_white_round5}"
+                android:drawableLeft="@drawable/industry_black"
+                android:drawablePadding="@dimen/d_8dp"
+                android:paddingLeft="@dimen/d_21dp"
+                android:paddingTop="@dimen/d_8dp"
+                android:paddingRight="@dimen/d_24dp"
+                android:paddingBottom="@dimen/d_9dp"
+                android:text="行业"
+                android:textColor="@{click.filterIndex == 0? @color/white : @color/black}"
+                android:textSize="@dimen/d_16sp"
+                app:drawableTint="@color/selector_filter_industry"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintLeft_toLeftOf="parent"
+                app:layout_constraintRight_toLeftOf="@id/tv_filter_date"
+                app:layout_constraintTop_toTopOf="parent"
+                binding:clicks="@{click.filterIndustry}"
+                binding:setSelected="@{click.filterIndex == 0}" />
+
+            <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                android:id="@+id/tv_filter_date"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@{click.filterIndex == 1? @drawable/shape_blue_round5 : @drawable/shape_white_round5}"
+                android:drawableLeft="@drawable/date_black"
+                android:drawablePadding="@dimen/d_9dp"
+                android:paddingLeft="@dimen/d_21dp"
+                android:paddingTop="@dimen/d_8dp"
+                android:paddingRight="@dimen/d_24dp"
+                android:paddingBottom="@dimen/d_9dp"
+                android:text="日期"
+                android:textColor="@{click.filterIndex == 1? @color/white : @color/black}"
+                android:textSize="@dimen/d_16sp"
+                app:drawableTint="@color/selector_filter_date"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintLeft_toRightOf="@id/tv_filter_industry"
+                app:layout_constraintRight_toLeftOf="@id/tv_filter_option"
+                app:layout_constraintTop_toTopOf="parent"
+                binding:clicks="@{click.filterDate}"
+                binding:setSelected="@{click.filterIndex == 1}" />
+
+            <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                android:id="@+id/tv_filter_option"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:background="@color/white">
+                android:background="@{click.filterIndex == 2? @drawable/shape_blue_round5 : @drawable/shape_white_round5}"
+                android:drawableLeft="@drawable/part_filterby_white"
+                android:drawablePadding="@dimen/d_10dp"
+                android:paddingLeft="@dimen/d_21dp"
+                android:paddingTop="@dimen/d_8dp"
+                android:paddingRight="@dimen/d_24dp"
+                android:paddingBottom="@dimen/d_9dp"
+                android:text="筛选"
+                android:textColor="@{click.filterIndex == 2? @color/white : @color/black}"
+                android:textSize="@dimen/d_16sp"
+                app:drawableTint="@color/selector_filter_option"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintLeft_toRightOf="@id/tv_filter_date"
+                app:layout_constraintRight_toRightOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                binding:clicks="@{click.filterOption}"
+                binding:setSelected="@{click.filterIndex == 2}" />
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <!--   刷新+列表   -->
+        <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: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" />
 
-                <LinearLayout
+            <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"
-                    android:orientation="vertical"
-                    app:layout_scrollFlags="scroll|snap|enterAlways">
+                    android:background="@color/page_bg_f4"
+                    app:elevation="0dp">
 
                     <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:layout_height="166dp"
                         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" />
+                        app:layout_scrollFlags="scroll">
 
-                    </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" />
+                        <androidx.recyclerview.widget.RecyclerView
+                            android:id="@+id/rv_new_job"
+                            android:layout_width="match_parent"
+                            android:layout_height="match_parent"
+                            android:overScrollMode="never"
+                            android:scrollbars="none" />
 
-                </LinearLayout>
-
-            </com.google.android.material.appbar.AppBarLayout>
+                    </LinearLayout>
 
-            <!--   刷新+列表   -->
-            <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" />
+                </com.google.android.material.appbar.AppBarLayout>
 
                 <androidx.recyclerview.widget.RecyclerView
-                    android:id="@+id/recycler_view"
+                    android:id="@+id/rv_all_job"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:overScrollMode="never"
-                    android:scrollbars="vertical">
+                    android:scrollbars="vertical"
+                    app:layout_behavior="@string/appbar_scrolling_view_behavior">
 
                 </androidx.recyclerview.widget.RecyclerView>
 
-            </com.scwang.smart.refresh.layout.SmartRefreshLayout>
+            </androidx.coordinatorlayout.widget.CoordinatorLayout>
 
-        </androidx.coordinatorlayout.widget.CoordinatorLayout>
+        </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 
     </LinearLayout>
 

+ 190 - 0
cpt_parttime/src/main/res/layout/item_part_time_new_job.xml

@@ -0,0 +1,190 @@
+<?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">
+
+    <data>
+
+        <variable
+            name="item"
+            type="String" />
+
+        <import type="android.text.TextUtils" />
+
+    </data>
+
+    <LinearLayout
+        android:layout_width="316dp"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="-5dp"
+        android:background="@drawable/part_new_job_item_bg"
+        android:orientation="vertical">
+
+        <com.guadou.lib_baselib.font_text_view.TextViewBold
+            android:id="@+id/tv_job_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_23dp"
+            android:layout_marginTop="@dimen/d_15dp"
+            android:layout_marginRight="@dimen/d_23dp"
+            android:gravity="center_vertical"
+            android:ellipsize="end"
+            android:lines="2"
+            android:lineHeight="@dimen/d_17dp"
+            android:text="香格里拉大酒店需要大量经验丰富的员工,至少10人"
+            android:textAllCaps="true"
+            android:textColor="@color/notify_dark_blue"
+            android:textSize="@dimen/d_16sp" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_23dp"
+            android:layout_marginTop="@dimen/d_5dp"
+            android:layout_marginRight="@dimen/d_23dp"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/iv_job_img"
+                android:layout_width="60dp"
+                android:layout_height="43dp"
+                android:background="@drawable/placeholder_img_job_img"
+                android:scaleType="centerCrop" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="center_vertical"
+                android:orientation="vertical">
+
+                <!--   date   -->
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:gravity="center_vertical"
+                    android:orientation="horizontal">
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="@dimen/d_10dp"
+                        android:text="日期:"
+                        android:textColor="@color/gray_76"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_date"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:text="2022/06/29 周三"
+                        android:textColor="@color/text_orange_ff9300"
+                        android:textSize="@dimen/d_14sp" />
+
+                </LinearLayout>
+
+
+                <!--   time   -->
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:gravity="center_vertical"
+                    android:orientation="horizontal">
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginStart="@dimen/d_10dp"
+                        android:layout_marginLeft="@dimen/d_10dp"
+                        android:text="时间:"
+                        android:textColor="@color/gray_76"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_time"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:fontFamily="sans-serif-light"
+                        android:text="06:00-23:30"
+                        android:textColor="@color/text_orange_ff9300"
+                        android:textSize="@dimen/d_14sp" />
+
+                </LinearLayout>
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_0.7dp"
+            android:layout_marginLeft="@dimen/d_9dp"
+            android:layout_marginTop="@dimen/d_12dp"
+            android:layout_marginRight="@dimen/d_9dp"
+            android:background="@color/divider_color_de" />
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:gravity="center_vertical"
+            android:orientation="horizontal"
+            android:paddingBottom="8dp">
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/d_23dp"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+
+                <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="5dp"
+                    android:text="总计"
+                    android:textColor="@color/gray_76"
+                    android:textSize="@dimen/d_15sp" />
+
+                <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                    android:id="@+id/tv_total_money"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="¥80"
+                    android:textColor="@color/profile_red"
+                    android:textSize="@dimen/d_20sp" />
+
+            </LinearLayout>
+
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="1dp"
+                android:layout_weight="1" />
+
+            <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                android:id="@+id/tv_job_rate"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="¥10"
+                android:textColor="@color/app_blue"
+                android:textSize="@dimen/d_15sp" />
+
+            <com.guadou.lib_baselib.font_text_view.TextViewRegular
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="@dimen/d_23dp"
+                android:text="/时"
+                android:textColor="@color/gray_76"
+                android:textSize="@dimen/d_15sp"
+                android:textStyle="bold" />
+
+        </LinearLayout>
+
+
+    </LinearLayout>
+
+</layout>

+ 1 - 0
cs_baselib/src/main/res/values/colors.xml

@@ -9,6 +9,7 @@
     <color name="white">#ffffff</color>
     <color name="black">#000000</color>
     <color name="divider_color">#D2D2D2</color>
+    <color name="divider_color_de">#dedede</color>
     <color name="divider_color_f0">#f0f0f0</color>
     <color name="divider_color_f689">#f6f8f9</color>
     <color name="gray">#cccccc</color>

+ 1 - 1
cs_baselib/src/main/res/values/styles.xml

@@ -7,7 +7,7 @@
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
         <item name="colorAccent">@color/colorAccent</item>
         <item name="android:windowAnimationStyle">@style/my_animation_activity</item>
-        <item name="android:windowBackground">@null</item>
+<!--        <item name="android:windowBackground">@null</item>-->
     </style>
 
     <style name="AppThemeLight" parent="Theme.AppCompat.DayNight.NoActionBar">

+ 5 - 0
cs_cptServices/src/main/java/com/guadou/cs_cptservices/binding/BindingView.kt

@@ -17,6 +17,11 @@ fun isInVisible(view: View, isVisible: Boolean) {
     view.visibility = if (isVisible) View.VISIBLE else View.INVISIBLE
 }
 
+@BindingAdapter("setSelected")
+fun setSelected(view: View, isSelected: Boolean) {
+    view.isSelected = isSelected
+}
+
 /**
  * 点击事件防抖动的点击
  */

cs_cptServices/src/main/res/drawable-xhdpi/plachholder_img_job_img.webp → cs_cptServices/src/main/res/drawable-xhdpi/placeholder_img_job_img.webp


+ 0 - 16
cs_cptServices/src/main/res/drawable/selector_btn_white_gray_bg.xml

@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item android:state_pressed="true">
-        <shape android:shape="rectangle">
-            <solid android:color="@color/white_pressed" />
-        </shape>
-    </item>
-
-    <item android:state_pressed="false">
-        <shape android:shape="rectangle">
-            <solid android:color="@color/white" />
-        </shape>
-    </item>
-
-</selector>

+ 7 - 0
cs_cptServices/src/main/res/drawable/selector_white_item_click_bg.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@color/white_pressed" android:state_pressed="true" />
+    <item android:drawable="@color/white" />
+
+</selector>

cs_cptServices/src/main/res/drawable/selector_profile_me_bg.xml → cs_cptServices/src/main/res/drawable/selector_white_round10_item_click_bg.xml


+ 2 - 0
cs_cptServices/src/main/res/values/colors.xml

@@ -2,6 +2,7 @@
 <resources>
 
     <color name="page_bg">#f1f1f1</color>
+    <color name="page_bg_f4">#f4f4f4</color>
     <color name="app_blue">#0689fb</color>
     <color name="app_blue_selected_pre">#990689FB</color>
     <color name="gray_99">#999999</color>
@@ -12,6 +13,7 @@
     <color name="black_33">#333333</color>
     <color name="main_divider">#ECECEC</color>
     <color name="text_orange">#FD4C00</color>
+    <color name="text_orange_ff9300">#FF9300</color>
     <color name="text_blue">#008CFF</color>
     <color name="text_blue_3779ff">#3779FF</color>
     <color name="profile_red">#FF5E75</color>