|
@@ -7,13 +7,14 @@ import com.develop.common.data_repo.db.entity.DevRecipe
|
|
import com.develop.common.data_repo.db.entity.UserFavoriteRecipes
|
|
import com.develop.common.data_repo.db.entity.UserFavoriteRecipes
|
|
import com.develop.common.widget.EntranceData
|
|
import com.develop.common.widget.EntranceData
|
|
import com.develop.common.widget.EntranceType
|
|
import com.develop.common.widget.EntranceType
|
|
|
|
+import com.drake.brv.item.ItemHover
|
|
|
|
|
|
|
|
|
|
object DataFactory {
|
|
object DataFactory {
|
|
|
|
|
|
fun createLanguageData(resource: Resources): MutableList<LanguageModel> {
|
|
fun createLanguageData(resource: Resources): MutableList<LanguageModel> {
|
|
val languageList = mutableListOf<LanguageModel>()
|
|
val languageList = mutableListOf<LanguageModel>()
|
|
- val strList = if (isNightTheme()){
|
|
|
|
|
|
+ val strList = if (isNightTheme()) {
|
|
mutableListOf<String>(
|
|
mutableListOf<String>(
|
|
// resource.getString(R.string.chinese),
|
|
// resource.getString(R.string.chinese),
|
|
resource.getString(R.string.france),
|
|
resource.getString(R.string.france),
|
|
@@ -27,11 +28,11 @@ object DataFactory {
|
|
// resource.getString(R.string.japan)
|
|
// resource.getString(R.string.japan)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
- val iconList = if (isNightTheme()){
|
|
|
|
|
|
+ val iconList = if (isNightTheme()) {
|
|
mutableListOf<Int>(
|
|
mutableListOf<Int>(
|
|
//
|
|
//
|
|
// R.drawable.ic_chinese,
|
|
// R.drawable.ic_chinese,
|
|
- R.drawable.ic_france
|
|
|
|
|
|
+ R.drawable.ic_france
|
|
)
|
|
)
|
|
} else {
|
|
} else {
|
|
mutableListOf<Int>(
|
|
mutableListOf<Int>(
|
|
@@ -41,7 +42,7 @@ object DataFactory {
|
|
// R.drawable.ic_japan
|
|
// R.drawable.ic_japan
|
|
)
|
|
)
|
|
}
|
|
}
|
|
- val typeList = if (isNightTheme()){
|
|
|
|
|
|
+ val typeList = if (isNightTheme()) {
|
|
mutableListOf<LanguageType>(
|
|
mutableListOf<LanguageType>(
|
|
// LanguageType.Chinese,
|
|
// LanguageType.Chinese,
|
|
LanguageType.France
|
|
LanguageType.France
|
|
@@ -163,25 +164,19 @@ object DataFactory {
|
|
|
|
|
|
)
|
|
)
|
|
val nameList = mutableListOf(
|
|
val nameList = mutableListOf(
|
|
- resource.getString(R.string.language),
|
|
|
|
- resource.getString(R.string.wifi),
|
|
|
|
|
|
+ resource.getString(R.string.language), resource.getString(R.string.wifi),
|
|
// resource.getString(R.string.sound),
|
|
// resource.getString(R.string.sound),
|
|
- resource.getString(R.string.brightness),
|
|
|
|
- resource.getString(R.string.user_account),
|
|
|
|
|
|
+ resource.getString(R.string.brightness), resource.getString(R.string.user_account),
|
|
// resource.getString(R.string.storage),
|
|
// resource.getString(R.string.storage),
|
|
- resource.getString(R.string.reset),
|
|
|
|
- resource.getString(R.string.about)
|
|
|
|
|
|
+ resource.getString(R.string.reset), resource.getString(R.string.about)
|
|
|
|
|
|
)
|
|
)
|
|
val settingTypeList = mutableListOf(
|
|
val settingTypeList = mutableListOf(
|
|
- SettingType.LANGUAGE,
|
|
|
|
- SettingType.WIFI,
|
|
|
|
|
|
+ SettingType.LANGUAGE, SettingType.WIFI,
|
|
// SettingType.SOUND,
|
|
// SettingType.SOUND,
|
|
- SettingType.BRIGHTNESS,
|
|
|
|
- SettingType.USER_ACCOUNT,
|
|
|
|
|
|
+ SettingType.BRIGHTNESS, SettingType.USER_ACCOUNT,
|
|
// SettingType.STORAGE,
|
|
// SettingType.STORAGE,
|
|
- SettingType.RESTORE_FACTORY_SETTINGS,
|
|
|
|
- SettingType.ABOUT
|
|
|
|
|
|
+ SettingType.RESTORE_FACTORY_SETTINGS, SettingType.ABOUT
|
|
)
|
|
)
|
|
for (i in resIdList.indices) {
|
|
for (i in resIdList.indices) {
|
|
result.add(SettingModel(resIdList[i], nameList[i], settingTypeList[i]))
|
|
result.add(SettingModel(resIdList[i], nameList[i], settingTypeList[i]))
|
|
@@ -189,6 +184,7 @@ object DataFactory {
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
fun genLocalRecipes(
|
|
fun genLocalRecipes(
|
|
categoryName: String,
|
|
categoryName: String,
|
|
recipesList: MutableList<DevRecipe>,
|
|
recipesList: MutableList<DevRecipe>,
|
|
@@ -196,16 +192,19 @@ object DataFactory {
|
|
sortedType: SortedType
|
|
sortedType: SortedType
|
|
): MutableList<Any> {
|
|
): MutableList<Any> {
|
|
val result = mutableListOf<Any>()
|
|
val result = mutableListOf<Any>()
|
|
- result.add(FilterSortModel(""))
|
|
|
|
- result.add(categoryName)
|
|
|
|
|
|
+ val homeHeader = HomeHeader()
|
|
|
|
+ homeHeader.apply {
|
|
|
|
+ filterSortModel = FilterSortModel("")
|
|
|
|
+ category = categoryName
|
|
|
|
+ }
|
|
|
|
+ result.add(homeHeader)
|
|
val favoriteRecipesIds = mutableListOf<String>()
|
|
val favoriteRecipesIds = mutableListOf<String>()
|
|
favoriteRecipes.forEach {
|
|
favoriteRecipes.forEach {
|
|
favoriteRecipesIds.add(it.favoriteRecipesId)
|
|
favoriteRecipesIds.add(it.favoriteRecipesId)
|
|
}
|
|
}
|
|
- val foodList = mutableListOf<FoodContentModel>()
|
|
|
|
for (i in recipesList.indices) {
|
|
for (i in recipesList.indices) {
|
|
val recipes = recipesList[i]
|
|
val recipes = recipesList[i]
|
|
- foodList.add(
|
|
|
|
|
|
+ result.add(
|
|
FoodContentModel(
|
|
FoodContentModel(
|
|
recipes.photoPath ?: "",
|
|
recipes.photoPath ?: "",
|
|
recipes.name ?: "",
|
|
recipes.name ?: "",
|
|
@@ -221,10 +220,10 @@ object DataFactory {
|
|
)
|
|
)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
- result.add(FoodListModel(foodList, categoryName))
|
|
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
fun genSortNameList(resource: Resources): MutableList<FilterSortModel> {
|
|
fun genSortNameList(resource: Resources): MutableList<FilterSortModel> {
|
|
val result = mutableListOf<FilterSortModel>()
|
|
val result = mutableListOf<FilterSortModel>()
|
|
val sortNameList = mutableListOf(
|
|
val sortNameList = mutableListOf(
|
|
@@ -241,25 +240,29 @@ object DataFactory {
|
|
|
|
|
|
fun genTestSearchDataList(): MutableList<Any> {
|
|
fun genTestSearchDataList(): MutableList<Any> {
|
|
val result = mutableListOf<Any>()
|
|
val result = mutableListOf<Any>()
|
|
- result.add(FilterSortModel(""))
|
|
|
|
|
|
+ val homeHeader = HomeHeader()
|
|
|
|
+ homeHeader.filterSortModel = FilterSortModel("")
|
|
val searchNameList =
|
|
val searchNameList =
|
|
mutableListOf("Guacamole", "Aioli", "Popular", "Chinese food", "Healthy")
|
|
mutableListOf("Guacamole", "Aioli", "Popular", "Chinese food", "Healthy")
|
|
val searchModelList = mutableListOf<CommonSearchItem>()
|
|
val searchModelList = mutableListOf<CommonSearchItem>()
|
|
searchNameList.forEach {
|
|
searchNameList.forEach {
|
|
searchModelList.add(CommonSearchItem(it))
|
|
searchModelList.add(CommonSearchItem(it))
|
|
}
|
|
}
|
|
- result.add(CommonSearchModel(searchModelList))
|
|
|
|
|
|
+ homeHeader.commonSearchModel = CommonSearchModel(searchModelList)
|
|
|
|
+ result.add(homeHeader)
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
fun genOnLineHotTags(hotTags: MutableList<String>): MutableList<Any> {
|
|
fun genOnLineHotTags(hotTags: MutableList<String>): MutableList<Any> {
|
|
val result = mutableListOf<Any>()
|
|
val result = mutableListOf<Any>()
|
|
- result.add(FilterSortModel(""))
|
|
|
|
|
|
+ val homeHeader = HomeHeader()
|
|
|
|
+ homeHeader.filterSortModel = FilterSortModel("")
|
|
val searchModelList = mutableListOf<CommonSearchItem>()
|
|
val searchModelList = mutableListOf<CommonSearchItem>()
|
|
hotTags.forEach {
|
|
hotTags.forEach {
|
|
searchModelList.add(CommonSearchItem(it))
|
|
searchModelList.add(CommonSearchItem(it))
|
|
}
|
|
}
|
|
- result.add(CommonSearchModel(searchModelList))
|
|
|
|
|
|
+ homeHeader.commonSearchModel = CommonSearchModel(searchModelList)
|
|
|
|
+ result.add(result)
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
@@ -271,12 +274,17 @@ object DataFactory {
|
|
sortedType: SortedType
|
|
sortedType: SortedType
|
|
): MutableList<Any> {
|
|
): MutableList<Any> {
|
|
val result = mutableListOf<Any>()
|
|
val result = mutableListOf<Any>()
|
|
- result.add(FilterSortModel("", isOnLineState = true))
|
|
|
|
- result.add(categoryName)
|
|
|
|
|
|
+ val homeHeader = HomeHeader()
|
|
|
|
+ homeHeader.apply {
|
|
|
|
+ filterSortModel = FilterSortModel("", isOnLineState = true)
|
|
|
|
+ category = categoryName
|
|
|
|
+ }
|
|
|
|
+
|
|
val favoriteRecipesIds = mutableListOf<String>()
|
|
val favoriteRecipesIds = mutableListOf<String>()
|
|
favoriteRecipes.forEach {
|
|
favoriteRecipes.forEach {
|
|
favoriteRecipesIds.add(it.favoriteRecipesId)
|
|
favoriteRecipesIds.add(it.favoriteRecipesId)
|
|
}
|
|
}
|
|
|
|
+ result.add(homeHeader)
|
|
recipesList.sortWith(Comparator { t, t2 ->
|
|
recipesList.sortWith(Comparator { t, t2 ->
|
|
when (sortedType) {
|
|
when (sortedType) {
|
|
SortedType.Popular -> {
|
|
SortedType.Popular -> {
|
|
@@ -318,10 +326,9 @@ object DataFactory {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- val foodList = mutableListOf<FoodContentModel>()
|
|
|
|
for (i in recipesList.indices) {
|
|
for (i in recipesList.indices) {
|
|
val recipes = recipesList[i]
|
|
val recipes = recipesList[i]
|
|
- foodList.add(
|
|
|
|
|
|
+ result.add(
|
|
FoodContentModel(
|
|
FoodContentModel(
|
|
recipes.photoPath ?: "",
|
|
recipes.photoPath ?: "",
|
|
recipes.name ?: "",
|
|
recipes.name ?: "",
|
|
@@ -337,7 +344,6 @@ object DataFactory {
|
|
)
|
|
)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
- result.add(FoodListModel(foodList, categoryName))
|
|
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
@@ -375,7 +381,6 @@ object DataFactory {
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
private var bgResIds1 = arrayListOf<Int>(
|
|
private var bgResIds1 = arrayListOf<Int>(
|
|
R.drawable.entrance_bg_1,
|
|
R.drawable.entrance_bg_1,
|
|
R.drawable.entrance_bg_3,
|
|
R.drawable.entrance_bg_3,
|
|
@@ -414,11 +419,7 @@ object DataFactory {
|
|
for (i in iconResIds.indices) {
|
|
for (i in iconResIds.indices) {
|
|
dataList.add(
|
|
dataList.add(
|
|
EntranceData(
|
|
EntranceData(
|
|
- bgResIds[i],
|
|
|
|
- iconResIds[i],
|
|
|
|
- titleStrIds[i],
|
|
|
|
- title2StrIds[i],
|
|
|
|
- typeList[i]
|
|
|
|
|
|
+ bgResIds[i], iconResIds[i], titleStrIds[i], title2StrIds[i], typeList[i]
|
|
)
|
|
)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -426,16 +427,12 @@ object DataFactory {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- fun getNightEntranceData():MutableList<EntranceData>{
|
|
|
|
|
|
+ fun getNightEntranceData(): MutableList<EntranceData> {
|
|
val dataList = mutableListOf<EntranceData>()
|
|
val dataList = mutableListOf<EntranceData>()
|
|
for (i in iconResIds1.indices) {
|
|
for (i in iconResIds1.indices) {
|
|
dataList.add(
|
|
dataList.add(
|
|
EntranceData(
|
|
EntranceData(
|
|
- bgResIds1[i],
|
|
|
|
- iconResIds1[i],
|
|
|
|
- titleStrIds1[i],
|
|
|
|
- title2StrIds1[i],
|
|
|
|
- typeList1[i]
|
|
|
|
|
|
+ bgResIds1[i], iconResIds1[i], titleStrIds1[i], title2StrIds1[i], typeList1[i]
|
|
)
|
|
)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -453,4 +450,14 @@ fun getTime(hour: Int, minute: Int): String {
|
|
minuteStr = "${minute}minute"
|
|
minuteStr = "${minute}minute"
|
|
}
|
|
}
|
|
return "$hourStr$minuteStr"
|
|
return "$hourStr$minuteStr"
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+data class HomeHeader(
|
|
|
|
+ var filterSortModel: FilterSortModel? = null,
|
|
|
|
+ var category: String? = null,
|
|
|
|
+ var commonSearchModel: CommonSearchModel? = null,
|
|
|
|
+ var categoryModel: CategoryModel? = null
|
|
|
|
+) : ItemHover {
|
|
|
|
+
|
|
|
|
+ override var itemHover: Boolean = true
|
|
}
|
|
}
|