From abc4a7b862a7961d3d98608dd93dc7674d9021c2 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Thu, 5 Oct 2023 18:09:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=BB=98=E8=AE=A4=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E2=80=9C=E6=8E=A5=E6=94=B6=E8=87=AA=E5=8A=A8=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/page/settings/more/MoreSettingsPage.kt | 60 +++++++++++++------ app/src/main/res/values/strings.xml | 2 +- app/src/main/res/values/styles.xml | 1 + app/src/main/res/xml/preferences.xml | 2 +- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/more/MoreSettingsPage.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/more/MoreSettingsPage.kt index 7bce00ce..da7ce9de 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/more/MoreSettingsPage.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/more/MoreSettingsPage.kt @@ -3,18 +3,27 @@ package com.huanchengfly.tieba.post.ui.page.settings.more import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.BugReport import androidx.compose.material.icons.outlined.FiberNew import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.OfflineBolt -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +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.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import com.huanchengfly.tieba.post.App import com.huanchengfly.tieba.post.BuildConfig @@ -26,8 +35,14 @@ import com.huanchengfly.tieba.post.ui.common.prefs.widgets.SwitchPref import com.huanchengfly.tieba.post.ui.common.prefs.widgets.TextPref import com.huanchengfly.tieba.post.ui.page.destinations.AboutPageDestination import com.huanchengfly.tieba.post.ui.page.settings.LeadingIcon -import com.huanchengfly.tieba.post.ui.widgets.compose.* +import com.huanchengfly.tieba.post.ui.widgets.compose.AvatarIcon +import com.huanchengfly.tieba.post.ui.widgets.compose.BackNavigationIcon +import com.huanchengfly.tieba.post.ui.widgets.compose.LocalSnackbarHostState +import com.huanchengfly.tieba.post.ui.widgets.compose.MyScaffold +import com.huanchengfly.tieba.post.ui.widgets.compose.Sizes +import com.huanchengfly.tieba.post.ui.widgets.compose.TitleCentredToolbar import com.huanchengfly.tieba.post.utils.ImageCacheUtil +import com.huanchengfly.tieba.post.utils.appPreferences import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlinx.coroutines.launch @@ -44,7 +59,12 @@ fun MoreSettingsPage( backgroundColor = Color.Transparent, topBar = { TitleCentredToolbar( - title = stringResource(id = R.string.title_settings_more), + title = { + Text( + text = stringResource(id = R.string.title_settings_more), + fontWeight = FontWeight.Bold, style = MaterialTheme.typography.h6 + ) + }, navigationIcon = { BackNavigationIcon(onBackPressed = { navigator.navigateUp() }) } @@ -66,22 +86,24 @@ fun MoreSettingsPage( .padding(paddingValues) .fillMaxSize(), ) { - prefsItem { - SwitchPref( - leadingIcon = { - LeadingIcon { - AvatarIcon( - icon = Icons.Outlined.BugReport, - size = Sizes.Small, - contentDescription = null, - ) - } - }, - key = "checkCIUpdate", - title = stringResource(id = R.string.title_check_ci_update), - defaultChecked = false, - summary = stringResource(id = R.string.tip_check_ci_update) - ) + if (context.appPreferences.showExperimentalFeatures) { + prefsItem { + SwitchPref( + leadingIcon = { + LeadingIcon { + AvatarIcon( + icon = Icons.Outlined.BugReport, + size = Sizes.Small, + contentDescription = null, + ) + } + }, + key = "checkCIUpdate", + title = stringResource(id = R.string.title_check_ci_update), + defaultChecked = false, + summary = stringResource(id = R.string.tip_check_ci_update) + ) + } } prefsItem { SwitchPref( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4502bae4..9c613493 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -586,7 +586,7 @@ 申诉 隐藏该提示 接收自动构建版本更新 - 需要 App Center 账号且已加入测试,如果你没有,请不要开启此选项! + 仅供测试 通知 用于发送消息通知、显示一键签到进度 %s签到完成 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b8cba409..cfc1ea64 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -348,6 +348,7 @@ true @android:color/transparent @android:color/transparent + @dimen/radius