mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-26 03:14:36 +00:00
Appearance: fix Transparency truncation and SettingsActionItem horizontal padding
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) <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
+5
-3
@@ -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(
|
||||
|
||||
+3
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user