[flexiglass] Fixes extraneous haptic feedback in pattern bouncer.
There's a bug where we vibrate when we first open the bouncer UI in the pattern configuration and when we stop dragging. This CL fixes that. Bug: 281871687 Test: manually verified that, after the fix, we only get haptic feedback when selecting a new dot and not when we first bring up the UI nor when we stop dragging. Change-Id: I808698e74a3d9300c11b7422fc70dfdfc5fea80b
This commit is contained in:
@@ -100,10 +100,14 @@ internal fun PatternBouncer(
|
|||||||
|
|
||||||
// When the current dot is changed, we need to update our animations.
|
// When the current dot is changed, we need to update our animations.
|
||||||
LaunchedEffect(currentDot, isAnimationEnabled) {
|
LaunchedEffect(currentDot, isAnimationEnabled) {
|
||||||
|
// Perform haptic feedback, but only if the current dot is not null, so we don't perform it
|
||||||
|
// when the UI first shows up or when the user lifts their pointer/finger.
|
||||||
|
if (currentDot != null) {
|
||||||
view.performHapticFeedback(
|
view.performHapticFeedback(
|
||||||
HapticFeedbackConstants.VIRTUAL_KEY,
|
HapticFeedbackConstants.VIRTUAL_KEY,
|
||||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,
|
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAnimationEnabled) {
|
if (!isAnimationEnabled) {
|
||||||
return@LaunchedEffect
|
return@LaunchedEffect
|
||||||
|
|||||||
Reference in New Issue
Block a user