|
@@ -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
|