Skip to content

Commit

Permalink
Cleanup the Settings panel. (#97)
Browse files Browse the repository at this point in the history
* Cleanup the Settings pannel.
  • Loading branch information
HeCodes2Much committed Dec 23, 2022
1 parent 4354aa0 commit fdcf83d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Please delete options that are not relevant.

- [ ] Clean Up (change which doesnt really change much)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/app/mlauncher/style/Dimen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package app.mlauncher.style

import androidx.compose.ui.unit.dp

val CORNER_RADIUS = 2.dp
val CORNER_RADIUS = 2.dp
val BORDER_SIZE = 1.5.dp
val SETTINGS_PADDING = 15.dp
6 changes: 3 additions & 3 deletions app/src/main/java/app/mlauncher/ui/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import app.mlauncher.ui.compose.SettingsComposable.SettingsGestureItem
import app.mlauncher.ui.compose.SettingsComposable.SettingsNumberItem
import app.mlauncher.ui.compose.SettingsComposable.SettingsToggle
import app.mlauncher.ui.compose.SettingsComposable.SettingsTopView
import app.mlauncher.ui.compose.SettingsComposable.SimpleTextButton
import app.mlauncher.ui.compose.SettingsComposable.SettingsTextButton

class SettingsFragment : Fragment() {

Expand Down Expand Up @@ -100,10 +100,10 @@ class SettingsFragment : Fragment() {
stringResource(R.string.app_name),
onClick = { openAppInfo(requireContext(), android.os.Process.myUserHandle(), BuildConfig.APPLICATION_ID) },
) {
SimpleTextButton(stringResource(R.string.hidden_apps) ) {
SettingsTextButton(stringResource(R.string.hidden_apps) ) {
showHiddenApps()
}
SimpleTextButton(stringResource(changeLauncherText) ) {
SettingsTextButton(stringResource(changeLauncherText) ) {
resetDefaultLauncher(requireContext())
}
}
Expand Down
32 changes: 15 additions & 17 deletions app/src/main/java/app/mlauncher/ui/compose/SettingsComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,25 @@ import androidx.constraintlayout.compose.Dimension
import app.mlauncher.R
import app.mlauncher.data.Constants
import app.mlauncher.data.EnumOption
import app.mlauncher.style.CORNER_RADIUS
import app.mlauncher.style.*

object SettingsComposable {

// Most basic settings background tile
@Composable
fun SettingsTile(content: @Composable () -> Unit) {
Column(
modifier = Modifier
.padding(6.dp, 6.dp, 6.dp, 0.dp)
.background(SettingsTheme.color.settings, SettingsTheme.shapes.settings)
.border(
0.5.dp,
SettingsTheme.color.border,
RoundedCornerShape(CORNER_RADIUS),
)
.padding(20.dp)
.fillMaxWidth()
) {
content()
}
fun SettingsTile(content: @Composable () -> Unit) = Column(
modifier = Modifier
.padding(6.dp, 6.dp, 6.dp, 0.dp)
.background(SettingsTheme.color.settings, SettingsTheme.shapes.settings)
.border(
BORDER_SIZE,
SettingsTheme.color.border,
RoundedCornerShape(CORNER_RADIUS),
)
.padding(SETTINGS_PADDING)
.fillMaxWidth()
) {
content()
}

@Composable
Expand Down Expand Up @@ -394,7 +392,7 @@ object SettingsComposable {
}

@Composable
fun SimpleTextButton(title: String, fontSize: TextUnit = TextUnit.Unspecified, onClick: () -> Unit) {
fun SettingsTextButton(title: String, fontSize: TextUnit = TextUnit.Unspecified, onClick: () -> Unit) {
TextButton(
onClick = onClick,
){
Expand Down

0 comments on commit fdcf83d

Please sign in to comment.