feat(fragment): 新增默认减重配置功能

- SpTool 新增 configWeight 属性,持久化存储默认减重克数
- 新增 WeightConfigFragment 及对应布局,支持数字输入和回填
- SingleFragmentActivity 注册 WEIGHT_CONFIG 页面类型
- SettingActivity 在食材采集下方新增减重配置入口
- PrepareFoodActivity 打开时从 SpTool.configWeight 初始化 initialWeight

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 16:39:38 +08:00
co-authored by Claude Sonnet 4.6
parent ea79e584f3
commit 00bf478185
7 changed files with 151 additions and 2 deletions
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:background="@drawable/bg_other_page"
tools:ignore="HardcodedText">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@drawable/shape_white_30_corners"
android:orientation="vertical"
android:padding="30dp"
tools:ignore="UselessParent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="106dp"
android:background="@drawable/bg_bottom_line">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:text="默认减重配置"
android:textColor="@color/black"
android:textSize="28sp"
android:textStyle="bold" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="减重值(克)"
android:textColor="@color/black"
android:textSize="28sp" />
<EditText
android:id="@+id/etConfigWeight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_weight="1"
android:background="@drawable/shape_white_30_corners"
android:hint="请输入减重值"
android:inputType="number"
android:maxLength="6"
android:padding="16dp"
android:textColor="@color/black"
android:textColorHint="@color/gray_b4"
android:textSize="28sp" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnConfirm"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="40dp"
android:text="确认"
android:background="@drawable/shape_green_bg"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center"
android:textColor="@color/white"
android:textSize="32sp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>