feat(activity): 新增食材识别页面,重构识别流程并优化多设备布局适配
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -21,8 +21,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
tools:background="@color/white">
|
||||
|
||||
<!-- 食材照片,权重占满剩余空间 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivFoodPhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@color/bg_color" />
|
||||
|
||||
<!-- 识别到的食材列表,无数据时隐藏 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:maxHeight="200dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="2"
|
||||
tools:itemCount="4"
|
||||
tools:listitem="@layout/list_item_search_goods_info"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!-- 选中的食材名称 -->
|
||||
<TextView
|
||||
android:id="@+id/tvSelectedFood"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:gravity="center"
|
||||
android:text="-"
|
||||
android:textColor="@color/black333"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<!-- 秤1重量 -->
|
||||
<TextView
|
||||
android:id="@+id/tvWeight"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/shape_white_12_corners"
|
||||
android:gravity="center"
|
||||
android:text="0.0 g"
|
||||
android:textColor="@color/black333"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<!-- 更换食材 -->
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btnChangeFood"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/shape_green_bg"
|
||||
android:text="更换食材"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- 取消 -->
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:background="@drawable/shape_white_12_corners"
|
||||
android:text="取消"
|
||||
android:textColor="@color/black333"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -4,20 +4,36 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:paddingHorizontal="5dp"
|
||||
tools:background="@color/bg_color">
|
||||
|
||||
<!-- 本机IP地址 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDeviceIp"
|
||||
android:layout_width="wrap_content"
|
||||
<!-- IP 与主设备状态同行显示 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="0dp"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/home_title"
|
||||
tools:text="IP:192.168.1.100" />
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- 本机IP地址 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDeviceIp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/home_title"
|
||||
tools:text="IP:192.168.1.100" />
|
||||
|
||||
<!-- 主设备连接状态 -->
|
||||
<TextView
|
||||
android:id="@+id/tvMasterStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textSize="16sp"
|
||||
tools:text="主设备:未连接" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 设备信息 -->
|
||||
<TextView
|
||||
@@ -25,22 +41,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="0dp"
|
||||
android:textSize="18sp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/home_sub_title"
|
||||
tools:text="设备:device_02" />
|
||||
|
||||
<!-- 主设备连接状态 -->
|
||||
<TextView
|
||||
android:id="@+id/tvMasterStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:textSize="16sp"
|
||||
tools:text="主设备:未连接" />
|
||||
|
||||
<!-- 本机秤数据列表 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvScaleList"
|
||||
|
||||
@@ -46,11 +46,22 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivOperateIcon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
tools:src="@drawable/ic_dish_selected"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivClearIcon"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivClearIcon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="60dp"
|
||||
tools:src="@drawable/ic_dish_clear"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
Reference in New Issue
Block a user