取消动画,处理关闭界面相机预览残留问题
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.sw.inbound.ui
|
||||
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -115,16 +118,26 @@ private fun NavHost(
|
||||
LoginScreen(modifier = Modifier, navController)
|
||||
}
|
||||
// 采购单入库
|
||||
composable(Screen.PurchaseOrder.route) {
|
||||
composable(
|
||||
Screen.PurchaseOrder.route,
|
||||
enterTransition = { fadeIn(animationSpec = tween(0)) }, // 无进入动画
|
||||
exitTransition = { fadeOut(animationSpec = tween(0)) } // 无退出动画
|
||||
) {
|
||||
PurchaseOrderScreen(modifier = Modifier.fillMaxSize(), navController)
|
||||
}
|
||||
// 自采单
|
||||
composable(Screen.SelfProcurement.route) {
|
||||
composable(
|
||||
Screen.SelfProcurement.route,
|
||||
enterTransition = { fadeIn(animationSpec = tween(0)) }, // 无进入动画
|
||||
exitTransition = { fadeOut(animationSpec = tween(0)) } // 无退出动画
|
||||
) {
|
||||
SelfProcurementScreen(modifier = Modifier, navController)
|
||||
}
|
||||
// 收货
|
||||
composable(
|
||||
Screen.ReceiptProduct.route,
|
||||
enterTransition = { fadeIn(animationSpec = tween(0)) }, // 无进入动画
|
||||
exitTransition = { fadeOut(animationSpec = tween(0)) }, // 无退出动画
|
||||
arguments = listOf(
|
||||
navArgument(name = "id", builder = { type = NavType.IntType }),
|
||||
navArgument(name = "supplierId", builder = { type = NavType.IntType })
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.sw.inbound.ui.page
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -15,6 +16,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
@@ -67,7 +69,10 @@ fun HomeScreen(
|
||||
modifier = Modifier
|
||||
.width(595.dp)
|
||||
.height(477.dp)
|
||||
.clickable() {
|
||||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null
|
||||
) {
|
||||
navController.navigate(Screen.PurchaseOrder.route)
|
||||
},
|
||||
painter = painterResource(R.mipmap.ic_order_purchase),
|
||||
@@ -78,7 +83,10 @@ fun HomeScreen(
|
||||
modifier = Modifier
|
||||
.width(595.dp)
|
||||
.height(477.dp)
|
||||
.clickable {
|
||||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null
|
||||
) {
|
||||
navController.navigate(Screen.SelfProcurement.route)
|
||||
},
|
||||
painter = painterResource(R.mipmap.ic_order_self_procurement),
|
||||
|
||||
@@ -116,6 +116,7 @@ fun SelfProcurementScreen(
|
||||
ContentView(viewModel)
|
||||
}
|
||||
BottomActionBar(onLeftButtonClick = {
|
||||
Timber.d("点击后退 onDispose time = ${System.currentTimeMillis()}")
|
||||
controller.popBackStack()
|
||||
}, showRight1Button = true, right1ButtonText = "清空物品", onRight1ButtonClick = {
|
||||
viewModel.clearPurchaseOrders()
|
||||
@@ -230,7 +231,7 @@ fun ContentRightView(
|
||||
@Composable
|
||||
fun ProductIdentification(viewModel: SelfProcurementViewModel) {
|
||||
val searchResultList by viewModel.searchListItems.collectAsState()
|
||||
val selectItem by viewModel.selectedItem.collectAsState()
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.width(457.dp)
|
||||
|
||||
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
@@ -19,8 +18,6 @@ fun CameraPreview(
|
||||
controller: LifecycleCameraController,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
Box(modifier = modifier) {
|
||||
AndroidView(
|
||||
factory = { ctx ->
|
||||
@@ -39,5 +36,4 @@ fun CameraPreview(
|
||||
contentDescription = "扫描"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
@@ -57,6 +58,14 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
private val _weightInfo = MutableStateFlow<Double?>(0.0)
|
||||
val weightInfo: StateFlow<Double?> = _weightInfo
|
||||
|
||||
|
||||
private val _showCameraPreview = MutableStateFlow(true)
|
||||
val showCameraPreview = _showCameraPreview.asStateFlow()
|
||||
|
||||
fun updateCameraPreviewShow(show: Boolean) {
|
||||
_showCameraPreview.value = show
|
||||
}
|
||||
|
||||
/**
|
||||
* 数量是否是用户输入的值
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user