Haptic feedback for slider, #408
This commit is contained in:
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) }
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
<com.google.android.material.slider.Slider
|
||||
<com.hippo.app.HapticSlider
|
||||
android:id="@+id/slider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
|
||||
Reference in new issue
Block a user