feat: 隐藏回贴功能入口
This commit is contained in:
parent
162be6e3a1
commit
9c1dd21f3c
|
|
@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.size
|
||||
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.Apps
|
||||
import androidx.compose.material.icons.outlined.Brightness2
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.huanchengfly.tieba.post.ui.page.settings.habit
|
|||
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.BrandingWatermark
|
||||
import androidx.compose.material.icons.outlined.CalendarViewDay
|
||||
|
|
@ -10,6 +12,7 @@ import androidx.compose.material.icons.outlined.ExitToApp
|
|||
import androidx.compose.material.icons.outlined.NightsStay
|
||||
import androidx.compose.material.icons.outlined.PhotoSizeSelectActual
|
||||
import androidx.compose.material.icons.outlined.SecurityUpdateWarning
|
||||
import androidx.compose.material.icons.outlined.SpeakerNotesOff
|
||||
import androidx.compose.material.icons.outlined.StarOutline
|
||||
import androidx.compose.material.icons.outlined.Verified
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -20,6 +23,7 @@ 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.R
|
||||
import com.huanchengfly.tieba.post.dataStore
|
||||
|
|
@ -41,12 +45,16 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
|||
fun HabitSettingsPage(
|
||||
navigator: DestinationsNavigator
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
MyScaffold(
|
||||
backgroundColor = Color.Transparent,
|
||||
topBar = {
|
||||
TitleCentredToolbar(
|
||||
title = stringResource(id = R.string.title_settings_read_habit),
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.title_settings_read_habit),
|
||||
fontWeight = FontWeight.Bold, style = MaterialTheme.typography.h6
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
BackNavigationIcon(onBackPressed = { navigator.navigateUp() })
|
||||
}
|
||||
|
|
@ -232,6 +240,22 @@ fun HabitSettingsPage(
|
|||
},
|
||||
)
|
||||
}
|
||||
prefsItem {
|
||||
SwitchPref(
|
||||
key = "hideReply",
|
||||
title = stringResource(id = R.string.title_hide_reply),
|
||||
defaultChecked = false,
|
||||
leadingIcon = {
|
||||
LeadingIcon {
|
||||
AvatarIcon(
|
||||
icon = Icons.Outlined.SpeakerNotesOff,
|
||||
size = Sizes.Small,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,7 @@ import com.huanchengfly.tieba.post.utils.AccountUtil.LocalAccount
|
|||
import com.huanchengfly.tieba.post.utils.DateTimeUtils
|
||||
import com.huanchengfly.tieba.post.utils.StringUtil
|
||||
import com.huanchengfly.tieba.post.utils.TiebaUtil
|
||||
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet
|
||||
|
|
@ -298,7 +299,7 @@ internal fun SubPostsContent(
|
|||
)
|
||||
},
|
||||
bottomBar = {
|
||||
if (account != null) {
|
||||
if (account != null && !LocalContext.current.appPreferences.hideReply) {
|
||||
Surface(
|
||||
elevation = 16.dp,
|
||||
color = ExtendedTheme.colors.bottomBar,
|
||||
|
|
@ -521,6 +522,7 @@ private fun SubPostItem(
|
|||
menuState = menuState,
|
||||
indication = null,
|
||||
menuContent = {
|
||||
if (!context.appPreferences.hideReply) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
onReplyClick(subPost.get())
|
||||
|
|
@ -529,6 +531,7 @@ private fun SubPostItem(
|
|||
) {
|
||||
Text(text = stringResource(id = R.string.btn_reply))
|
||||
}
|
||||
}
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
TiebaUtil.copyText(
|
||||
|
|
@ -558,7 +561,7 @@ private fun SubPostItem(
|
|||
}
|
||||
}
|
||||
},
|
||||
onClick = { onReplyClick(subPost.get()) }
|
||||
onClick = { onReplyClick(subPost.get()) }.takeUnless { context.appPreferences.hideReply }
|
||||
) {
|
||||
Card(
|
||||
header = {
|
||||
|
|
|
|||
|
|
@ -1463,7 +1463,7 @@ private fun BottomBar(
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
if (user.get { is_login } == 1) {
|
||||
if (user.get { is_login } == 1 && !LocalContext.current.appPreferences.hideReply) {
|
||||
Avatar(
|
||||
data = StringUtil.getAvatarUrl(user.get { portrait }),
|
||||
size = Sizes.Tiny,
|
||||
|
|
@ -1568,8 +1568,9 @@ fun PostCard(
|
|||
indication = null,
|
||||
onClick = {
|
||||
onReplyClick(post)
|
||||
},
|
||||
}.takeIf { !context.appPreferences.hideReply },
|
||||
menuContent = {
|
||||
if (!context.appPreferences.hideReply) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
onReplyClick(post)
|
||||
|
|
@ -1578,6 +1579,7 @@ fun PostCard(
|
|||
) {
|
||||
Text(text = stringResource(id = R.string.btn_reply))
|
||||
}
|
||||
}
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
TiebaUtil.copyText(context, post.content.plainText)
|
||||
|
|
@ -1727,7 +1729,9 @@ fun PostCard(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 12.dp),
|
||||
onReplyClick = { onSubPostReplyClick?.invoke(post, it) },
|
||||
onReplyClick = {
|
||||
onSubPostReplyClick?.invoke(post, it)
|
||||
},
|
||||
onOpenSubPosts = onOpenSubPosts,
|
||||
)
|
||||
}
|
||||
|
|
@ -1764,7 +1768,7 @@ private fun SubPostItem(
|
|||
subPostList: ImmutableHolder<SubPostList>,
|
||||
subPostContent: AnnotatedString,
|
||||
modifier: Modifier = Modifier,
|
||||
onReplyClick: (SubPostList) -> Unit,
|
||||
onReplyClick: ((SubPostList) -> Unit)?,
|
||||
onOpenSubPosts: (Long) -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
|
@ -1772,14 +1776,16 @@ private fun SubPostItem(
|
|||
LongClickMenu(
|
||||
menuState = menuState,
|
||||
menuContent = {
|
||||
if (!context.appPreferences.hideReply) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
onReplyClick(subPostList.get())
|
||||
onReplyClick?.invoke(subPostList.get())
|
||||
menuState.expanded = false
|
||||
}
|
||||
) {
|
||||
Text(text = stringResource(id = R.string.title_reply))
|
||||
}
|
||||
}
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
TiebaUtil.copyText(
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ fun BackNavigationIcon(onBackPressed: () -> Unit) {
|
|||
)""",
|
||||
"androidx.compose.ui.text.font.FontWeight",
|
||||
"androidx.compose.material.MaterialTheme",
|
||||
"androidx.compose.material.Text"
|
||||
)
|
||||
)
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ open class AppPreferencesUtils private constructor(ctx: Context) {
|
|||
|
||||
var hideForumIntroAndStat by DataStoreDelegates.boolean(defaultValue = false)
|
||||
|
||||
var hideReply by DataStoreDelegates.boolean(defaultValue = false)
|
||||
|
||||
var homePageScroll by DataStoreDelegates.boolean(defaultValue = false)
|
||||
|
||||
var imageDarkenWhenNightMode by DataStoreDelegates.boolean(defaultValue = true)
|
||||
|
|
|
|||
|
|
@ -726,4 +726,5 @@
|
|||
<string name="desc_night_theme">夜间主题</string>
|
||||
<string name="settings_image_darken_when_night_mode">夜间模式压暗缩略图</string>
|
||||
<string name="tip_toolbar_primary_color_summary">修改重启后生效</string>
|
||||
<string name="title_hide_reply">隐藏回贴入口</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in New Issue