Haptic feedback for slider, #408

This commit is contained in:
tarsin committed 2022-11-14 14:09:54 +08:00
1 parent a56d541380
commit 408c142aad
2 files changed
+15 -1

No files matched your search

@@ -0,0 +1,14 @@
package com.hippo.app
import android.content.Context
import android.util.AttributeSet
import android.view.HapticFeedbackConstants
import com.google.android.material.slider.Slider
class HapticSlider @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : Slider(context, attrs) {
init {
addOnChangeListener { _, _, _ -> performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK) }
}
}