From a676bef14a764e681efe37829b3050002ba05632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E5=86=9C=E9=98=BF=E6=A5=A0?= Date: Wed, 14 Oct 2026 15:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E9=A1=B5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=80=81=E6=94=B9=E7=94=A8=20LoadingIndicator=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E6=8E=88=E6=9D=83=E6=8F=90=E7=A4=BA=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B8=BA=E5=BD=A2=E7=8A=B6=E5=BE=BD=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../a2fair/ui/tokens/AddTokenBottomSheet.kt | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/cn/airnan/a2fair/ui/tokens/AddTokenBottomSheet.kt b/app/src/main/java/cn/airnan/a2fair/ui/tokens/AddTokenBottomSheet.kt index 3b96222..373d995 100644 --- a/app/src/main/java/cn/airnan/a2fair/ui/tokens/AddTokenBottomSheet.kt +++ b/app/src/main/java/cn/airnan/a2fair/ui/tokens/AddTokenBottomSheet.kt @@ -21,9 +21,11 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.* +import androidx.compose.material.icons.outlined.PhotoCamera import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment @@ -53,7 +55,7 @@ import kotlinx.coroutines.launch import java.nio.ByteBuffer import java.util.concurrent.Executors -@OptIn(ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class) @Composable fun AddTokenBottomSheet( viewModel: TokensViewModel, @@ -161,12 +163,30 @@ fun AddTokenBottomSheet( ) if (!hasCameraPermission) { - Text( - text = stringResource(R.string.camera_permission_hint), - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant, + Column( + horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.align(Alignment.Center).padding(16.dp) - ) + ) { + Box( + modifier = Modifier + .size(56.dp) + .clip(MaterialShapes.Cookie9Sided.toShape()) + .background(MaterialTheme.colorScheme.primaryContainer), + contentAlignment = Alignment.Center + ) { + Icon( + imageVector = Icons.Outlined.PhotoCamera, + contentDescription = null, + tint = MaterialTheme.colorScheme.onPrimaryContainer + ) + } + Spacer(modifier = Modifier.height(10.dp)) + Text( + text = stringResource(R.string.camera_permission_hint), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } } if (showScanningText) { @@ -175,12 +195,18 @@ fun AddTokenBottomSheet( modifier = Modifier.align(Alignment.BottomCenter).padding(8.dp), shape = RoundedCornerShape(8.dp) ) { - Text( - text = stringResource(R.string.scanning_hint), - modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp), - style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurface - ) + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.padding(horizontal = 12.dp, vertical = 4.dp) + ) { + LoadingIndicator(modifier = Modifier.size(20.dp)) + Spacer(modifier = Modifier.width(8.dp)) + Text( + text = stringResource(R.string.scanning_hint), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.onSurface + ) + } } } }