Skip to content

Commit

Permalink
move settings separator into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
UrAvgCode committed Feb 27, 2025
1 parent 72bce16 commit b0af819
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand All @@ -42,11 +41,11 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.uravgcode.chooser.composables.settings.RestartDialog
import com.uravgcode.chooser.composables.settings.SettingsRowPercentSlider
import com.uravgcode.chooser.composables.settings.SettingsRowSwitch
import com.uravgcode.chooser.composables.settings.SettingsRowTimeSlider
import com.uravgcode.chooser.composables.settings.SettingsSeparator
import com.uravgcode.chooser.utilities.SettingsManager

@Composable
Expand Down Expand Up @@ -99,11 +98,7 @@ fun SettingsScreen(onNavigateBack: () -> Unit) {
.padding(padding)
.padding(16.dp)
) {
Text(
text = "General Settings",
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(vertical = 8.dp)
)
SettingsSeparator("General Settings", false)

SettingsRowSwitch(
title = "Enable Sound",
Expand All @@ -123,12 +118,7 @@ fun SettingsScreen(onNavigateBack: () -> Unit) {
}
)

HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))
Text(
text = "Display Settings",
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(vertical = 8.dp)
)
SettingsSeparator("Display Settings")

SettingsRowSwitch(
title = "Enable Edge-to-Edge",
Expand All @@ -151,12 +141,7 @@ fun SettingsScreen(onNavigateBack: () -> Unit) {
steps = 9
)

HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))
Text(
text = "Circle Lifetimes",
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(vertical = 8.dp)
)
SettingsSeparator("Circle Lifetimes")

SettingsRowTimeSlider(
title = "Circle Lifetime",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2025 UrAvgCode
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @author UrAvgCode
* @description SettingsSeparator separates settings groups with a horizontal divider and a heading.
*/

package com.uravgcode.chooser.composables.settings

import androidx.compose.foundation.layout.padding
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@Composable
fun SettingsSeparator(heading: String, showDivider: Boolean = true) {
if (showDivider) {
HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))
}
Text(
text = heading,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(vertical = 8.dp)
)
}

0 comments on commit b0af819

Please sign in to comment.