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.foundation.layout.size
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
import androidx.compose.material.ExperimentalMaterialApi
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Apps
|
import androidx.compose.material.icons.outlined.Apps
|
||||||
import androidx.compose.material.icons.outlined.Brightness2
|
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.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
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.Icons
|
||||||
import androidx.compose.material.icons.outlined.BrandingWatermark
|
import androidx.compose.material.icons.outlined.BrandingWatermark
|
||||||
import androidx.compose.material.icons.outlined.CalendarViewDay
|
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.NightsStay
|
||||||
import androidx.compose.material.icons.outlined.PhotoSizeSelectActual
|
import androidx.compose.material.icons.outlined.PhotoSizeSelectActual
|
||||||
import androidx.compose.material.icons.outlined.SecurityUpdateWarning
|
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.StarOutline
|
||||||
import androidx.compose.material.icons.outlined.Verified
|
import androidx.compose.material.icons.outlined.Verified
|
||||||
import androidx.compose.runtime.Composable
|
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.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.huanchengfly.tieba.post.R
|
import com.huanchengfly.tieba.post.R
|
||||||
import com.huanchengfly.tieba.post.dataStore
|
import com.huanchengfly.tieba.post.dataStore
|
||||||
|
|
@ -41,12 +45,16 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||||
fun HabitSettingsPage(
|
fun HabitSettingsPage(
|
||||||
navigator: DestinationsNavigator
|
navigator: DestinationsNavigator
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
|
||||||
MyScaffold(
|
MyScaffold(
|
||||||
backgroundColor = Color.Transparent,
|
backgroundColor = Color.Transparent,
|
||||||
topBar = {
|
topBar = {
|
||||||
TitleCentredToolbar(
|
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 = {
|
navigationIcon = {
|
||||||
BackNavigationIcon(onBackPressed = { navigator.navigateUp() })
|
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.DateTimeUtils
|
||||||
import com.huanchengfly.tieba.post.utils.StringUtil
|
import com.huanchengfly.tieba.post.utils.StringUtil
|
||||||
import com.huanchengfly.tieba.post.utils.TiebaUtil
|
import com.huanchengfly.tieba.post.utils.TiebaUtil
|
||||||
|
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||||
import com.ramcosta.composedestinations.annotation.Destination
|
import com.ramcosta.composedestinations.annotation.Destination
|
||||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||||
import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet
|
import com.ramcosta.composedestinations.spec.DestinationStyleBottomSheet
|
||||||
|
|
@ -298,7 +299,7 @@ internal fun SubPostsContent(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
if (account != null) {
|
if (account != null && !LocalContext.current.appPreferences.hideReply) {
|
||||||
Surface(
|
Surface(
|
||||||
elevation = 16.dp,
|
elevation = 16.dp,
|
||||||
color = ExtendedTheme.colors.bottomBar,
|
color = ExtendedTheme.colors.bottomBar,
|
||||||
|
|
@ -521,13 +522,15 @@ private fun SubPostItem(
|
||||||
menuState = menuState,
|
menuState = menuState,
|
||||||
indication = null,
|
indication = null,
|
||||||
menuContent = {
|
menuContent = {
|
||||||
DropdownMenuItem(
|
if (!context.appPreferences.hideReply) {
|
||||||
onClick = {
|
DropdownMenuItem(
|
||||||
onReplyClick(subPost.get())
|
onClick = {
|
||||||
menuState.expanded = false
|
onReplyClick(subPost.get())
|
||||||
|
menuState.expanded = false
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(text = stringResource(id = R.string.btn_reply))
|
||||||
}
|
}
|
||||||
) {
|
|
||||||
Text(text = stringResource(id = R.string.btn_reply))
|
|
||||||
}
|
}
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
@ -558,7 +561,7 @@ private fun SubPostItem(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick = { onReplyClick(subPost.get()) }
|
onClick = { onReplyClick(subPost.get()) }.takeUnless { context.appPreferences.hideReply }
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
header = {
|
header = {
|
||||||
|
|
|
||||||
|
|
@ -1463,7 +1463,7 @@ private fun BottomBar(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (user.get { is_login } == 1) {
|
if (user.get { is_login } == 1 && !LocalContext.current.appPreferences.hideReply) {
|
||||||
Avatar(
|
Avatar(
|
||||||
data = StringUtil.getAvatarUrl(user.get { portrait }),
|
data = StringUtil.getAvatarUrl(user.get { portrait }),
|
||||||
size = Sizes.Tiny,
|
size = Sizes.Tiny,
|
||||||
|
|
@ -1568,15 +1568,17 @@ fun PostCard(
|
||||||
indication = null,
|
indication = null,
|
||||||
onClick = {
|
onClick = {
|
||||||
onReplyClick(post)
|
onReplyClick(post)
|
||||||
},
|
}.takeIf { !context.appPreferences.hideReply },
|
||||||
menuContent = {
|
menuContent = {
|
||||||
DropdownMenuItem(
|
if (!context.appPreferences.hideReply) {
|
||||||
onClick = {
|
DropdownMenuItem(
|
||||||
onReplyClick(post)
|
onClick = {
|
||||||
menuState.expanded = false
|
onReplyClick(post)
|
||||||
|
menuState.expanded = false
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(text = stringResource(id = R.string.btn_reply))
|
||||||
}
|
}
|
||||||
) {
|
|
||||||
Text(text = stringResource(id = R.string.btn_reply))
|
|
||||||
}
|
}
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
@ -1727,7 +1729,9 @@ fun PostCard(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 12.dp),
|
.padding(horizontal = 12.dp),
|
||||||
onReplyClick = { onSubPostReplyClick?.invoke(post, it) },
|
onReplyClick = {
|
||||||
|
onSubPostReplyClick?.invoke(post, it)
|
||||||
|
},
|
||||||
onOpenSubPosts = onOpenSubPosts,
|
onOpenSubPosts = onOpenSubPosts,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1764,7 +1768,7 @@ private fun SubPostItem(
|
||||||
subPostList: ImmutableHolder<SubPostList>,
|
subPostList: ImmutableHolder<SubPostList>,
|
||||||
subPostContent: AnnotatedString,
|
subPostContent: AnnotatedString,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onReplyClick: (SubPostList) -> Unit,
|
onReplyClick: ((SubPostList) -> Unit)?,
|
||||||
onOpenSubPosts: (Long) -> Unit,
|
onOpenSubPosts: (Long) -> Unit,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
@ -1772,13 +1776,15 @@ private fun SubPostItem(
|
||||||
LongClickMenu(
|
LongClickMenu(
|
||||||
menuState = menuState,
|
menuState = menuState,
|
||||||
menuContent = {
|
menuContent = {
|
||||||
DropdownMenuItem(
|
if (!context.appPreferences.hideReply) {
|
||||||
onClick = {
|
DropdownMenuItem(
|
||||||
onReplyClick(subPostList.get())
|
onClick = {
|
||||||
menuState.expanded = false
|
onReplyClick?.invoke(subPostList.get())
|
||||||
|
menuState.expanded = false
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(text = stringResource(id = R.string.title_reply))
|
||||||
}
|
}
|
||||||
) {
|
|
||||||
Text(text = stringResource(id = R.string.title_reply))
|
|
||||||
}
|
}
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ fun BackNavigationIcon(onBackPressed: () -> Unit) {
|
||||||
)""",
|
)""",
|
||||||
"androidx.compose.ui.text.font.FontWeight",
|
"androidx.compose.ui.text.font.FontWeight",
|
||||||
"androidx.compose.material.MaterialTheme",
|
"androidx.compose.material.MaterialTheme",
|
||||||
|
"androidx.compose.material.Text"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,8 @@ open class AppPreferencesUtils private constructor(ctx: Context) {
|
||||||
|
|
||||||
var hideForumIntroAndStat by DataStoreDelegates.boolean(defaultValue = false)
|
var hideForumIntroAndStat by DataStoreDelegates.boolean(defaultValue = false)
|
||||||
|
|
||||||
|
var hideReply by DataStoreDelegates.boolean(defaultValue = false)
|
||||||
|
|
||||||
var homePageScroll by DataStoreDelegates.boolean(defaultValue = false)
|
var homePageScroll by DataStoreDelegates.boolean(defaultValue = false)
|
||||||
|
|
||||||
var imageDarkenWhenNightMode by DataStoreDelegates.boolean(defaultValue = true)
|
var imageDarkenWhenNightMode by DataStoreDelegates.boolean(defaultValue = true)
|
||||||
|
|
|
||||||
|
|
@ -726,4 +726,5 @@
|
||||||
<string name="desc_night_theme">夜间主题</string>
|
<string name="desc_night_theme">夜间主题</string>
|
||||||
<string name="settings_image_darken_when_night_mode">夜间模式压暗缩略图</string>
|
<string name="settings_image_darken_when_night_mode">夜间模式压暗缩略图</string>
|
||||||
<string name="tip_toolbar_primary_color_summary">修改重启后生效</string>
|
<string name="tip_toolbar_primary_color_summary">修改重启后生效</string>
|
||||||
|
<string name="title_hide_reply">隐藏回贴入口</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue