Handle reader app bar insets in Compose

(cherry picked from commit 8057f067b964835897a2365cee0307cfdc1472f6)

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
This commit is contained in:
arkon 2023-10-25 09:21:04 -04:00 committed by Jobobby04
parent 7ccb8eaaf2
commit fd02759a56
3 changed files with 6 additions and 12 deletions

View File

@ -19,7 +19,7 @@ fun BrightnessOverlay(
.fillMaxSize()
.graphicsLayer {
alpha = abs(value) / 100f
}
},
) {
drawRect(Color.Black)
}

View File

@ -117,13 +117,12 @@ fun ReaderAppBars(
.surfaceColorAtElevation(3.dp)
.copy(alpha = if (isSystemInDarkTheme()) 0.9f else 0.95f)
val appBarModifier = if (fullscreen) {
val modifierWithInsetsPadding = if (fullscreen) {
Modifier.systemBarsPadding()
} else {
Modifier
}
// SY -->
BoxIgnoreLayoutDirection(
Modifier.fillMaxWidth()
@ -138,7 +137,7 @@ fun ReaderAppBars(
targetOffsetX = { -it },
animationSpec = animationSpec,
),
modifier = Modifier
modifier = modifierWithInsetsPadding
.padding(bottom = 48.dp, top = 120.dp)
.align(Alignment.TopStart)
) {
@ -166,7 +165,7 @@ fun ReaderAppBars(
targetOffsetX = { it },
animationSpec = animationSpec,
),
modifier = Modifier
modifier = modifierWithInsetsPadding
.padding(bottom = 48.dp, top = 120.dp)
.align(Alignment.TopEnd)
) {
@ -200,7 +199,7 @@ fun ReaderAppBars(
),
) {
// SY -->
Column(appBarModifier) {
Column(modifierWithInsetsPadding) {
// SY <--
AppBar(
modifier = /*SY --> */ Modifier /*SY <-- */
@ -268,6 +267,7 @@ fun ReaderAppBars(
),
) {
Column(
modifier = modifierWithInsetsPadding,
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
if (navBarType == NavBarType.Bottom) {

View File

@ -339,12 +339,6 @@ class ReaderActivity : BaseActivity() {
* Initializes the reader menu. It sets up click listeners and the initial visibility.
*/
private fun initializeMenu() {
binding.dialogRoot.applyInsetter {
type(navigationBars = true) {
margin(vertical = true, horizontal = true)
}
}
binding.pageNumber.setComposeContent {
val state by viewModel.state.collectAsState()
val showPageNumber by viewModel.readerPreferences.showPageNumber().collectAsState()