From 753b366b08c2aa97329a28b317f786eb916ffc3a Mon Sep 17 00:00:00 2001 From: another-simple-pixel Date: Sat, 16 May 2026 09:09:18 -0700 Subject: [PATCH] Appearance: fix Transparency truncation and SettingsActionItem horizontal padding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two layout regressions from earlier facelift commits where slider/item math assumed DEFAULT_PADDING (20dp) for inner card padding, but the facelift uses CARD_PADDING (16dp outer) + CARD_ITEM_PADDING (15dp inner) = 31dp per side instead of 20dp. - Slider widthIn calc in AppToolbarsSection and MessageShapeSection used (maxWidth - DEFAULT_PADDING * 2) so the slider was ~22dp wider than it should be, shrinking the label Box (weight 1f) and clipping "Transparency" to "Transparenc". Switched to (CARD_PADDING + CARD_ITEM_PADDING) * 2. - SettingsActionItemWithContent explicitly passed PaddingValues(horizontal = DEFAULT_PADDING) to its SectionItemView, overriding the new CARD_ITEM_PADDING default. That made any row using SettingsPreferenceItem/SettingsActionItem sit 5dp further inset than rows using plain SectionItemViewWithoutMinPadding — visible as a left indent on "Tail" relative to "Corner". Replaced with CARD_ITEM_PADDING so it matches. Removed `private` from CARD_PADDING and CARD_ITEM_PADDING in Section.kt to allow imports from other files (used the same way as SectionView etc. are imported individually). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../kotlin/chat/simplex/common/views/helpers/Section.kt | 4 ++-- .../chat/simplex/common/views/usersettings/Appearance.kt | 8 +++++--- .../simplex/common/views/usersettings/SettingsView.kt | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt index f4843da3ae..02b3b1f707 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt @@ -28,8 +28,8 @@ import chat.simplex.common.views.usersettings.SettingsActionItemWithContent import chat.simplex.res.MR private val SectionCardShape = RoundedCornerShape(16.dp) -private val CARD_PADDING = 16.dp -private val CARD_ITEM_PADDING = CARD_PADDING - 1.dp +val CARD_PADDING = 16.dp +val CARD_ITEM_PADDING = CARD_PADDING - 1.dp // Set to true by SectionView around its inner Column. SectionItemView reads it // to decide whether to draw the 2dp bottom divider. False default keeps diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/Appearance.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/Appearance.kt index abee2c9e42..833de5fc7e 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/Appearance.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/Appearance.kt @@ -1,5 +1,7 @@ package chat.simplex.common.views.usersettings +import CARD_ITEM_PADDING +import CARD_PADDING import SectionBottomSpacer import SectionDivider import SectionDividerSpaced @@ -113,7 +115,7 @@ object AppearanceScope { val diff = it % 0.025f appPrefs.inAppBarsAlpha.set(1f - (String.format(Locale.US, "%.3f", it + (if (diff >= 0.0125f) -diff + 0.025f else -diff)).toFloatOrNull() ?: 1f)) }, - Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - DEFAULT_PADDING * 2) * 0.618f), + Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - (CARD_PADDING + CARD_ITEM_PADDING) * 2) * 0.618f), valueRange = 0f..0.5f, steps = 21, colors = SliderDefaults.colors( @@ -159,7 +161,7 @@ object AppearanceScope { val diff = it % 0.05f saveBlur(((String.format(Locale.US, "%.2f", it + (if (diff >= 0.025f) -diff + 0.05f else -diff)).toFloatOrNull() ?: 1f) * 100).toInt()) }, - Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - DEFAULT_PADDING * 2) * 0.618f), + Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - (CARD_PADDING + CARD_ITEM_PADDING) * 2) * 0.618f), valueRange = 0f..1f, steps = 21, colors = SliderDefaults.colors( @@ -187,7 +189,7 @@ object AppearanceScope { appPreferences.chatItemRoundness.set(it + (if (diff >= 0.025f) -diff + 0.05f else -diff)) saveThemeToDatabase(null) }, - Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - DEFAULT_PADDING * 2) * 0.618f), + Modifier.widthIn(max = (this@BoxWithConstraints.maxWidth - (CARD_PADDING + CARD_ITEM_PADDING) * 2) * 0.618f), valueRange = 0f..1f, steps = 20, colors = SliderDefaults.colors( diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/SettingsView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/SettingsView.kt index a02d67265d..a27f607e6a 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/SettingsView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/SettingsView.kt @@ -1,5 +1,6 @@ package chat.simplex.common.views.usersettings +import CARD_ITEM_PADDING import SectionBottomSpacer import SectionDividerSpaced import SectionItemView @@ -348,9 +349,9 @@ fun SettingsActionItemWithContent(icon: Painter?, text: String? = null, click: ( click, extraPadding = extraPadding, padding = if (extraPadding && icon != null) - PaddingValues(start = DEFAULT_PADDING * 1.7f, end = DEFAULT_PADDING) + PaddingValues(start = DEFAULT_PADDING * 1.7f, end = CARD_ITEM_PADDING) else - PaddingValues(horizontal = DEFAULT_PADDING), + PaddingValues(horizontal = CARD_ITEM_PADDING), disabled = disabled ) { if (icon != null) {