入库功能增加相机预览及拍照

This commit is contained in:
2025-11-11 11:52:41 +08:00
parent 9927ebe7f1
commit 750d92e2f9
10 changed files with 295 additions and 93 deletions
@@ -302,15 +302,18 @@
<FrameLayout
android:id="@+id/flContainer"
android:layout_width="488dp"
android:layout_height="356dp"
android:background="@drawable/bg_white_radius10_stroke2"
android:padding="2dp"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"/>
<!-- android:padding="2dp"-->
<!-- android:layout_width="488dp"-->
<!-- android:layout_height="356dp"-->
<!-- android:layout_marginBottom="37dp"-->
<!-- android:background="@drawable/bg_white_radius10_stroke2"-->
<FrameLayout
android:layout_width="488dp"
android:layout_height="70dp"
android:layout_marginTop="37dp"
android:background="@drawable/bg_gray_radius10">
<TextView
@@ -17,7 +17,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="系统异常,请稍后重试!"
android:text="识别失败,请稍后重试!"
android:textColor="#ff000000"
android:textSize="36sp"
android:textStyle="bold" />
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:layout_gravity="center"
tools:ignore="ContentDescription"
tools:src="@mipmap/ic_launcher" />
</merge>
@@ -0,0 +1,137 @@
<?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="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="488dp"
android:layout_height="325dp"
android:background="@drawable/bg_white_radius10_stroke2_dash">
<androidx.cardview.widget.CardView
android:id="@+id/flCameraPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<androidx.camera.view.PreviewView
android:id="@+id/previewView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cvImageBg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/ivGoodsImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:id="@+id/llCameraFlag"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/bg_white_radius10_stroke2_dash"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@mipmap/ic_camera_gray"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="图片采集"
android:textColor="#ffb4b4c8"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="@+id/btnStartPreview"
android:layout_width="150dp"
android:layout_height="50dp"
android:background="@drawable/bg_white_stroke_green_ripple"
android:text="取消"
android:textColor="#FF14CD71"
android:textSize="21sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/btnTakePhoto"
android:layout_width="150dp"
android:layout_height="50dp"
android:background="@drawable/bg_green_ripple"
android:gravity="center">
<ImageView
android:layout_width="26dp"
android:layout_height="wrap_content"
android:src="@mipmap/ic_camera_white"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginStart="10dp"
android:text="采集"
android:textColor="@color/white"
android:textSize="21sp"
android:textStyle="bold"
tools:ignore="HardcodedText,UseCompatTextViewDrawableXml" />
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>