Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
feat: “从收藏进入的帖子自动倒序阅读”功能 [#73]
Browse files Browse the repository at this point in the history
  • Loading branch information
JiunnTarn committed Oct 4, 2023
1 parent d53bf5a commit 00ed087
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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.material.icons.rounded.Sort
import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -225,6 +226,24 @@ fun HabitSettingsPage(
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 {
SwitchPref(
key = "show_both_username_and_nickname",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.thread.ThreadPageFrom
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.BackNavigationIcon
import com.huanchengfly.tieba.post.ui.widgets.compose.ErrorScreen
Expand Down Expand Up @@ -195,6 +196,7 @@ fun ThreadStorePage(
threadId = info.threadId.toLong(),
postId = info.markPid.toLong(),
seeLz = context.appPreferences.collectThreadSeeLz,
sortType = if(context.appPreferences.collectThreadDescSort) ThreadSortType.SORT_TYPE_DESC else ThreadSortType.SORT_TYPE_DEFAULT,
from = ThreadPageFrom.FROM_STORE,
extra = ThreadPageFromStoreExtra(
maxPid = info.maxPid.toLong(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ open class AppPreferencesUtils private constructor(ctx: Context) {
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 customStatusBarFontDark by DataStoreDelegates.boolean(
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@
<string name="settings_collect_thread_see_lz">收藏贴自动开启只看楼主</string>
<string name="tip_collect_thread_see_lz">开启后,从收藏进入的贴子将自动切换至只看楼主</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="button_submit_dislike">不感兴趣</string>
<string name="title_dislike">不喜欢推荐用户的理由</string>
Expand Down

0 comments on commit 00ed087

Please sign in to comment.