From a29fc4ce945bbd803e67d0ef52711b078875b71d Mon Sep 17 00:00:00 2001 From: tarsin Date: Mon, 5 Jun 2023 00:10:30 +0800 Subject: [PATCH] Fix SliderPref enable status --- .../ehviewer/ui/settings/PreferenceTokens.kt | 3 --- .../jamal/composeprefs3/ui/prefs/SliderPref.kt | 17 +---------------- .../jamal/composeprefs3/ui/prefs/SwitchPref.kt | 13 ------------- .../jamal/composeprefs3/ui/prefs/TextPref.kt | 16 ---------------- 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/settings/PreferenceTokens.kt b/app/src/main/java/com/hippo/ehviewer/ui/settings/PreferenceTokens.kt index e4a263f21..bbdd7ca98 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/settings/PreferenceTokens.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/settings/PreferenceTokens.kt @@ -7,7 +7,4 @@ object PreferenceTokens { val PreferenceIconSize = 24.dp val PreferenceIconPadding = 16.dp val PreferenceTextPadding = 8.dp - - val PreferenceMinHeight = 56.dp - val PreferencePadding = 16.dp } diff --git a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SliderPref.kt b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SliderPref.kt index 4bba04294..985f58cfe 100644 --- a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SliderPref.kt +++ b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SliderPref.kt @@ -19,22 +19,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.jamal.composeprefs3.ui.roundToDP -/** - * Preference which shows a slider just below the [title] - * - * @param key Key used to identify this Pref in the DataStore - * @param title Main text which describes the Pref - * @param modifier Modifier applied to the Text aspect of this Pref - * @param defaultValue Default value of the slider. Used if this key is not found in the DataStore - * @param onValueChangeFinished Same as onValueChangeFinished parameter in [Slider] - * @param valueRange Same as valueRange parameter in [Slider] - * @param showValue If the current slider value should be shown on the side of the slider. - * @param enabled If false, this slider cannot be interacted with. - * @param steps Same as steps parameter in [Slider] - * @param textColor Text colour of the [title] and shown value if [showValue] is true. - * @param enabled If [enabled] is not true, this Pref cannot be checked/unchecked - * @param leadingIcon Icon which is positioned at the start of the Pref - */ @Composable fun SliderPref( title: String, @@ -58,6 +42,7 @@ fun SliderPref( textColor = textColor, minimalHeight = true, leadingIcon = leadingIcon, + enabled = enabled, ) Row( modifier = Modifier.fillMaxWidth(), diff --git a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SwitchPref.kt b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SwitchPref.kt index de60ff74d..8b7a755c7 100644 --- a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SwitchPref.kt +++ b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/SwitchPref.kt @@ -6,19 +6,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -/** - * Simple preference with a trailing [Switch] - * - * @param key Key used to identify this Pref in the DataStore - * @param title Main text which describes the Pref - * @param modifier Modifier applied to the Text aspect of this Pref - * @param summary Used to give some more information about what this Pref is for - * @param defaultChecked If the switch should be checked by default. Only used if a value for this [key] doesn't already exist in the DataStore - * @param onCheckedChange Will be called with the new state when the state changes - * @param textColor Text colour of the [title] and [summary] - * @param enabled If false, this Pref cannot be checked/unchecked - * @param leadingIcon Icon which is positioned at the start of the Pref - */ @Composable fun SwitchPref( checked: Boolean, diff --git a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/TextPref.kt b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/TextPref.kt index 0f1d11e83..b0209fbb9 100644 --- a/app/src/main/java/com/jamal/composeprefs3/ui/prefs/TextPref.kt +++ b/app/src/main/java/com/jamal/composeprefs3/ui/prefs/TextPref.kt @@ -10,22 +10,6 @@ import androidx.compose.ui.text.AnnotatedString import com.jamal.composeprefs3.ui.PrefsListItem import com.jamal.composeprefs3.ui.ifNotNullThen -/** - * Simple Text with title and summary. - * Used to show some information to the user and is the basis of all other preferences. - * - * @param title Main text which describes the Pref - * @param modifier Modifier applied to the Text aspect of this Pref - * @param summary Used to give some more information about what this Pref is for - * @param darkenOnDisable If true, text colors have lower opacity when the Pref is not [enabled] - * @param minimalHeight If true, the height of the pref is reduced, such that other content can be more easily included in the pref. - * Mostly for internal use with custom Prefs - * @param onClick Callback for when this Pref is clicked. Will not be called if Pref is not [enabled] - * @param textColor Text colour of the [title] and [summary] - * @param enabled If false, this Pref cannot be checked/unchecked - * @param leadingIcon Icon which is positioned at the start of the Pref - * @param trailingContent Composable content which is positioned at the end of the Pref - */ @Composable fun TextPref( title: String,