Fix full screen when re-enter ReadPage
This commit is contained in:
parent
77cd5ca872
commit
8263b12ae7
|
@ -57,7 +57,7 @@ fun GroupItem(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(start = 28.dp),
|
modifier = Modifier.weight(1f).padding(start = 28.dp),
|
||||||
text = text,
|
text = text,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondaryContainer,
|
color = MaterialTheme.colorScheme.onSecondaryContainer,
|
||||||
|
|
|
@ -68,6 +68,7 @@ fun ReadPage(
|
||||||
|
|
||||||
LaunchedEffect(readViewModel.viewState) {
|
LaunchedEffect(readViewModel.viewState) {
|
||||||
readViewModel.viewState.collect {
|
readViewModel.viewState.collect {
|
||||||
|
isScrollDown = false
|
||||||
if (it.articleWithFeed != null) {
|
if (it.articleWithFeed != null) {
|
||||||
if (it.articleWithFeed.article.isUnread) {
|
if (it.articleWithFeed.article.isUnread) {
|
||||||
readViewModel.dispatch(ReadViewAction.MarkUnread(false))
|
readViewModel.dispatch(ReadViewAction.MarkUnread(false))
|
||||||
|
@ -90,7 +91,13 @@ fun ReadPage(
|
||||||
.zIndex(1f),
|
.zIndex(1f),
|
||||||
contentAlignment = Alignment.TopCenter
|
contentAlignment = Alignment.TopCenter
|
||||||
) {
|
) {
|
||||||
TopBar(isScrollDown, homeViewModel, scope, readViewModel, viewState)
|
TopBar(
|
||||||
|
viewState.articleWithFeed == null || !isScrollDown,
|
||||||
|
homeViewModel,
|
||||||
|
scope,
|
||||||
|
readViewModel,
|
||||||
|
viewState
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Content(viewState, viewState.articleWithFeed, context)
|
Content(viewState, viewState.articleWithFeed, context)
|
||||||
Box(
|
Box(
|
||||||
|
@ -99,7 +106,11 @@ fun ReadPage(
|
||||||
.zIndex(1f),
|
.zIndex(1f),
|
||||||
contentAlignment = Alignment.BottomCenter
|
contentAlignment = Alignment.BottomCenter
|
||||||
) {
|
) {
|
||||||
BottomBar(isScrollDown, viewState.articleWithFeed, readViewModel)
|
BottomBar(
|
||||||
|
viewState.articleWithFeed != null && !isScrollDown,
|
||||||
|
viewState.articleWithFeed,
|
||||||
|
readViewModel
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -109,14 +120,14 @@ fun ReadPage(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun TopBar(
|
private fun TopBar(
|
||||||
isScrollDown: Boolean,
|
isShow: Boolean,
|
||||||
homeViewModel: HomeViewModel,
|
homeViewModel: HomeViewModel,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
readViewModel: ReadViewModel,
|
readViewModel: ReadViewModel,
|
||||||
viewState: ReadViewState
|
viewState: ReadViewState
|
||||||
) {
|
) {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = !isScrollDown,
|
visible = isShow,
|
||||||
enter = fadeIn() + expandVertically(),
|
enter = fadeIn() + expandVertically(),
|
||||||
exit = fadeOut() + shrinkVertically(),
|
exit = fadeOut() + shrinkVertically(),
|
||||||
) {
|
) {
|
||||||
|
@ -169,13 +180,13 @@ private fun TopBar(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun BottomBar(
|
private fun BottomBar(
|
||||||
isScrollDown: Boolean,
|
isShow: Boolean,
|
||||||
articleWithFeed: ArticleWithFeed?,
|
articleWithFeed: ArticleWithFeed?,
|
||||||
readViewModel: ReadViewModel
|
readViewModel: ReadViewModel
|
||||||
) {
|
) {
|
||||||
articleWithFeed?.let {
|
articleWithFeed?.let {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = !isScrollDown,
|
visible = isShow,
|
||||||
enter = fadeIn() + expandVertically(),
|
enter = fadeIn() + expandVertically(),
|
||||||
exit = fadeOut() + shrinkVertically(),
|
exit = fadeOut() + shrinkVertically(),
|
||||||
) {
|
) {
|
||||||
|
@ -209,7 +220,9 @@ private fun Content(
|
||||||
if (articleWithFeed == null) {
|
if (articleWithFeed == null) {
|
||||||
Spacer(modifier = Modifier.height(64.dp))
|
Spacer(modifier = Modifier.height(64.dp))
|
||||||
LottieAnimation(
|
LottieAnimation(
|
||||||
modifier = Modifier.alpha(0.7f).padding(80.dp),
|
modifier = Modifier
|
||||||
|
.alpha(0.7f)
|
||||||
|
.padding(80.dp),
|
||||||
url = "https://assets8.lottiefiles.com/packages/lf20_jm7mv1ib.json",
|
url = "https://assets8.lottiefiles.com/packages/lf20_jm7mv1ib.json",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user