mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-02-19 21:10:39 +01:00
match paddings from the xml
This commit is contained in:
parent
019e792c6b
commit
ca51b0ec39
@ -10,6 +10,7 @@ import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.lerp
|
||||
@ -61,6 +62,8 @@ fun SettingsScreen(
|
||||
scrolledTextColor,
|
||||
fraction
|
||||
)
|
||||
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier
|
||||
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||
@ -101,7 +104,7 @@ fun SettingsScreen(
|
||||
Column(
|
||||
Modifier
|
||||
.matchParentSize()
|
||||
.verticalScroll(rememberScrollState())
|
||||
.verticalScroll(rememberScrollState()),
|
||||
) {
|
||||
SettingsGroup(title = {
|
||||
SettingsTitleTextComponent(text = stringResource(id = R.string.color_customization))
|
||||
@ -122,13 +125,16 @@ fun SettingsScreen(
|
||||
SettingsTitleTextComponent(text = stringResource(id = R.string.general_settings))
|
||||
}) {
|
||||
if (!isOrWasThankYouInstalled) {
|
||||
SettingsPreferenceComponent(preferenceTitle = stringResource(id = R.string.purchase_simple_thank_you), doOnPreferenceClick = onThankYou)
|
||||
SettingsPreferenceComponent(
|
||||
preferenceTitle = stringResource(id = R.string.purchase_simple_thank_you),
|
||||
doOnPreferenceClick = onThankYou,
|
||||
)
|
||||
}
|
||||
if (isUseEnglishEnabled) {
|
||||
SettingsCheckBoxComponent(
|
||||
title = stringResource(id = R.string.use_english_language),
|
||||
initialValue = isUseEnglishChecked,
|
||||
onChange = onUseEnglishPress
|
||||
onChange = onUseEnglishPress,
|
||||
)
|
||||
}
|
||||
if (isTiramisuPlus()) {
|
||||
@ -136,23 +142,23 @@ fun SettingsScreen(
|
||||
preferenceTitle = stringResource(id = R.string.language),
|
||||
preferenceSummary = displayLanguage,
|
||||
doOnPreferenceClick = onSetupLanguagePress,
|
||||
preferenceSummaryColor = MaterialTheme.colorScheme.onSurface
|
||||
preferenceSummaryColor = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
}
|
||||
SettingsCheckBoxComponent(
|
||||
title = stringResource(id = R.string.vibrate_on_button_press),
|
||||
initialValue = vibrateOnButtonPressFlow,
|
||||
onChange = onVibrateOnButtonPressFlow
|
||||
onChange = onVibrateOnButtonPressFlow,
|
||||
)
|
||||
SettingsCheckBoxComponent(
|
||||
title = stringResource(id = R.string.prevent_phone_from_sleeping),
|
||||
initialValue = preventPhoneFromSleeping,
|
||||
onChange = onPreventPhoneFromSleeping
|
||||
onChange = onPreventPhoneFromSleeping,
|
||||
)
|
||||
SettingsCheckBoxComponent(
|
||||
title = stringResource(id = com.simplemobiletools.calculator.R.string.use_comma_as_decimal_mark),
|
||||
initialValue = useCommaAsDecimalMarkFlow,
|
||||
onChange = onUseCommaAsDecimalMarkFlow
|
||||
onChange = onUseCommaAsDecimalMarkFlow,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ fun SettingsCheckBoxComponent(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = { onChange?.invoke(!initialValue) })
|
||||
.padding(vertical = 14.dp, horizontal = 16.dp),
|
||||
.padding(16.dp),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.weight(1f),
|
||||
@ -48,7 +48,6 @@ fun SettingsCheckBoxComponent(
|
||||
text = summary.toString(),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp)
|
||||
.padding(end = 16.dp),
|
||||
color = preferenceSummaryColor(isEnabled = isPreferenceEnabled),
|
||||
)
|
||||
|
@ -17,24 +17,25 @@ fun SettingsGroup(
|
||||
title: @Composable (() -> Unit)? = null,
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
Surface {
|
||||
Column(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
) {
|
||||
if (title != null) {
|
||||
SettingsGroupTitle(title)
|
||||
}
|
||||
content()
|
||||
|
||||
Column(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
) {
|
||||
if (title != null) {
|
||||
SettingsGroupTitle(title = title)
|
||||
}
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SettingsGroupTitle(title: @Composable () -> Unit) {
|
||||
fun SettingsGroupTitle(
|
||||
modifier: Modifier = Modifier,
|
||||
title: @Composable () -> Unit
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.height(64.dp)
|
||||
.padding(horizontal = 16.dp),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
|
@ -36,7 +36,7 @@ fun SettingsPreferenceComponent(
|
||||
onClick = { doOnPreferenceClick?.invoke() },
|
||||
onLongClick = { doOnPreferenceLongClick?.invoke() },
|
||||
)
|
||||
.padding(vertical = 12.dp, horizontal = 16.dp),
|
||||
.padding(16.dp),
|
||||
) {
|
||||
Text(
|
||||
text = preferenceTitle,
|
||||
@ -47,8 +47,7 @@ fun SettingsPreferenceComponent(
|
||||
Text(
|
||||
text = preferenceSummary.toString(),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp),
|
||||
.fillMaxWidth(),
|
||||
color = preferenceSummaryColor.copy(alpha = 0.6f),
|
||||
)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ fun SettingsTitleTextComponent(
|
||||
modifier: Modifier = Modifier,
|
||||
text: String,
|
||||
) {
|
||||
Box(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||
Box(modifier = Modifier.padding(top = 24.dp, bottom = 8.dp)) {
|
||||
Text(
|
||||
text = text.uppercase(),
|
||||
modifier = modifier,
|
||||
|
Loading…
x
Reference in New Issue
Block a user