feat(ui): 添加餐品列表和套餐功能并优化食材显示
- 在 AndroidManifest.xml 中注册 MealListActivity 和 PackActivity - 在 FoodMaterialAdapter 中添加溯源码显示功能 - 修改 GoodsItem 模型中 goodsName 和 materCode 为可变属性 - 更新 list_item_food_material 布局文件以支持溯源码显示 - 在 NutritionModels 中为 NutFoodComposition 添加 isMain 字段 - 将设置页面中的餐包功能重定向到 MealListActivity
This commit is contained in:
@@ -69,6 +69,16 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||||
|
|
||||||
|
<activity android:name=".ui.MealListActivity"
|
||||||
|
android:theme="@style/Theme.DishMatch.NoSplash"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||||
|
|
||||||
|
<activity android:name=".ui.PackActivity"
|
||||||
|
android:theme="@style/Theme.DishMatch.NoSplash"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.CookingModeActivity"
|
android:name=".ui.CookingModeActivity"
|
||||||
android:theme="@style/Theme.DishMatch.NoSplash"
|
android:theme="@style/Theme.DishMatch.NoSplash"
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ class FoodMaterialAdapter(list: MutableList<GoodsItem>) :
|
|||||||
//} else {
|
//} else {
|
||||||
// tvDishName.text = data.goodsName + "-${data.rawMaterialsType}"
|
// tvDishName.text = data.goodsName + "-${data.rawMaterialsType}"
|
||||||
//}
|
//}
|
||||||
|
val showGoodsCode = (data.materCode ?: "").ifBlank { "-" }
|
||||||
|
tvGoodsCode.text = "溯源码:$showGoodsCode"
|
||||||
tvDishType.text = if (data.materialType == 1) "主辅材:主材" else if (data.materialType == 2) "主辅材:辅材" else ""
|
tvDishType.text = if (data.materialType == 1) "主辅材:主材" else if (data.materialType == 2) "主辅材:辅材" else ""
|
||||||
tvDishWeight.text =
|
tvDishWeight.text =
|
||||||
if (data.useWeight == null || data.useWeight == 0.toDouble()) "" else "${data.useWeight!!.roundedOneDecimalPlace()}克"
|
if (data.useWeight == null || data.useWeight == 0.toDouble()) "" else "${data.useWeight!!.roundedOneDecimalPlace()}克"
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import java.io.Serializable
|
|||||||
data class GoodsItem(
|
data class GoodsItem(
|
||||||
// 接口返回字段
|
// 接口返回字段
|
||||||
var goodsId: String = "",
|
var goodsId: String = "",
|
||||||
val goodsName: String? = null,
|
var goodsName: String? = null,
|
||||||
val popularName: String? = null,
|
val popularName: String? = null,
|
||||||
val zjmCode: String? = null,
|
val zjmCode: String? = null,
|
||||||
var materId: String? = null,
|
var materId: String? = null,
|
||||||
val materCode: String? = null,
|
var materCode: String? = null,
|
||||||
|
|
||||||
// 从 CookFoodGoodsEntity 迁移的数据字段(DishPartAdapter 显示及转换用)
|
// 从 CookFoodGoodsEntity 迁移的数据字段(DishPartAdapter 显示及转换用)
|
||||||
var materialType: Int = 0,
|
var materialType: Int = 0,
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ data class NutFoodOptionVO(
|
|||||||
@Parcelize
|
@Parcelize
|
||||||
data class NutFoodComposition(
|
data class NutFoodComposition(
|
||||||
val materId: Long?,
|
val materId: Long?,
|
||||||
val ingredientName: String?
|
val ingredientName: String?,
|
||||||
|
val isMain: Int?
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,9 +113,7 @@ class SettingActivity : BaseActivity() {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
type = SettingItem.Type.MEAL_PACKAGE,
|
type = SettingItem.Type.MEAL_PACKAGE,
|
||||||
onClick = {
|
onClick = {
|
||||||
//startActivity<CleanPackActivity> {
|
startActivity<MealListActivity> { }
|
||||||
// putExtra(CleanPackActivity.EXTRA_TYPE, CleanPackActivity.TYPE_MEAL)
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
SettingItem(
|
SettingItem(
|
||||||
|
|||||||
@@ -17,12 +17,11 @@
|
|||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/tvDishType"
|
app:layout_constraintBottom_toTopOf="@+id/tvGoodsCode"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/tvDishWeight"
|
app:layout_constraintEnd_toStartOf="@+id/tvDishWeight"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@@ -30,19 +29,32 @@
|
|||||||
tools:text="雪菜" />
|
tools:text="雪菜" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvDishType"
|
android:id="@+id/tvGoodsCode"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:layout_marginVertical="3dp"
|
||||||
android:textColor="@color/black999"
|
android:textColor="@color/black999"
|
||||||
android:textSize="26sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@+id/tvDishType"
|
||||||
app:layout_constraintEnd_toEndOf="@id/tvDishName"
|
app:layout_constraintEnd_toEndOf="@id/tvDishName"
|
||||||
app:layout_constraintStart_toStartOf="@id/tvDishName"
|
app:layout_constraintStart_toStartOf="@id/tvDishName"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvDishName"
|
app:layout_constraintTop_toBottomOf="@id/tvDishName"
|
||||||
|
android:text="溯源码:-" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvDishType"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/black999"
|
||||||
|
android:textSize="23sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/tvDishName"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tvDishName"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvGoodsCode"
|
||||||
tools:text="主辅材:主材" />
|
tools:text="主辅材:主材" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
Reference in New Issue
Block a user