pref: 吧页面顶栏动画

This commit is contained in:
HuanCheng65 2023-10-06 18:13:19 +08:00
parent 8b358a080a
commit 2c7194cda7
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
4 changed files with 527 additions and 345 deletions

View File

@ -312,7 +312,7 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener,
) )
else else
ForumFragment.newInstance(forumName, false, getSortType()), ForumFragment.newInstance(forumName, false, getSortType()),
getString(R.string.tab_forum_1) getString(R.string.tab_forum_latest)
) )
addFragment( addFragment(
ForumFragment.newInstance(forumName, true, getSortType()), ForumFragment.newInstance(forumName, true, getSortType()),

View File

@ -24,7 +24,6 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.SnackbarResult import androidx.compose.material.SnackbarResult
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.pullrefresh.PullRefreshIndicator import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@ -276,12 +275,14 @@ fun ForumThreadListPage(
forumId: Long, forumId: Long,
forumName: String, forumName: String,
isGood: Boolean = false, isGood: Boolean = false,
lazyListState: LazyListState = rememberLazyListState(),
viewModel: ForumThreadListViewModel = if (isGood) pageViewModel<GoodThreadListViewModel>() else pageViewModel<LatestThreadListViewModel>() viewModel: ForumThreadListViewModel = if (isGood) pageViewModel<GoodThreadListViewModel>() else pageViewModel<LatestThreadListViewModel>()
) { ) {
val context = LocalContext.current val context = LocalContext.current
val navigator = LocalNavigator.current val navigator = LocalNavigator.current
val snackbarHostState = LocalSnackbarHostState.current val snackbarHostState = LocalSnackbarHostState.current
val lazyListState = rememberLazyListState()
LazyLoad(loaded = viewModel.initialized) { LazyLoad(loaded = viewModel.initialized) {
viewModel.send(getFirstLoadIntent(context, forumName, isGood)) viewModel.send(getFirstLoadIntent(context, forumName, isGood))
viewModel.initialized = true viewModel.initialized = true
@ -356,7 +357,7 @@ fun ForumThreadListPage(
refreshing = isRefreshing, refreshing = isRefreshing,
onRefresh = { viewModel.send(getRefreshIntent(context, forumName, isGood)) } onRefresh = { viewModel.send(getRefreshIntent(context, forumName, isGood)) }
) )
Box(modifier = Modifier.pullRefresh(pullRefreshState)) { Box {
LoadMoreLayout( LoadMoreLayout(
isLoading = isLoadingMore, isLoading = isLoadingMore,
onLoadMore = { onLoadMore = {

View File

@ -134,8 +134,8 @@
<string name="button_signed">已签到</string> <string name="button_signed">已签到</string>
<string name="button_like">关注</string> <string name="button_like">关注</string>
<string name="toast_like_success">关注成功,你是第 %s 个关注本吧的</string> <string name="toast_like_success">关注成功,你是第 %s 个关注本吧的</string>
<string name="tab_forum_1">查看贴子</string> <string name="tab_forum_latest">最新</string>
<string name="tab_forum_good">吧内精华</string> <string name="tab_forum_good">精华</string>
<string name="tip_good"></string> <string name="tip_good"></string>
<string name="title_my_message">我的消息</string> <string name="title_my_message">我的消息</string>
<string name="title_messages">消息</string> <string name="title_messages">消息</string>
@ -745,4 +745,6 @@
<string name="title_forum_intro">本吧简介</string> <string name="title_forum_intro">本吧简介</string>
<string name="title_forum_rule">本吧吧规</string> <string name="title_forum_rule">本吧吧规</string>
<string name="desc_forum_rule">吧规</string> <string name="desc_forum_rule">吧规</string>
<string name="pull_down_to_refresh">继续下拉以刷新</string>
<string name="release_to_refresh">松手刷新</string>
</resources> </resources>