Skip to content

Commit 3d5b4ca

Browse files
committed
feat: Polish settings screens UI
1 parent 7bea066 commit 3d5b4ca

17 files changed

Lines changed: 286 additions & 208 deletions

app/src/main/java/app/morphe/manager/ui/screen/SettingsScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ private fun NavigationItem(
298298
selected = isSelected
299299
},
300300
color = containerColor,
301+
contentColor = contentColor,
301302
shape = RoundedCornerShape(24.dp)
302303
) {
303304
Row(
@@ -310,7 +311,6 @@ private fun NavigationItem(
310311
Icon(
311312
imageVector = tab.icon,
312313
contentDescription = tabLabel,
313-
tint = contentColor,
314314
modifier = Modifier.size(24.dp)
315315
)
316316

@@ -324,7 +324,6 @@ private fun NavigationItem(
324324
Text(
325325
text = tabLabel,
326326
style = MaterialTheme.typography.labelLarge,
327-
color = contentColor,
328327
fontWeight = FontWeight.Medium,
329328
maxLines = 1,
330329
overflow = TextOverflow.Ellipsis

app/src/main/java/app/morphe/manager/ui/screen/home/ExpertModeDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,7 @@ private fun BooleanOptionItem(
16441644
title = title,
16451645
subtitle = description.ifBlank { null },
16461646
trailingContent = {
1647-
Switch(
1647+
MorpheSwitch(
16481648
checked = value,
16491649
onCheckedChange = onValueChange,
16501650
modifier = Modifier.semantics {

app/src/main/java/app/morphe/manager/ui/screen/home/SourceManagementSheet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private fun BundleManagementCard(
555555

556556
Spacer(Modifier.width(8.dp))
557557

558-
Switch(
558+
MorpheSwitch(
559559
checked = currentUsePrerelease,
560560
onCheckedChange = onPrereleasesToggle
561561
)
@@ -595,7 +595,7 @@ private fun BundleManagementCard(
595595

596596
Spacer(Modifier.width(8.dp))
597597

598-
Switch(
598+
MorpheSwitch(
599599
checked = useExperimentalVersions,
600600
onCheckedChange = { onExperimentalVersionsToggle?.invoke(it) }
601601
)

app/src/main/java/app/morphe/manager/ui/screen/settings/AdvancedTabContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fun AdvancedTabContent(
106106
title = stringResource(R.string.settings_advanced_expert_mode),
107107
subtitle = stringResource(R.string.settings_advanced_expert_mode_description),
108108
trailingContent = {
109-
Switch(
109+
MorpheSwitch(
110110
checked = useExpertMode,
111111
onCheckedChange = null,
112112
modifier = Modifier.semantics {
@@ -143,7 +143,7 @@ fun AdvancedTabContent(
143143
title = stringResource(R.string.settings_advanced_strip_unused_libs),
144144
subtitle = stringResource(R.string.settings_advanced_strip_unused_libs_description),
145145
trailingContent = {
146-
Switch(
146+
MorpheSwitch(
147147
checked = stripUnusedNativeLibs,
148148
onCheckedChange = null,
149149
modifier = Modifier.semantics {

app/src/main/java/app/morphe/manager/ui/screen/settings/AppearanceTabContent.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import androidx.compose.material.icons.Icons
1616
import androidx.compose.material.icons.outlined.*
1717
import androidx.compose.material3.MaterialTheme
1818
import androidx.compose.material3.Surface
19-
import androidx.compose.material3.Switch
2019
import androidx.compose.material3.Text
2120
import androidx.compose.runtime.*
2221
import androidx.compose.ui.Alignment
@@ -91,7 +90,7 @@ fun AppearanceTabContent(
9190
MorpheIcon(icon = Icons.Outlined.ChatBubbleOutline)
9291
},
9392
trailingContent = {
94-
Switch(
93+
MorpheSwitch(
9594
checked = showGreetingPhrases,
9695
onCheckedChange = null,
9796
modifier = Modifier.semantics {
@@ -127,7 +126,7 @@ fun AppearanceTabContent(
127126
MorpheIcon(icon = Icons.Outlined.Contrast)
128127
},
129128
trailingContent = {
130-
Switch(
129+
MorpheSwitch(
131130
checked = pureBlackTheme,
132131
onCheckedChange = null,
133132
modifier = Modifier.semantics {
@@ -182,7 +181,7 @@ fun AppearanceTabContent(
182181
MorpheIcon(icon = Icons.Outlined.ScreenRotation)
183182
},
184183
trailingContent = {
185-
Switch(
184+
MorpheSwitch(
186185
checked = enableParallax,
187186
onCheckedChange = null,
188187
modifier = Modifier.semantics {

app/src/main/java/app/morphe/manager/ui/screen/settings/SystemTabContent.kt

Lines changed: 12 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ import androidx.compose.material.icons.outlined.*
1818
import androidx.compose.material3.ExperimentalMaterial3Api
1919
import androidx.compose.material3.Icon
2020
import androidx.compose.material3.MaterialTheme
21-
import androidx.compose.material3.Text
2221
import androidx.compose.runtime.*
2322
import androidx.compose.ui.Alignment
2423
import androidx.compose.ui.Modifier
2524
import androidx.compose.ui.platform.LocalContext
2625
import androidx.compose.ui.res.painterResource
2726
import androidx.compose.ui.res.stringResource
28-
import androidx.compose.ui.text.font.FontWeight
2927
import androidx.compose.ui.unit.dp
3028
import androidx.core.net.toUri
3129
import androidx.lifecycle.Lifecycle
@@ -169,11 +167,12 @@ fun SystemTabContent(
169167
horizontalArrangement = Arrangement.spacedBy(8.dp),
170168
verticalAlignment = Alignment.CenterVertically
171169
) {
172-
InfoBadge(
173-
text = if (useProcessRuntime) stringResource(R.string.enabled)
174-
else stringResource(R.string.disabled),
175-
style = if (useProcessRuntime) InfoBadgeStyle.Primary else InfoBadgeStyle.Default,
176-
isCompact = true
170+
StatusCircleIcon(
171+
icon = Icons.Outlined.Check,
172+
containerColor = if (useProcessRuntime) MaterialTheme.colorScheme.primaryContainer
173+
else MaterialTheme.colorScheme.surfaceVariant,
174+
contentColor = if (useProcessRuntime) MaterialTheme.colorScheme.onPrimaryContainer
175+
else MaterialTheme.colorScheme.onSurfaceVariant
177176
)
178177
MorpheIcon(icon = Icons.Outlined.ChevronRight)
179178
}
@@ -222,13 +221,12 @@ fun SystemTabContent(
222221
horizontalArrangement = Arrangement.spacedBy(8.dp),
223222
verticalAlignment = Alignment.CenterVertically
224223
) {
225-
InfoBadge(
226-
text = if (isIgnoringBatteryOptimizations)
227-
stringResource(R.string.settings_system_battery_optimization_excluded)
228-
else
229-
stringResource(R.string.settings_system_battery_optimization_not_excluded),
230-
style = if (isIgnoringBatteryOptimizations) InfoBadgeStyle.Primary else InfoBadgeStyle.Warning,
231-
isCompact = true
224+
StatusCircleIcon(
225+
icon = if (isIgnoringBatteryOptimizations) Icons.Outlined.Check else Icons.Outlined.Warning,
226+
containerColor = if (isIgnoringBatteryOptimizations) MaterialTheme.colorScheme.primaryContainer
227+
else MaterialTheme.colorScheme.secondaryContainer,
228+
contentColor = if (isIgnoringBatteryOptimizations) MaterialTheme.colorScheme.onPrimaryContainer
229+
else MaterialTheme.colorScheme.onSecondaryContainer
232230
)
233231
MorpheIcon(icon = Icons.Outlined.ChevronRight)
234232
}
@@ -399,73 +397,6 @@ fun SystemTabContent(
399397
}
400398
}
401399

402-
/**
403-
* A settings row with a title, optional description, and import/export action buttons.
404-
*/
405-
@Composable
406-
private fun ImportExportRow(
407-
leadingContent: @Composable () -> Unit,
408-
title: String,
409-
description: String? = null,
410-
onImport: (() -> Unit)?,
411-
onExport: (() -> Unit)?
412-
) {
413-
val hasBoth = onImport != null && onExport != null
414-
Column(
415-
modifier = Modifier
416-
.fillMaxWidth()
417-
.padding(horizontal = 16.dp, vertical = 12.dp),
418-
verticalArrangement = Arrangement.spacedBy(10.dp)
419-
) {
420-
Row(
421-
horizontalArrangement = Arrangement.spacedBy(12.dp),
422-
verticalAlignment = Alignment.CenterVertically
423-
) {
424-
leadingContent()
425-
Column(modifier = Modifier.weight(1f)) {
426-
Text(
427-
text = title,
428-
style = MaterialTheme.typography.bodyMedium,
429-
fontWeight = FontWeight.Medium,
430-
color = MaterialTheme.colorScheme.onSurface
431-
)
432-
if (description != null) {
433-
Text(
434-
text = description,
435-
style = MaterialTheme.typography.bodySmall,
436-
color = MaterialTheme.colorScheme.onSurfaceVariant
437-
)
438-
}
439-
}
440-
}
441-
Row(
442-
modifier = Modifier.fillMaxWidth(),
443-
horizontalArrangement = if (hasBoth) Arrangement.spacedBy(8.dp) else Arrangement.Center
444-
) {
445-
if (onImport != null) {
446-
ActionPillButton(
447-
onClick = onImport,
448-
icon = Icons.Outlined.Download,
449-
contentDescription = stringResource(R.string.import_),
450-
modifier = if (hasBoth) Modifier.weight(1f) else Modifier.fillMaxWidth(0.5f),
451-
large = true,
452-
label = stringResource(R.string.import_)
453-
)
454-
}
455-
if (onExport != null) {
456-
ActionPillButton(
457-
onClick = onExport,
458-
icon = Icons.Outlined.Upload,
459-
contentDescription = stringResource(R.string.export),
460-
modifier = if (hasBoth) Modifier.weight(1f) else Modifier.fillMaxWidth(0.5f),
461-
large = true,
462-
label = stringResource(R.string.export)
463-
)
464-
}
465-
}
466-
}
467-
}
468-
469400
/** Maps a [BytecodeMode] to its short display label string resource. */
470401
private fun BytecodeMode.labelRes(): Int = when (this) {
471402
BytecodeMode.FULL -> R.string.settings_advanced_bytecode_mode_full

app/src/main/java/app/morphe/manager/ui/screen/settings/advanced/GitHubPatSection.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import androidx.compose.material.icons.Icons
1313
import androidx.compose.material.icons.outlined.*
1414
import androidx.compose.material3.Icon
1515
import androidx.compose.material3.MaterialTheme
16-
import androidx.compose.material3.Switch
1716
import androidx.compose.material3.Text
1817
import androidx.compose.runtime.*
1918
import androidx.compose.runtime.saveable.rememberSaveable
@@ -54,11 +53,12 @@ fun GitHubPatSettingsItem(
5453
horizontalArrangement = Arrangement.spacedBy(8.dp),
5554
verticalAlignment = Alignment.CenterVertically
5655
) {
57-
InfoBadge(
58-
text = if (hasPat) stringResource(R.string.enabled)
59-
else stringResource(R.string.disabled),
60-
style = if (hasPat) InfoBadgeStyle.Primary else InfoBadgeStyle.Default,
61-
isCompact = true
56+
StatusCircleIcon(
57+
icon = Icons.Outlined.Check,
58+
containerColor = if (hasPat) MaterialTheme.colorScheme.primaryContainer
59+
else MaterialTheme.colorScheme.surfaceVariant,
60+
contentColor = if (hasPat) MaterialTheme.colorScheme.onPrimaryContainer
61+
else MaterialTheme.colorScheme.onSurfaceVariant
6262
)
6363
MorpheIcon(icon = Icons.Outlined.ChevronRight)
6464
}
@@ -167,7 +167,7 @@ private fun GitHubPatDialog(
167167
title = stringResource(R.string.settings_advanced_github_pat_export_include_label),
168168
subtitle = stringResource(R.string.settings_advanced_github_pat_export_include_supporting),
169169
trailingContent = {
170-
Switch(
170+
MorpheSwitch(
171171
checked = includePatInExport,
172172
onCheckedChange = null
173173
)

app/src/main/java/app/morphe/manager/ui/screen/settings/advanced/PatchOptionsSection.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private fun HideShortsSection(
386386
title = title,
387387
subtitle = description,
388388
trailingContent = {
389-
Switch(
389+
MorpheSwitch(
390390
checked = hideShortsAppShortcut,
391391
onCheckedChange = null,
392392
modifier = Modifier.semantics {
@@ -420,7 +420,7 @@ private fun HideShortsSection(
420420
title = title,
421421
subtitle = description,
422422
trailingContent = {
423-
Switch(
423+
MorpheSwitch(
424424
checked = hideShortsWidget,
425425
onCheckedChange = null,
426426
modifier = Modifier.semantics {

app/src/main/java/app/morphe/manager/ui/screen/settings/advanced/UpdatesSection.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import androidx.compose.foundation.layout.*
1414
import androidx.compose.foundation.shape.RoundedCornerShape
1515
import androidx.compose.material.icons.Icons
1616
import androidx.compose.material.icons.outlined.*
17-
import androidx.compose.material3.*
17+
import androidx.compose.material3.MaterialTheme
18+
import androidx.compose.material3.Slider
19+
import androidx.compose.material3.Surface
20+
import androidx.compose.material3.Text
1821
import androidx.compose.runtime.*
1922
import androidx.compose.ui.Alignment
2023
import androidx.compose.ui.Modifier
@@ -96,7 +99,7 @@ fun UpdatesSettingsItem(
9699
title = stringResource(R.string.settings_advanced_updates_use_prereleases),
97100
subtitle = stringResource(R.string.settings_advanced_updates_use_prereleases_description),
98101
trailingContent = {
99-
Switch(
102+
MorpheSwitch(
100103
checked = useManagerPrereleases,
101104
onCheckedChange = null,
102105
modifier = Modifier.semantics {
@@ -127,7 +130,7 @@ fun UpdatesSettingsItem(
127130
R.string.settings_advanced_updates_background_notifications_description
128131
),
129132
trailingContent = {
130-
Switch(
133+
MorpheSwitch(
131134
checked = backgroundUpdateNotifications,
132135
onCheckedChange = null,
133136
modifier = Modifier.semantics {
@@ -161,7 +164,7 @@ fun UpdatesSettingsItem(
161164
title = stringResource(R.string.settings_advanced_updates_allow_metered),
162165
subtitle = stringResource(R.string.settings_advanced_updates_allow_metered_description),
163166
trailingContent = {
164-
Switch(
167+
MorpheSwitch(
165168
checked = allowMeteredUpdates,
166169
onCheckedChange = null,
167170
modifier = Modifier.semantics {

app/src/main/java/app/morphe/manager/ui/screen/settings/system/BytecodeModeDialog.kt

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
package app.morphe.manager.ui.screen.settings.system
77

8-
import androidx.compose.foundation.layout.*
8+
import androidx.compose.foundation.layout.Arrangement
9+
import androidx.compose.foundation.layout.Column
10+
import androidx.compose.foundation.layout.fillMaxWidth
11+
import androidx.compose.foundation.layout.padding
912
import androidx.compose.material.icons.Icons
10-
import androidx.compose.material.icons.outlined.*
13+
import androidx.compose.material.icons.outlined.Check
1114
import androidx.compose.material3.MaterialTheme
1215
import androidx.compose.material3.Text
1316
import androidx.compose.runtime.Composable
@@ -74,19 +77,26 @@ private fun BytecodeModeOption(
7477
isSelected: Boolean,
7578
onSelect: () -> Unit,
7679
) {
77-
RichSettingsItem(
80+
SettingsItemCard(
7881
onClick = onSelect,
79-
showBorder = true,
80-
leadingContent = {
81-
MorpheIcon(
82-
icon = if (isSelected) Icons.Outlined.RadioButtonChecked
83-
else Icons.Outlined.RadioButtonUnchecked,
84-
tint = if (isSelected) MaterialTheme.colorScheme.primary
85-
else MaterialTheme.colorScheme.onSurfaceVariant,
86-
)
87-
},
88-
trailingContent = null,
89-
title = stringResource(titleRes),
90-
subtitle = stringResource(subtitleRes),
91-
)
82+
borderWidth = 1.dp
83+
) {
84+
IconTextRow(
85+
modifier = Modifier.padding(MorpheDefaults.ContentPadding),
86+
leadingContent = {
87+
if (isSelected) {
88+
StatusCircleIcon(
89+
icon = Icons.Outlined.Check,
90+
containerColor = MaterialTheme.colorScheme.primaryContainer,
91+
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
92+
)
93+
} else {
94+
StatusCirclePlaceholder()
95+
}
96+
},
97+
title = stringResource(titleRes),
98+
description = stringResource(subtitleRes),
99+
trailingContent = null
100+
)
101+
}
92102
}

0 commit comments

Comments
 (0)