mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 08:47:49 +01:00
Constrain reader sheet to max 75% of height
This commit is contained in:
parent
22c6dbda3f
commit
a3a3f44056
4 changed files with 41 additions and 28 deletions
|
@ -6,6 +6,7 @@ import androidx.compose.animation.fadeIn
|
|||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
|
@ -70,6 +71,7 @@ fun NavigatorAdaptiveSheet(
|
|||
*/
|
||||
@Composable
|
||||
fun AdaptiveSheet(
|
||||
modifier: Modifier = Modifier,
|
||||
tonalElevation: Dp = 1.dp,
|
||||
enableSwipeDismiss: Boolean = true,
|
||||
onDismissRequest: () -> Unit,
|
||||
|
@ -82,6 +84,7 @@ fun AdaptiveSheet(
|
|||
properties = dialogProperties,
|
||||
) {
|
||||
AdaptiveSheetImpl(
|
||||
modifier = modifier,
|
||||
isTabletUi = isTabletUi,
|
||||
tonalElevation = tonalElevation,
|
||||
enableSwipeDismiss = enableSwipeDismiss,
|
||||
|
|
|
@ -40,6 +40,7 @@ object TabbedDialogPaddings {
|
|||
|
||||
@Composable
|
||||
fun TabbedDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
onDismissRequest: () -> Unit,
|
||||
tabTitles: List<String>,
|
||||
tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null,
|
||||
|
@ -47,6 +48,7 @@ fun TabbedDialog(
|
|||
content: @Composable (Int) -> Unit,
|
||||
) {
|
||||
AdaptiveSheet(
|
||||
modifier = modifier,
|
||||
onDismissRequest = onDismissRequest,
|
||||
) {
|
||||
val scope = rememberCoroutineScope()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.kanade.presentation.reader.settings
|
||||
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
|
@ -30,7 +32,9 @@ fun ReaderSettingsDialog(
|
|||
)
|
||||
val pagerState = rememberPagerState { tabTitles.size }
|
||||
|
||||
BoxWithConstraints {
|
||||
TabbedDialog(
|
||||
modifier = Modifier.heightIn(max = maxHeight * 0.75f),
|
||||
onDismissRequest = {
|
||||
onDismissRequest()
|
||||
onShowMenus()
|
||||
|
@ -62,4 +66,5 @@ fun ReaderSettingsDialog(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ private val sheetAnimationSpec = tween<Float>(durationMillis = 350)
|
|||
|
||||
@Composable
|
||||
fun AdaptiveSheet(
|
||||
modifier: Modifier = Modifier,
|
||||
isTabletUi: Boolean,
|
||||
tonalElevation: Dp,
|
||||
enableSwipeDismiss: Boolean,
|
||||
|
@ -97,7 +98,8 @@ fun AdaptiveSheet(
|
|||
onClick = {},
|
||||
)
|
||||
.systemBarsPadding()
|
||||
.padding(vertical = 16.dp),
|
||||
.padding(vertical = 16.dp)
|
||||
.then(modifier),
|
||||
shape = MaterialTheme.shapes.extraLarge,
|
||||
tonalElevation = tonalElevation,
|
||||
content = {
|
||||
|
@ -160,6 +162,7 @@ fun AdaptiveSheet(
|
|||
Modifier
|
||||
},
|
||||
)
|
||||
.then(modifier)
|
||||
.offset {
|
||||
IntOffset(
|
||||
0,
|
||||
|
|
Loading…
Reference in a new issue