feat: 从收藏进入的帖子自动倒序阅读 [#73] (#217)

This commit is contained in:
JiunnTarn 2023-10-04 23:23:39 +08:00 committed by GitHub
parent d53bf5a8e1
commit 884218b50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import androidx.compose.material.icons.outlined.SecurityUpdateWarning
import androidx.compose.material.icons.outlined.SpeakerNotesOff 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.material.icons.rounded.Sort
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -225,6 +226,24 @@ fun HabitSettingsPage(
summaryOff = stringResource(id = R.string.tip_collect_thread_see_lz) summaryOff = stringResource(id = R.string.tip_collect_thread_see_lz)
) )
} }
prefsItem {
SwitchPref(
key = "collect_thread_desc_sort",
title = stringResource(id = R.string.settings_collect_thread_desc_sort),
defaultChecked = false,
leadingIcon = {
LeadingIcon {
AvatarIcon(
icon = Icons.Rounded.Sort,
size = Sizes.Small,
contentDescription = null,
)
}
},
summaryOn = stringResource(id = R.string.tip_collect_thread_desc_sort_on),
summaryOff = stringResource(id = R.string.tip_collect_thread_desc_sort)
)
}
prefsItem { prefsItem {
SwitchPref( SwitchPref(
key = "show_both_username_and_nickname", key = "show_both_username_and_nickname",

View File

@ -52,6 +52,7 @@ import com.huanchengfly.tieba.post.ui.common.theme.compose.pullRefreshIndicator
import com.huanchengfly.tieba.post.ui.page.destinations.ThreadPageDestination import com.huanchengfly.tieba.post.ui.page.destinations.ThreadPageDestination
import com.huanchengfly.tieba.post.ui.page.thread.ThreadPageFrom import com.huanchengfly.tieba.post.ui.page.thread.ThreadPageFrom
import com.huanchengfly.tieba.post.ui.page.thread.ThreadPageFromStoreExtra import com.huanchengfly.tieba.post.ui.page.thread.ThreadPageFromStoreExtra
import com.huanchengfly.tieba.post.ui.page.thread.ThreadSortType
import com.huanchengfly.tieba.post.ui.widgets.compose.Avatar import com.huanchengfly.tieba.post.ui.widgets.compose.Avatar
import com.huanchengfly.tieba.post.ui.widgets.compose.BackNavigationIcon import com.huanchengfly.tieba.post.ui.widgets.compose.BackNavigationIcon
import com.huanchengfly.tieba.post.ui.widgets.compose.ErrorScreen import com.huanchengfly.tieba.post.ui.widgets.compose.ErrorScreen
@ -195,6 +196,7 @@ fun ThreadStorePage(
threadId = info.threadId.toLong(), threadId = info.threadId.toLong(),
postId = info.markPid.toLong(), postId = info.markPid.toLong(),
seeLz = context.appPreferences.collectThreadSeeLz, seeLz = context.appPreferences.collectThreadSeeLz,
sortType = if(context.appPreferences.collectThreadDescSort) ThreadSortType.SORT_TYPE_DESC else ThreadSortType.SORT_TYPE_DEFAULT,
from = ThreadPageFrom.FROM_STORE, from = ThreadPageFrom.FROM_STORE,
extra = ThreadPageFromStoreExtra( extra = ThreadPageFromStoreExtra(
maxPid = info.maxPid.toLong(), maxPid = info.maxPid.toLong(),

View File

@ -77,6 +77,11 @@ open class AppPreferencesUtils private constructor(ctx: Context) {
key = "collect_thread_see_lz" key = "collect_thread_see_lz"
) )
var collectThreadDescSort by DataStoreDelegates.boolean(
defaultValue = false,
key = "collect_thread_desc_sort"
)
var customPrimaryColor by DataStoreDelegates.string(key = "custom_primary_color") var customPrimaryColor by DataStoreDelegates.string(key = "custom_primary_color")
var customStatusBarFontDark by DataStoreDelegates.boolean( var customStatusBarFontDark by DataStoreDelegates.boolean(

View File

@ -259,6 +259,9 @@
<string name="settings_collect_thread_see_lz">收藏贴自动开启只看楼主</string> <string name="settings_collect_thread_see_lz">收藏贴自动开启只看楼主</string>
<string name="tip_collect_thread_see_lz">开启后,从收藏进入的贴子将自动切换至只看楼主</string> <string name="tip_collect_thread_see_lz">开启后,从收藏进入的贴子将自动切换至只看楼主</string>
<string name="tip_collect_thread_see_lz_on">从收藏进入的贴子将自动切换至只看楼主</string> <string name="tip_collect_thread_see_lz_on">从收藏进入的贴子将自动切换至只看楼主</string>
<string name="settings_collect_thread_desc_sort">收藏贴自动开启倒序浏览</string>
<string name="tip_collect_thread_desc_sort">开启后,从收藏进入的贴子将自动切换至倒序浏览</string>
<string name="tip_collect_thread_desc_sort_on">从收藏进入的贴子将自动切换至倒序浏览</string>
<string name="toast_feed_refresh">更新了 %1$d 条动态</string> <string name="toast_feed_refresh">更新了 %1$d 条动态</string>
<string name="button_submit_dislike">不感兴趣</string> <string name="button_submit_dislike">不感兴趣</string>
<string name="title_dislike">不喜欢推荐用户的理由</string> <string name="title_dislike">不喜欢推荐用户的理由</string>