Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center the Exh Utils #978

Merged
merged 3 commits into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 37 additions & 20 deletions app/src/main/java/eu/kanade/presentation/reader/appbars/ExhUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down Expand Up @@ -62,43 +63,59 @@ fun ExhUtils(
modifier
.fillMaxWidth()
.background(backgroundColor),
horizontalAlignment = Alignment.CenterHorizontally
) {
AnimatedVisibility(visible = isVisible) {
Column {
Row(
Modifier
.fillMaxWidth()
.fillMaxWidth(0.9f)
.height(IntrinsicSize.Min),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
Modifier
.fillMaxWidth(0.5f)
.fillMaxHeight()
.padding(5.dp)
.clickable(enabled = isAutoScrollEnabled) { onToggleAutoscroll(!isAutoScroll) },
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(SYMR.strings.eh_autoscroll),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier.padding(start = 24.dp),
)
Switch(
checked = isAutoScroll,
onCheckedChange = null,
enabled = isAutoScrollEnabled,
)
Column(
Modifier.weight(3f),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(SYMR.strings.eh_autoscroll),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier.fillMaxWidth(0.75f),
textAlign = TextAlign.Center
)
}
Column(
Modifier.weight(1f),
horizontalAlignment = Alignment.CenterHorizontally
) {
Switch(
checked = isAutoScroll,
onCheckedChange = null,
enabled = isAutoScrollEnabled
)
}
}
Row(
Modifier.fillMaxWidth(),
Modifier.fillMaxWidth(0.9f).padding(5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Column(Modifier.weight(3f)) {
Column(
Modifier.weight(3f),
horizontalAlignment = Alignment.CenterHorizontally
) {
var autoScrollFrequencyState by remember {
mutableStateOf(autoScrollFrequency)
}
Expand All @@ -116,7 +133,7 @@ fun ExhUtils(
focusedTextColor = MaterialTheme.colorScheme.onSurface,
unfocusedTextColor = MaterialTheme.colorScheme.onSurface,
),
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxWidth(0.75f),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Decimal,
),
Expand All @@ -143,11 +160,11 @@ fun ExhUtils(
}
}
Row(
Modifier.fillMaxWidth(),
Modifier.fillMaxWidth(0.9f),
verticalAlignment = Alignment.CenterVertically,
) {
Row(
Modifier.fillMaxWidth(0.5f),
Modifier.fillMaxWidth(0.5f).padding(5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down Expand Up @@ -175,7 +192,7 @@ fun ExhUtils(
}
}
Row(
Modifier.fillMaxWidth(),
Modifier.fillMaxWidth(0.9f).padding(5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down
Loading