mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-06-05 21:49:13 +02:00
fix colors and paddings
This commit is contained in:
@@ -6,7 +6,6 @@ import android.os.Bundle
|
|||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -53,7 +52,6 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SettingsScreen(
|
SettingsScreen(
|
||||||
topBarsScrolledContainerColor = Color(getColoredMaterialStatusBarColor().getContrastColor()),
|
|
||||||
preventPhoneFromSleeping = preventPhoneFromSleeping,
|
preventPhoneFromSleeping = preventPhoneFromSleeping,
|
||||||
customizeColors = ::handleCustomizeColorsClick,
|
customizeColors = ::handleCustomizeColorsClick,
|
||||||
goBack = ::finish,
|
goBack = ::finish,
|
||||||
|
@@ -63,6 +63,7 @@ fun SettingsScreen(
|
|||||||
SideEffect {
|
SideEffect {
|
||||||
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = scrolledColor.isNotLitWell())
|
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = scrolledColor.isNotLitWell())
|
||||||
}
|
}
|
||||||
|
val startingPadding = Modifier.padding(horizontal = 4.dp)
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -107,28 +108,34 @@ fun SettingsScreen(
|
|||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
SettingsGroup(title = {
|
SettingsGroup(title = {
|
||||||
SettingsTitleTextComponent(text = stringResource(id = R.string.color_customization))
|
SettingsTitleTextComponent(text = stringResource(id = R.string.color_customization), modifier = startingPadding)
|
||||||
}) {
|
}) {
|
||||||
SettingsPreferenceComponent(
|
SettingsPreferenceComponent(
|
||||||
modifier = Modifier.padding(bottom = 12.dp),
|
modifier = Modifier
|
||||||
|
.padding(bottom = 12.dp, top = 8.dp)
|
||||||
|
.then(startingPadding),
|
||||||
preferenceTitle = stringResource(id = R.string.customize_colors),
|
preferenceTitle = stringResource(id = R.string.customize_colors),
|
||||||
doOnPreferenceClick = customizeColors,
|
doOnPreferenceClick = customizeColors,
|
||||||
isPreferenceEnabled = isOrWasThankYouInstalled,
|
isPreferenceEnabled = isOrWasThankYouInstalled,
|
||||||
preferenceSummary = lockedCustomizeColorText
|
preferenceSummary = lockedCustomizeColorText
|
||||||
)
|
)
|
||||||
SettingsPreferenceComponent(
|
SettingsPreferenceComponent(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(bottom = 12.dp)
|
||||||
|
.then(startingPadding),
|
||||||
preferenceTitle = stringResource(id = R.string.customize_widget_colors),
|
preferenceTitle = stringResource(id = R.string.customize_widget_colors),
|
||||||
doOnPreferenceClick = customizeWidgetColors
|
doOnPreferenceClick = customizeWidgetColors
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Divider(color = divider_grey)
|
Divider(color = divider_grey)
|
||||||
SettingsGroup(title = {
|
SettingsGroup(title = {
|
||||||
SettingsTitleTextComponent(text = stringResource(id = R.string.general_settings))
|
SettingsTitleTextComponent(text = stringResource(id = R.string.general_settings), modifier = startingPadding)
|
||||||
}) {
|
}) {
|
||||||
if (!isOrWasThankYouInstalled) {
|
if (!isOrWasThankYouInstalled) {
|
||||||
SettingsPreferenceComponent(
|
SettingsPreferenceComponent(
|
||||||
preferenceTitle = stringResource(id = R.string.purchase_simple_thank_you),
|
preferenceTitle = stringResource(id = R.string.purchase_simple_thank_you),
|
||||||
doOnPreferenceClick = onThankYou,
|
doOnPreferenceClick = onThankYou,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (isUseEnglishEnabled) {
|
if (isUseEnglishEnabled) {
|
||||||
@@ -136,6 +143,7 @@ fun SettingsScreen(
|
|||||||
title = stringResource(id = R.string.use_english_language),
|
title = stringResource(id = R.string.use_english_language),
|
||||||
initialValue = isUseEnglishChecked,
|
initialValue = isUseEnglishChecked,
|
||||||
onChange = onUseEnglishPress,
|
onChange = onUseEnglishPress,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (isTiramisuPlus()) {
|
if (isTiramisuPlus()) {
|
||||||
@@ -144,22 +152,26 @@ fun SettingsScreen(
|
|||||||
preferenceSummary = displayLanguage,
|
preferenceSummary = displayLanguage,
|
||||||
doOnPreferenceClick = onSetupLanguagePress,
|
doOnPreferenceClick = onSetupLanguagePress,
|
||||||
preferenceSummaryColor = MaterialTheme.colorScheme.onSurface,
|
preferenceSummaryColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
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,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
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,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
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,
|
||||||
|
modifier = startingPadding,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,14 +31,15 @@ fun SettingsPreferenceComponent(
|
|||||||
preferenceSummaryColor: Color = preferenceSummaryColor(isEnabled = isPreferenceEnabled)
|
preferenceSummaryColor: Color = preferenceSummaryColor(isEnabled = isPreferenceEnabled)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
enabled = isPreferenceEnabled,
|
enabled = isPreferenceEnabled,
|
||||||
onClick = { doOnPreferenceClick?.invoke() },
|
onClick = { doOnPreferenceClick?.invoke() },
|
||||||
onLongClick = { doOnPreferenceLongClick?.invoke() },
|
onLongClick = { doOnPreferenceLongClick?.invoke() },
|
||||||
)
|
)
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
.then(modifier),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = preferenceTitle,
|
text = preferenceTitle,
|
||||||
|
Reference in New Issue
Block a user