Controls UI - Haptics updates
Make on/off ticks longer and more pronounced Bug: 154697212 Test: pixel 4, haptics Change-Id: I36d48b2e88a471f9347f3f5dbd81780977480158
This commit is contained in:
@@ -58,7 +58,7 @@ class ControlActionCoordinatorImpl @Inject constructor(
|
||||
|
||||
override fun toggle(cvh: ControlViewHolder, templateId: String, isChecked: Boolean) {
|
||||
bouncerOrRun {
|
||||
val effect = if (isChecked) Vibrations.toggleOnEffect else Vibrations.toggleOffEffect
|
||||
val effect = if (!isChecked) Vibrations.toggleOnEffect else Vibrations.toggleOffEffect
|
||||
vibrate(effect)
|
||||
cvh.action(BooleanAction(templateId, !isChecked))
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.os.VibrationEffect
|
||||
import android.os.VibrationEffect.Composition.PRIMITIVE_TICK
|
||||
|
||||
object Vibrations {
|
||||
private const val TOGGLE_TICK_COUNT = 12
|
||||
private const val TOGGLE_TICK_COUNT = 40
|
||||
|
||||
val toggleOnEffect = initToggleOnEffect()
|
||||
val toggleOffEffect = initToggleOffEffect()
|
||||
@@ -29,6 +29,7 @@ object Vibrations {
|
||||
|
||||
private fun initToggleOnEffect(): VibrationEffect {
|
||||
val composition = VibrationEffect.startComposition()
|
||||
composition.addPrimitive(PRIMITIVE_TICK, 0.05f, 200)
|
||||
var i = 0
|
||||
while (i++ < TOGGLE_TICK_COUNT) {
|
||||
composition.addPrimitive(PRIMITIVE_TICK, 0.05f, 0)
|
||||
@@ -43,7 +44,7 @@ object Vibrations {
|
||||
composition.addPrimitive(PRIMITIVE_TICK, 0.05f, 100)
|
||||
var i = 0
|
||||
while (i++ < TOGGLE_TICK_COUNT) {
|
||||
composition?.addPrimitive(PRIMITIVE_TICK, 0.05f, 0)
|
||||
composition.addPrimitive(PRIMITIVE_TICK, 0.05f, 0)
|
||||
}
|
||||
return composition.compose()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user