From 45a698003f65e75e0e036c0ec15c0c5f05639ebc Mon Sep 17 00:00:00 2001 From: AllenTom Date: Tue, 1 Oct 2024 01:49:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=99=BB=E5=BD=95UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../riderpro/ui/composables/PolicyCheckbox.kt | 14 +++++++---- .../riderpro/ui/index/tabs/profile/Profile.kt | 25 ++++++++----------- .../aiosman/riderpro/ui/login/emailsignup.kt | 9 ------- app/src/main/res/values-zh/strings.xml | 4 +++ app/src/main/res/values/strings.xml | 4 +++ 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/aiosman/riderpro/ui/composables/PolicyCheckbox.kt b/app/src/main/java/com/aiosman/riderpro/ui/composables/PolicyCheckbox.kt index a089a03..03478f6 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/composables/PolicyCheckbox.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/composables/PolicyCheckbox.kt @@ -22,6 +22,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.buildAnnotatedString @@ -30,11 +31,12 @@ import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView +import com.aiosman.riderpro.R import com.aiosman.riderpro.data.DictService import com.aiosman.riderpro.data.DictServiceImpl import kotlinx.coroutines.launch -@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun PolicyCheckbox( checked: Boolean = false, @@ -84,17 +86,19 @@ fun PolicyCheckbox( size = 16 ) val text = buildAnnotatedString { - append("I agree to the ") + val keyword = stringResource(R.string.private_policy_keyword) + val template = stringResource(R.string.private_policy_template) + append(template) withStyle(style = SpanStyle(color = if (error) Color.Red else Color.Black)) { - append("terms and conditions") + append(keyword) } addStyle( style = SpanStyle( color = Color.Blue, textDecoration = TextDecoration.Underline ), - start = "I agree to the ".length, - end = "I agree to the terms and conditions".length + start = template.length, + end = template.length + keyword.length ) } ClickableText( diff --git a/app/src/main/java/com/aiosman/riderpro/ui/index/tabs/profile/Profile.kt b/app/src/main/java/com/aiosman/riderpro/ui/index/tabs/profile/Profile.kt index 6a96dba..538a18c 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/index/tabs/profile/Profile.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/index/tabs/profile/Profile.kt @@ -137,7 +137,7 @@ fun Profile( val bannerHeight = 500 var headerBannerMaxHeight: Int = userHeight + bannerHeight val headerBannerMinHeight = 100 - val speedFactor = 0.5f + val speedFactor = 0.75f var currentHeaderHeight by rememberSaveable { mutableStateOf(headerBannerMaxHeight) } var scrollState = rememberLazyListState() var gridScrollState = rememberLazyStaggeredGridState() @@ -189,16 +189,13 @@ fun Profile( return Offset(x = 0f, y = consumedHeader / speedFactor) } - override suspend fun onPreFling(available: Velocity): Velocity { - return Velocity.Zero - } - - override suspend fun onPostFling( - consumed: Velocity, - available: Velocity - ): Velocity { - return Velocity.Zero - } +// override fun onPostScroll( +// consumed: Offset, +// available: Offset, +// source: NestedScrollSource +// ): Offset { +// return Offset.Zero +// } } } @@ -448,7 +445,7 @@ fun Profile( } ) { Text( - text = "Gallery", + text = stringResource(R.string.gallery), fontSize = 14.sp, fontWeight = FontWeight.W600, color = Color.Black, @@ -471,7 +468,7 @@ fun Profile( } ) { Text( - text = "Moments", + text = stringResource(R.string.moment), fontSize = 14.sp, fontWeight = FontWeight.W600, color = Color.Black, @@ -784,7 +781,7 @@ fun OtherProfileAction( ) Spacer(modifier = Modifier.width(4.dp)) Text( - text = "CHAT", + text = stringResource(R.string.chat_upper), fontSize = 14.sp, fontWeight = FontWeight.W600, color = Color.Black, diff --git a/app/src/main/java/com/aiosman/riderpro/ui/login/emailsignup.kt b/app/src/main/java/com/aiosman/riderpro/ui/login/emailsignup.kt index 8e96109..0fca9c5 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/login/emailsignup.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/login/emailsignup.kt @@ -241,15 +241,6 @@ fun EmailSignupScreen() { ) { acceptTerms = it } -// CheckboxWithLabel( -// checked = acceptTerms, -// checkSize = 16, -// fontSize = 12, -// label = stringResource(R.string.agree_terms_of_service), -// error = termsError -// ) { -// acceptTerms = it -// } Spacer(modifier = Modifier.height(16.dp)) CheckboxWithLabel( checked = acceptPromotions, diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index f196a46..680d3cd 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -72,4 +72,8 @@ 邮件发送失败,请检查您的网络连接或稍后重试。 %1d秒前 %1d分钟前 + 同意 + 用户协议 + 图片 + 私信 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f5fe4bd..6611297 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -71,4 +71,8 @@ Failed to send email. Please check your network connection or try again later. %1d seconds ago %1d minutes ago + I agree to the + term of service + Gallery + CHAT \ No newline at end of file