优化
This commit is contained in:
@@ -93,11 +93,18 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
cameraUtils.bind()
|
cameraUtils.bind()
|
||||||
|
binding.llCameraFlag.run {
|
||||||
|
visible()
|
||||||
|
postDelayed({
|
||||||
|
gone()
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
cameraUtils.unbind()
|
cameraUtils.unbind()
|
||||||
|
binding.llCameraFlag.visible()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
@@ -377,6 +384,7 @@ class FoodCollectionActivity : ComponentActivity() {
|
|||||||
if (emptyBinding == null) {
|
if (emptyBinding == null) {
|
||||||
emptyBinding = LayoutEmptySearchBinding.inflate(layoutInflater, binding.rvSearch, false)
|
emptyBinding = LayoutEmptySearchBinding.inflate(layoutInflater, binding.rvSearch, false)
|
||||||
}
|
}
|
||||||
|
emptyBinding?.tvContent?.text = "请检查物品名称,或稍后重新搜索"
|
||||||
emptyBinding?.root?.let { layout ->
|
emptyBinding?.root?.let { layout ->
|
||||||
layout.setOnClickListener { layout.hideKeyboard() }
|
layout.setOnClickListener { layout.hideKeyboard() }
|
||||||
searchAdapter.stateView = layout
|
searchAdapter.stateView = layout
|
||||||
|
|||||||
@@ -76,11 +76,48 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/flCameraPreview"
|
android:id="@+id/flPreview"
|
||||||
android:layout_width="420dp"
|
android:layout_width="420dp"
|
||||||
android:layout_height="420dp"
|
android:layout_height="420dp"
|
||||||
app:layout_constraintStart_toStartOf="@id/layoutTop"
|
app:layout_constraintStart_toStartOf="@id/layoutTop"
|
||||||
app:layout_constraintTop_toBottomOf="@id/layoutTop" />
|
app:layout_constraintTop_toBottomOf="@id/layoutTop">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/flCameraPreview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
app:cardElevation="0dp"/>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/btnTakePhoto"
|
android:id="@+id/btnTakePhoto"
|
||||||
@@ -94,9 +131,9 @@
|
|||||||
android:textColor="#FF0032C8"
|
android:textColor="#FF0032C8"
|
||||||
android:textSize="36sp"
|
android:textSize="36sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="@id/flCameraPreview"
|
app:layout_constraintEnd_toEndOf="@id/flPreview"
|
||||||
app:layout_constraintStart_toStartOf="@id/flCameraPreview"
|
app:layout_constraintStart_toStartOf="@id/flPreview"
|
||||||
app:layout_constraintTop_toBottomOf="@id/flCameraPreview" />
|
app:layout_constraintTop_toBottomOf="@id/flPreview" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/btnClearData"
|
android:id="@+id/btnClearData"
|
||||||
@@ -121,8 +158,8 @@
|
|||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
app:layout_constraintStart_toEndOf="@id/flCameraPreview"
|
app:layout_constraintStart_toEndOf="@id/flPreview"
|
||||||
app:layout_constraintTop_toTopOf="@id/flCameraPreview"
|
app:layout_constraintTop_toTopOf="@id/flPreview"
|
||||||
app:spanCount="3"
|
app:spanCount="3"
|
||||||
tools:itemCount="6"
|
tools:itemCount="6"
|
||||||
tools:listitem="@layout/list_item_food_collection" />
|
tools:listitem="@layout/list_item_food_collection" />
|
||||||
@@ -137,7 +174,7 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
||||||
app:layout_constraintTop_toTopOf="@id/flCameraPreview">
|
app:layout_constraintTop_toTopOf="@id/flPreview">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -157,7 +194,7 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
||||||
app:layout_constraintTop_toTopOf="@id/flCameraPreview">
|
app:layout_constraintTop_toTopOf="@id/flPreview">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbCollected"
|
android:id="@+id/rbCollected"
|
||||||
@@ -199,10 +236,10 @@
|
|||||||
android:background="@drawable/bg_gray"
|
android:background="@drawable/bg_gray"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
app:layout_constraintStart_toEndOf="@id/rvFoodCollection"
|
||||||
app:layout_constraintTop_toBottomOf="@id/layoutTab"
|
app:layout_constraintTop_toBottomOf="@id/layoutTab">
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etGoodsInput"
|
android:id="@+id/etGoodsInput"
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tvContent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="请检查物品名称,或点击“添加物品”按钮新增物品信息"
|
android:text="请检查物品名称,或点击“添加物品”按钮新增物品信息"
|
||||||
|
|||||||
Reference in New Issue
Block a user