|
@@ -36,7 +36,7 @@ class HomeViewModel : BaseViewModel() {
|
|
|
var recipesType = RecipesType.LOCAL
|
|
|
var isFromDownloadNewRecipesEntrance = false
|
|
|
var currentPage = 1
|
|
|
- var currentPageSize = 10
|
|
|
+ var currentPageSize = 12
|
|
|
var totalPageSize = 1
|
|
|
var sortedType = SortedType.Popular
|
|
|
var homeOrBackLiveData = MutableLiveData<HomeOrBack>()
|
|
@@ -46,7 +46,7 @@ class HomeViewModel : BaseViewModel() {
|
|
|
private var totalLocalRecipes = mutableListOf<DevRecipe>()
|
|
|
private var totalLocalSize = 0
|
|
|
private var startSize = 0
|
|
|
- private var endSize = 10
|
|
|
+ private var endSize = 12
|
|
|
private var lastLocalRecipesShowList = mutableListOf<Any>()
|
|
|
private var hasMoreLocal = false
|
|
|
private var lastLocalRecipeList = mutableListOf<DevRecipe>()
|
|
@@ -65,7 +65,7 @@ class HomeViewModel : BaseViewModel() {
|
|
|
fun queryLocalRecipes(categoryNum: String) {
|
|
|
scope(Dispatchers.IO) {
|
|
|
startSize = 0
|
|
|
- endSize = 10
|
|
|
+ endSize = 12
|
|
|
localFavoriteRecipesList =
|
|
|
FoodDataProvider.getUserDatabase().userInfoDao().queryFavoriteRecipes(userId)
|
|
|
.toMutableList()
|
|
@@ -78,12 +78,12 @@ class HomeViewModel : BaseViewModel() {
|
|
|
.toMutableList()
|
|
|
}
|
|
|
totalLocalSize = totalLocalRecipes.size
|
|
|
- val localRecipeList = if (totalLocalSize < 10) {
|
|
|
+ val localRecipeList = if (totalLocalSize < 12) {
|
|
|
hasMoreLocal = false
|
|
|
totalLocalRecipes
|
|
|
} else {
|
|
|
hasMoreLocal = true
|
|
|
- totalLocalRecipes.subList(0, 10)
|
|
|
+ totalLocalRecipes.subList(0, 12)
|
|
|
}
|
|
|
lastLocalRecipeList.clear()
|
|
|
lastLocalRecipeList.addAll(localRecipeList)
|
|
@@ -102,7 +102,7 @@ class HomeViewModel : BaseViewModel() {
|
|
|
fun loadMoreLocalRecipes(): Boolean {
|
|
|
if (hasMoreLocal) {
|
|
|
startSize = endSize
|
|
|
- endSize = startSize + 10
|
|
|
+ endSize = startSize + 12
|
|
|
if (endSize > totalLocalSize) {
|
|
|
endSize = totalLocalSize
|
|
|
hasMoreLocal = false
|
|
@@ -275,7 +275,7 @@ class HomeViewModel : BaseViewModel() {
|
|
|
|
|
|
private fun resetOnlineConfig() {
|
|
|
currentPage = 1
|
|
|
- currentPageSize = 10
|
|
|
+ currentPageSize = 12
|
|
|
totalPageSize = 1
|
|
|
tempOnLineRecipes.clear()
|
|
|
}
|