Skip to content

Commit

Permalink
Cleanup preferences handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperDragonXD committed Dec 27, 2024
1 parent 6b371f9 commit ddc8641
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import app.lawnchair.lawnicons.BuildConfig

/**
* A class that abstracts the functionality of SharedPreferences
* We use SharedPreferences to avoid the unneccesary complexity Preference DataStore has
* We use SharedPreferences to avoid the unnecessary complexity Preference DataStore has
*
* @param prefs The SharedPreferences instance to use
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
package app.lawnchair.lawnicons.ui.components.home

import android.content.Context
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -70,6 +71,9 @@ fun DebugMenu(
ModalBottomSheet(
onDismissRequest = { prefs.showDebugMenu.set(false) },
sheetState = sheetState,
dragHandle = {
Spacer(Modifier.height(22.dp))
},
) {
SheetContent(
iconInfoCount = iconInfoModel.iconInfo.size,
Expand Down Expand Up @@ -169,16 +173,11 @@ private fun SwitchPref(
endIcon = {
Switch(
checked = pref.asState().value,
onCheckedChange = { pref.set(it) },
onCheckedChange = pref::set,
interactionSource = interactionSource,
)
},
modifier = modifier.clickable(
interactionSource = interactionSource,
indication = null,
enabled = true,
onClickLabel = null,
onClick = {},
),
onClick = pref::toggle,
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun IconRequestFAB(
val prefs = preferenceManager()
val list = iconRequestModel?.list ?: emptyList()
val enabled = iconRequestModel != null
val requestsEnabled = iconRequestsEnabled || prefs.forceEnableIconRequest.get()
val requestsEnabled = iconRequestsEnabled || prefs.forceEnableIconRequest.asState().value

RequestHandler(
enabled = enabled,
Expand Down Expand Up @@ -97,7 +97,7 @@ fun IconRequestIconButton(

val list = iconRequestModel?.list ?: emptyList()
val enabled = iconRequestModel != null
val requestsEnabled = iconRequestsEnabled || prefs.forceEnableIconRequest.get()
val requestsEnabled = iconRequestsEnabled || prefs.forceEnableIconRequest.asState().value

val tooltipState = rememberTooltipState()
val scope = rememberCoroutineScope()
Expand Down

0 comments on commit ddc8641

Please sign in to comment.