Browse Source

提交人:jtm
提交内容:bug fix

江天明 2 years ago
parent
commit
16ffd65d8d

+ 2 - 2
BusinessCommon/src/main/res/layout/fragment_comme_list.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.drake.brv.PageRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.scwang.smart.refresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/page"
     android:layout_width="match_parent"
@@ -11,4 +11,4 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
-</com.drake.brv.PageRefreshLayout>
+</com.scwang.smart.refresh.layout.SmartRefreshLayout>

+ 8 - 1
BusinessMain/src/main/java/com/develop/main/ui/ModeEntranceActivity.kt

@@ -2,6 +2,7 @@ package com.develop.main.ui
 
 import android.os.Bundle
 import android.view.LayoutInflater
+import android.view.ViewGroup.LayoutParams
 import androidx.lifecycle.MutableLiveData
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.develop.base.ext.navigateTo
@@ -22,6 +23,7 @@ import com.develop.main.databinding.ActivityModeEntranceBinding
 import com.drake.brv.utils.grid
 import com.drake.brv.utils.models
 import com.drake.brv.utils.setup
+import com.smarx.notchlib.utils.ScreenUtil
 
 @Route(path = Screens.Main.ENTRANCE_CHOSEN)
 class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>() {
@@ -60,7 +62,12 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
             setup {
                 addType<EntranceData>(R.layout.item_entrance)
                 onBind {
-                    findView<EntranceItemView>(R.id.entrance_item).setEntranceData(getModel())
+                    val itemView = findView<EntranceItemView>(R.id.entrance_item)
+                    val params = itemView.layoutParams as LayoutParams
+                    params.height = (ScreenUtil.getScreenSize(this@ModeEntranceActivity)[1] / 2)
+                    itemView.layoutParams = params
+                    itemView.setEntranceData(getModel())
+
                 }
                 R.id.entrance_item.onClick {
                     val clickModel = getModel<EntranceData>()

+ 8 - 8
BusinessMain/src/main/java/com/develop/main/ui/RecipesFragment.kt

@@ -11,6 +11,7 @@ import android.widget.RelativeLayout
 import androidx.appcompat.widget.AppCompatTextView
 import androidx.databinding.ViewDataBinding
 import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
 import com.develop.base.ext.globalApp
 import com.develop.base.ext.navigateTo
 import com.develop.base.ext.resId2Dimension
@@ -118,6 +119,8 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
         sortDataList.addAll(DataFactory.genSortNameList(resources))
 
         binding.rv.apply {
+            setHasFixedSize(true)
+            isNestedScrollingEnabled = false
             linear()
             setup {
                 addType<String>(HOME_TITLE_PROVIDER)
@@ -180,10 +183,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
         }
         binding.page.apply {
             setEnableRefresh(false)
-            onRefresh {
-                refreshOnLineOrLocalRecipes()
-            }
-            onLoadMore {
+            setOnLoadMoreListener {
                 isRefresh = false
                 if (viewModel.recipesType == RecipesType.ONLINE) {
                     if (viewModel.currentPage < viewModel.totalPageSize) {
@@ -191,11 +191,11 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
                             categoryCode, viewModel.currCategoryName, isLoadMore = true
                         )
                     } else {
-                        finishLoadMore()
+                        finishLoadMore(0)
                     }
                 } else {
                     if (!viewModel.loadMoreLocalRecipes()) {
-                        finishLoadMore()
+                        finishLoadMore(0)
                     }
                 }
             }
@@ -365,7 +365,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
             //获取对应分类菜谱回调
             localRecipesLiveData.observe(viewLifecycleOwner) {
                 binding.page.apply {
-                    finishLoadMore()
+                    finishLoadMore(0)
                 }
                 binding.rv.apply {
                     models = it
@@ -378,7 +378,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
             //获取线上菜谱列表回调
             onLineRecipesLiveData.observe(viewLifecycleOwner) {
                 binding.page.apply {
-                    finishLoadMore()
+                    finishLoadMore(0)
                 }
                 binding.rv.apply {
                     models = it