mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 18:25:09 +01:00
MangaScreen: Adjust insets (#8097)
I should have done this when Scaffold was rebased
This commit is contained in:
parent
5a37f2398a
commit
6b1d597d34
@ -12,7 +12,12 @@ import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.ZeroCornerSize
|
||||
@ -86,7 +91,7 @@ fun MangaBottomActionMenu(
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.navigationBarsPadding()
|
||||
.padding(WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues())
|
||||
.padding(horizontal = 8.dp, vertical = 12.dp),
|
||||
) {
|
||||
if (onBookmarkClicked != null) {
|
||||
|
@ -66,7 +66,6 @@ import eu.kanade.presentation.manga.components.MangaChapterListItem
|
||||
import eu.kanade.presentation.manga.components.MangaInfoBox
|
||||
import eu.kanade.presentation.util.isScrolledToEnd
|
||||
import eu.kanade.presentation.util.isScrollingUp
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
@ -207,7 +206,6 @@ private fun MangaScreenSmallImpl(
|
||||
onAllChapterSelected: (Boolean) -> Unit,
|
||||
onInvertSelection: () -> Unit,
|
||||
) {
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
val chapterListState = rememberLazyListState()
|
||||
|
||||
val chapters = remember(state) { state.processedChapters.toList() }
|
||||
@ -222,6 +220,8 @@ private fun MangaScreenSmallImpl(
|
||||
BackHandler(onBack = internalOnBackPressed)
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier
|
||||
.padding(WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal).asPaddingValues()),
|
||||
topBar = {
|
||||
val firstVisibleItemIndex by remember {
|
||||
derivedStateOf { chapterListState.firstVisibleItemIndex }
|
||||
@ -287,11 +287,6 @@ private fun MangaScreenSmallImpl(
|
||||
}
|
||||
},
|
||||
) { contentPadding ->
|
||||
val noTopContentPadding = PaddingValues(
|
||||
start = contentPadding.calculateStartPadding(layoutDirection),
|
||||
end = contentPadding.calculateEndPadding(layoutDirection),
|
||||
bottom = contentPadding.calculateBottomPadding(),
|
||||
) + WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
val topPadding = contentPadding.calculateTopPadding()
|
||||
|
||||
SwipeRefresh(
|
||||
@ -309,12 +304,13 @@ private fun MangaScreenSmallImpl(
|
||||
VerticalFastScroller(
|
||||
listState = chapterListState,
|
||||
topContentPadding = topPadding,
|
||||
endContentPadding = noTopContentPadding.calculateEndPadding(layoutDirection),
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxHeight(),
|
||||
state = chapterListState,
|
||||
contentPadding = noTopContentPadding,
|
||||
contentPadding = PaddingValues(
|
||||
bottom = contentPadding.calculateBottomPadding(),
|
||||
),
|
||||
) {
|
||||
item(
|
||||
key = MangaScreenItem.INFO_BOX,
|
||||
@ -518,8 +514,6 @@ fun MangaScreenLargeImpl(
|
||||
},
|
||||
) { contentPadding ->
|
||||
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
||||
val withNavBarContentPadding = contentPadding +
|
||||
WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
val firstWidth = (maxWidth / 2).coerceAtMost(450.dp)
|
||||
val secondWidth = maxWidth - firstWidth
|
||||
|
||||
@ -527,8 +521,7 @@ fun MangaScreenLargeImpl(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopStart)
|
||||
.width(firstWidth)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(bottom = withNavBarContentPadding.calculateBottomPadding()),
|
||||
.verticalScroll(rememberScrollState()),
|
||||
) {
|
||||
MangaInfoBox(
|
||||
windowWidthSizeClass = windowWidthSizeClass,
|
||||
@ -564,13 +557,15 @@ fun MangaScreenLargeImpl(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.width(secondWidth),
|
||||
topContentPadding = withNavBarContentPadding.calculateTopPadding(),
|
||||
endContentPadding = withNavBarContentPadding.calculateEndPadding(layoutDirection),
|
||||
topContentPadding = contentPadding.calculateTopPadding(),
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxHeight(),
|
||||
state = chapterListState,
|
||||
contentPadding = withNavBarContentPadding,
|
||||
contentPadding = PaddingValues(
|
||||
top = contentPadding.calculateTopPadding(),
|
||||
bottom = contentPadding.calculateBottomPadding(),
|
||||
),
|
||||
) {
|
||||
item(
|
||||
key = MangaScreenItem.CHAPTER_HEADER,
|
||||
@ -599,6 +594,7 @@ fun MangaScreenLargeImpl(
|
||||
@Composable
|
||||
private fun SharedMangaBottomActionMenu(
|
||||
selected: List<ChapterItem>,
|
||||
modifier: Modifier = Modifier,
|
||||
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
||||
onMultiMarkAsReadClicked: (List<Chapter>, markAsRead: Boolean) -> Unit,
|
||||
onMarkPreviousAsReadClicked: (Chapter) -> Unit,
|
||||
@ -608,7 +604,7 @@ private fun SharedMangaBottomActionMenu(
|
||||
) {
|
||||
MangaBottomActionMenu(
|
||||
visible = selected.isNotEmpty(),
|
||||
modifier = Modifier.fillMaxWidth(fillFraction),
|
||||
modifier = modifier.fillMaxWidth(fillFraction),
|
||||
onBookmarkClicked = {
|
||||
onMultiBookmarkClicked.invoke(selected.map { it.chapter }, true)
|
||||
}.takeIf { selected.any { !it.chapter.bookmark } },
|
||||
|
Loading…
Reference in New Issue
Block a user