feat: 历史记录新 UI

This commit is contained in:
HuanCheng65 2023-01-08 12:06:56 +08:00
parent 0c75052380
commit ffb20dc817
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
2 changed files with 9 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.rememberPagerState import com.google.accompanist.pager.rememberPagerState
import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme
import com.huanchengfly.tieba.post.ui.page.ProvideNavigator
import com.huanchengfly.tieba.post.ui.page.history.list.HistoryListPage import com.huanchengfly.tieba.post.ui.page.history.list.HistoryListPage
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.MyScaffold import com.huanchengfly.tieba.post.ui.widgets.compose.MyScaffold
@ -113,6 +114,7 @@ fun HistoryPage(
} }
} }
) { ) {
ProvideNavigator(navigator = navigator) {
HorizontalPager( HorizontalPager(
count = 2, count = 2,
state = pagerState, state = pagerState,
@ -128,3 +130,4 @@ fun HistoryPage(
} }
} }
} }
}

View File

@ -30,6 +30,8 @@ import com.huanchengfly.tieba.post.fromJson
import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean
import com.huanchengfly.tieba.post.models.database.History import com.huanchengfly.tieba.post.models.database.History
import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme
import com.huanchengfly.tieba.post.ui.page.LocalNavigator
import com.huanchengfly.tieba.post.ui.page.destinations.ForumPageDestination
import com.huanchengfly.tieba.post.ui.widgets.Chip import com.huanchengfly.tieba.post.ui.widgets.Chip
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.LazyLoad import com.huanchengfly.tieba.post.ui.widgets.compose.LazyLoad
@ -74,6 +76,7 @@ fun HistoryListPage(
) )
val context = LocalContext.current val context = LocalContext.current
val navigator = LocalNavigator.current
val snackbarHostState = LocalSnackbarHostState.current val snackbarHostState = LocalSnackbarHostState.current
LaunchedEffect(null) { LaunchedEffect(null) {
onEvent<HistoryListUiEvent.Delete.Failure>(viewModel) { onEvent<HistoryListUiEvent.Delete.Failure>(viewModel) {
@ -123,10 +126,9 @@ fun HistoryListPage(
}, },
onClick = { onClick = {
when (it.type) { when (it.type) {
HistoryUtil.TYPE_FORUM -> ForumActivity.launch( HistoryUtil.TYPE_FORUM -> {
context, navigator.navigate(ForumPageDestination(it.data))
it.data }
)
HistoryUtil.TYPE_THREAD -> { HistoryUtil.TYPE_THREAD -> {
val extra = val extra =