Tweak manga cover dialog UI

Closes #8654, although it's just a workaround. The cover itself doesn't appear within the inset areas when zoomed.
This commit is contained in:
arkon 2022-12-04 12:55:58 -05:00
parent be854b3e90
commit d7a21771a5

View File

@ -7,12 +7,10 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Edit
@ -31,6 +29,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.DpOffset
@ -69,21 +69,24 @@ fun MangaCoverDialog(
) {
Scaffold(
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
containerColor = Color.Transparent,
bottomBar = {
Row(
modifier = Modifier
.fillMaxWidth()
.background(color = MaterialTheme.colorScheme.background.copy(alpha = 0.9f))
.padding(horizontal = 4.dp, vertical = 4.dp)
.padding(4.dp)
.navigationBarsPadding(),
) {
ActionsPill {
IconButton(onClick = onDismissRequest) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_close),
)
}
}
Spacer(modifier = Modifier.weight(1f))
ActionsPill {
IconButton(onClick = onShareClick) {
Icon(
imageVector = Icons.Outlined.Share,
@ -136,14 +139,15 @@ fun MangaCoverDialog(
}
}
}
}
},
) { contentPadding ->
val statusBarPaddingPx = WindowInsets.systemBars.getTop(LocalDensity.current)
val statusBarPaddingPx = with(LocalDensity.current) { contentPadding.calculateTopPadding().roundToPx() }
val bottomPaddingPx = with(LocalDensity.current) { contentPadding.calculateBottomPadding().roundToPx() }
Box(
modifier = Modifier
.fillMaxSize()
.background(color = MaterialTheme.colorScheme.background)
.clickableNoIndication(onClick = onDismissRequest),
) {
AndroidView(
@ -185,3 +189,14 @@ fun MangaCoverDialog(
}
}
}
@Composable
private fun ActionsPill(content: @Composable () -> Unit) {
Row(
modifier = Modifier
.clip(MaterialTheme.shapes.extraLarge)
.background(MaterialTheme.colorScheme.background.copy(alpha = 0.95f)),
) {
content()
}
}