refactor(ui): 重构采样模式界面和数据处理逻辑

- 将 RadioButton 替换为 CheckedTextView 并调整布局结构
- 添加安全索引访问避免数组越界异常
- 优化数据库查询方法增加回调版本
- 更新崩溃处理器重启目标页面
- 添加单按钮对话框支持
- 优化采样模式页面数据加载和刷新逻辑
- 调整重量计算和数据处理流程
- 修复页面跳转和数据传递问题
This commit is contained in:
2026-05-14 14:24:25 +08:00
parent 6392b76ac2
commit 89fff7c2b0
18 changed files with 279 additions and 155 deletions
@@ -6,14 +6,53 @@
android:orientation="vertical"
tools:background="@drawable/bg_other_page">
<RadioGroup
android:id="@+id/dishRadioGroup"
<!-- <RadioGroup-->
<!-- android:id="@+id/dishRadioGroup"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="88dp"-->
<!-- android:layout_marginTop="15dp"-->
<!-- android:orientation="horizontal">-->
<!-- <RadioButton-->
<!-- android:id="@+id/rbSamplingCooking"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/breakfast_bg"-->
<!-- android:button="@null"-->
<!-- android:checked="true"-->
<!-- android:gravity="center"-->
<!-- android:text="@string/rb_sampling_cooking"-->
<!-- android:textColor="@color/breakfast_font"-->
<!-- android:textSize="30sp"-->
<!-- android:textStyle="bold" />-->
<!-- <RadioButton-->
<!-- android:id="@+id/rbSamplingFinished"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="9dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/breakfast_bg"-->
<!-- android:button="@null"-->
<!-- android:checked="false"-->
<!-- android:gravity="center"-->
<!-- android:text="@string/rb_sampling_finished"-->
<!-- android:textColor="@color/breakfast_font"-->
<!-- android:textSize="30sp"-->
<!-- android:textStyle="bold" />-->
<!-- </RadioGroup>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RadioButton
<CheckedTextView
android:id="@+id/rbSamplingCooking"
android:layout_width="0dp"
android:layout_height="match_parent"
@@ -23,13 +62,14 @@
android:button="@null"
android:checked="true"
android:gravity="center"
android:textAlignment="center"
android:text="@string/rb_sampling_cooking"
android:textColor="@color/breakfast_font"
android:textSize="30sp"
android:textStyle="bold" />
<RadioButton
<CheckedTextView
android:id="@+id/rbSamplingFinished"
android:layout_width="0dp"
android:layout_height="match_parent"
@@ -40,11 +80,12 @@
android:button="@null"
android:checked="false"
android:gravity="center"
android:textAlignment="center"
android:text="@string/rb_sampling_finished"
android:textColor="@color/breakfast_font"
android:textSize="30sp"
android:textStyle="bold" />
</RadioGroup>
</LinearLayout>
<LinearLayout
+13
View File
@@ -53,6 +53,19 @@
android:layout_height="1dp"
android:background="@color/gray_eb" />
<!-- 1个按钮时显示(全宽居中) -->
<TextView
android:id="@+id/btnSingle"
android:layout_width="match_parent"
android:layout_height="96dp"
android:background="@drawable/ripple_btn_bottom"
android:gravity="center"
android:textColor="@color/dish_green"
android:textSize="28sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="我知道了" />
<!-- 2个按钮时显示(水平排列) -->
<LinearLayout
android:id="@+id/layoutButtonsHorizontal"