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"
|
||||
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
|
||||
android:name=".ui.CookingModeActivity"
|
||||
android:theme="@style/Theme.DishMatch.NoSplash"
|
||||
|
||||
@@ -42,6 +42,8 @@ class FoodMaterialAdapter(list: MutableList<GoodsItem>) :
|
||||
//} else {
|
||||
// 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 ""
|
||||
tvDishWeight.text =
|
||||
if (data.useWeight == null || data.useWeight == 0.toDouble()) "" else "${data.useWeight!!.roundedOneDecimalPlace()}克"
|
||||
|
||||
@@ -11,11 +11,11 @@ import java.io.Serializable
|
||||
data class GoodsItem(
|
||||
// 接口返回字段
|
||||
var goodsId: String = "",
|
||||
val goodsName: String? = null,
|
||||
var goodsName: String? = null,
|
||||
val popularName: String? = null,
|
||||
val zjmCode: String? = null,
|
||||
var materId: String? = null,
|
||||
val materCode: String? = null,
|
||||
var materCode: String? = null,
|
||||
|
||||
// 从 CookFoodGoodsEntity 迁移的数据字段(DishPartAdapter 显示及转换用)
|
||||
var materialType: Int = 0,
|
||||
|
||||
@@ -73,7 +73,8 @@ data class NutFoodOptionVO(
|
||||
@Parcelize
|
||||
data class NutFoodComposition(
|
||||
val materId: Long?,
|
||||
val ingredientName: String?
|
||||
val ingredientName: String?,
|
||||
val isMain: Int?
|
||||
) : Parcelable
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,9 +113,7 @@ class SettingActivity : BaseActivity() {
|
||||
SettingItem(
|
||||
type = SettingItem.Type.MEAL_PACKAGE,
|
||||
onClick = {
|
||||
//startActivity<CleanPackActivity> {
|
||||
// putExtra(CleanPackActivity.EXTRA_TYPE, CleanPackActivity.TYPE_MEAL)
|
||||
//}
|
||||
startActivity<MealListActivity> { }
|
||||
}
|
||||
),
|
||||
SettingItem(
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDishType"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvGoodsCode"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvDishWeight"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -30,19 +29,32 @@
|
||||
tools:text="雪菜" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDishType"
|
||||
android:id="@+id/tvGoodsCode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:layout_marginVertical="3dp"
|
||||
android:textColor="@color/black999"
|
||||
android:textSize="26sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDishType"
|
||||
app:layout_constraintEnd_toEndOf="@id/tvDishName"
|
||||
app:layout_constraintStart_toStartOf="@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="主辅材:主材" />
|
||||
|
||||
<ImageView
|
||||
|
||||
Reference in New Issue
Block a user