feat(layout): 更新主秤监控界面布局并启用PyTorch模型功能

- 将主秤监控界面从LinearLayout改为ConstraintLayout布局
- 添加返回按钮并实现点击关闭页面功能
- 在BaseApp中初始化ObjectBox数据库
- 启用PyTorch模型依赖库并移除注释代码
- 在CollectFragment中激活食物图像向量化功能
- 初始化FoodModule中的PyTorch模型
- 临时忽略assets下的.pt模型文件到.gitignore
This commit is contained in:
2026-04-13 15:11:47 +08:00
parent 0d0fcd24b7
commit 41036cdbf9
8 changed files with 363 additions and 337 deletions
@@ -1,19 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:background="@color/bg_color">
<!-- 顶部标题 -->
<TextView
android:id="@+id/tvMasterTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="全设备秤数据监控"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textColor="@color/home_title"
android:textSize="36sp"
android:textStyle="bold" />
@@ -23,20 +27,36 @@
android:id="@+id/tvConnectionStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:layout_constraintTop_toBottomOf="@id/tvMasterTitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="16dp"
android:textColor="@color/home_sub_title"
android:textSize="24sp"
tools:text="已发现设备:3 台" />
<ImageView
android:id="@+id/ivMasterBack"
android:layout_width="70dp"
android:layout_height="60dp"
android:layout_gravity="start"
android:paddingStart="30dp"
android:paddingEnd="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tvMasterTitle"
app:layout_constraintBottom_toBottomOf="@id/tvMasterTitle"
android:src="@drawable/ic_back"
tools:ignore="ContentDescription" />
<!-- 秤数据列表 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvScaleList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_constraintTop_toBottomOf="@id/tvConnectionStatus"
app:layout_constraintBottom_toBottomOf="parent"
android:overScrollMode="never"
android:padding="16dp"
tools:listitem="@layout/list_item_scale_data"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>