File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
src/main/java/app/revanced/manager/ui/component/haptics Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,6 @@ android {
131131 debug {
132132 applicationIdSuffix = " .debug"
133133 resValue(" string" , " app_name" , " ReVanced Manager (Debug)" )
134- isPseudoLocalesEnabled = true
135134
136135 buildConfigField(" long" , " BUILD_ID" , " ${Random .nextLong()} L" )
137136 }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import androidx.compose.material3.SwitchDefaults
99import androidx.compose.runtime.Composable
1010import androidx.compose.runtime.remember
1111import androidx.compose.ui.Modifier
12+ import androidx.compose.ui.platform.LocalView
1213
1314@Composable
1415fun HapticSwitch (
@@ -20,16 +21,19 @@ fun HapticSwitch(
2021 colors : SwitchColors = SwitchDefaults .colors(),
2122 interactionSource : MutableInteractionSource = remember { MutableInteractionSource () },
2223) {
24+ val view = LocalView .current
2325 Switch (
2426 checked = checked,
2527 onCheckedChange = { newChecked ->
2628 val useNewConstants = Build .VERSION .SDK_INT >= Build .VERSION_CODES .UPSIDE_DOWN_CAKE
27- when {
29+ val hapticFeedbackType = when {
2830 newChecked && useNewConstants -> HapticFeedbackConstants .TOGGLE_ON
2931 newChecked -> HapticFeedbackConstants .VIRTUAL_KEY
3032 ! newChecked && useNewConstants -> HapticFeedbackConstants .TOGGLE_OFF
3133 ! newChecked -> HapticFeedbackConstants .CLOCK_TICK
34+ else -> {HapticFeedbackConstants .VIRTUAL_KEY }
3235 }
36+ view.performHapticFeedback(hapticFeedbackType)
3337 onCheckedChange(newChecked)
3438 },
3539 modifier = modifier,
You can’t perform that action at this time.
0 commit comments