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