feat(fragment): 新增净材种类选择功能及相关数据结构支持

- 新增 rawMaterialsType 字段至 GoodsItem、CookFoodGoodsEntity、SeasoningEntity,DB 升级至 v12
- VectorCollectionFragment 重构食材搜索,点击食材弹出净材种类单选弹窗
- CommonDialog 新增 addContentView 和可拦截确认按钮(setPositiveButtonInterceptable)能力
- Food3Adapter 和 list_item_food3.xml 支持显示已选净材种类副标签
This commit is contained in:
2026-05-09 18:10:07 +08:00
parent a9663a21f0
commit ef13aa8307
11 changed files with 268 additions and 53 deletions
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- 绿色圆角背景 + 白色垃圾桶图标,替代红色的 ic_delete_red.png -->
<?xml version="1.0" encoding="utf-8"?>
<!-- 绿色圆形背景 + 白色垃圾桶图标,替代红色的 ic_delete_red.png -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 绿色圆角背景 -->
@@ -6,10 +7,10 @@
<shape android:shape="oval">
<solid android:color="#00BC71" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
</shape>
</item>
+10
View File
@@ -37,6 +37,16 @@
android:textSize="26sp"
tools:text="这是弹窗的内容信息,请确认"/>
<!-- 自定义内容区域,默认隐藏,通过 CommonDialog.addContentView 动态填充 -->
<LinearLayout
android:id="@+id/llContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:orientation="vertical"
android:visibility="gone" />
<!-- 分割线 -->
<View
android:layout_width="match_parent"
@@ -18,6 +18,7 @@
android:layout_gravity="center"
android:text="点击分格配置调料"
android:includeFontPadding="false"
android:textStyle="bold"
android:textColor="@color/white"
android:textSize="20sp" />
</FrameLayout>
+31 -11
View File
@@ -1,18 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvFoodName"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/bg_item_search"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:layout_marginHorizontal="14dp"
android:layout_marginVertical="14dp"
android:background="@drawable/bg_item_search"
android:paddingHorizontal="15dp"
android:textAlignment="center"
android:textColor="@color/color_item_search"
android:textSize="30sp"
android:textStyle="bold"
tools:text="土豆丝" />
android:paddingVertical="10dp">
<!-- 食材名称,选中状态通过 CheckedTextView 的 checked 驱动背景/文字色变化 -->
<CheckedTextView
android:id="@+id/tvFoodName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textAlignment="center"
android:textColor="@color/color_item_search"
android:textSize="28sp"
android:textStyle="bold"
tools:text="土豆丝" />
<!-- 当前选中的净材种类,小字显示,无数据时隐藏 -->
<TextView
android:id="@+id/tvRawMaterialsType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center|bottom"
android:textColor="@color/black999"
android:textSize="18sp"
android:visibility="gone"
tools:text="切丝" />
</FrameLayout>