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:
parent
7ccb8eaaf2
commit
fd02759a56
@ -19,7 +19,7 @@ fun BrightnessOverlay(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.graphicsLayer {
|
.graphicsLayer {
|
||||||
alpha = abs(value) / 100f
|
alpha = abs(value) / 100f
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
drawRect(Color.Black)
|
drawRect(Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -117,13 +117,12 @@ fun ReaderAppBars(
|
|||||||
.surfaceColorAtElevation(3.dp)
|
.surfaceColorAtElevation(3.dp)
|
||||||
.copy(alpha = if (isSystemInDarkTheme()) 0.9f else 0.95f)
|
.copy(alpha = if (isSystemInDarkTheme()) 0.9f else 0.95f)
|
||||||
|
|
||||||
val appBarModifier = if (fullscreen) {
|
val modifierWithInsetsPadding = if (fullscreen) {
|
||||||
Modifier.systemBarsPadding()
|
Modifier.systemBarsPadding()
|
||||||
} else {
|
} else {
|
||||||
Modifier
|
Modifier
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
BoxIgnoreLayoutDirection(
|
BoxIgnoreLayoutDirection(
|
||||||
Modifier.fillMaxWidth()
|
Modifier.fillMaxWidth()
|
||||||
@ -138,7 +137,7 @@ fun ReaderAppBars(
|
|||||||
targetOffsetX = { -it },
|
targetOffsetX = { -it },
|
||||||
animationSpec = animationSpec,
|
animationSpec = animationSpec,
|
||||||
),
|
),
|
||||||
modifier = Modifier
|
modifier = modifierWithInsetsPadding
|
||||||
.padding(bottom = 48.dp, top = 120.dp)
|
.padding(bottom = 48.dp, top = 120.dp)
|
||||||
.align(Alignment.TopStart)
|
.align(Alignment.TopStart)
|
||||||
) {
|
) {
|
||||||
@ -166,7 +165,7 @@ fun ReaderAppBars(
|
|||||||
targetOffsetX = { it },
|
targetOffsetX = { it },
|
||||||
animationSpec = animationSpec,
|
animationSpec = animationSpec,
|
||||||
),
|
),
|
||||||
modifier = Modifier
|
modifier = modifierWithInsetsPadding
|
||||||
.padding(bottom = 48.dp, top = 120.dp)
|
.padding(bottom = 48.dp, top = 120.dp)
|
||||||
.align(Alignment.TopEnd)
|
.align(Alignment.TopEnd)
|
||||||
) {
|
) {
|
||||||
@ -200,7 +199,7 @@ fun ReaderAppBars(
|
|||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
// SY -->
|
// SY -->
|
||||||
Column(appBarModifier) {
|
Column(modifierWithInsetsPadding) {
|
||||||
// SY <--
|
// SY <--
|
||||||
AppBar(
|
AppBar(
|
||||||
modifier = /*SY --> */ Modifier /*SY <-- */
|
modifier = /*SY --> */ Modifier /*SY <-- */
|
||||||
@ -268,6 +267,7 @@ fun ReaderAppBars(
|
|||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
modifier = modifierWithInsetsPadding,
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
if (navBarType == NavBarType.Bottom) {
|
if (navBarType == NavBarType.Bottom) {
|
||||||
|
@ -339,12 +339,6 @@ class ReaderActivity : BaseActivity() {
|
|||||||
* Initializes the reader menu. It sets up click listeners and the initial visibility.
|
* Initializes the reader menu. It sets up click listeners and the initial visibility.
|
||||||
*/
|
*/
|
||||||
private fun initializeMenu() {
|
private fun initializeMenu() {
|
||||||
binding.dialogRoot.applyInsetter {
|
|
||||||
type(navigationBars = true) {
|
|
||||||
margin(vertical = true, horizontal = true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.pageNumber.setComposeContent {
|
binding.pageNumber.setComposeContent {
|
||||||
val state by viewModel.state.collectAsState()
|
val state by viewModel.state.collectAsState()
|
||||||
val showPageNumber by viewModel.readerPreferences.showPageNumber().collectAsState()
|
val showPageNumber by viewModel.readerPreferences.showPageNumber().collectAsState()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user