Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +23 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.view.View import android.view.ViewGroup import android.view.ViewPropertyAnimator import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams Loading Loading @@ -393,6 +395,27 @@ object KeyguardBottomAreaViewBinder { falsingManager, ) view.setOnTouchListener(onTouchListener) view.setOnClickListener { messageDisplayer.invoke(R.string.keyguard_affordance_press_too_short) val amplitude = view.context.resources .getDimensionPixelSize(R.dimen.keyguard_affordance_shake_amplitude) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } view.onLongClickListener = OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) } else { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt +3 −37 Original line number Diff line number Diff line Loading @@ -99,41 +99,7 @@ class KeyguardQuickAffordanceOnTouchListener( // When not using a stylus, lifting the finger/pointer will actually cancel // the long-press gesture. Calling cancel after the quick affordance was // already long-press activated is a no-op, so it's safe to call from here. cancel( onAnimationEnd = if (event.eventTime - event.downTime < longPressDurationMs) { Runnable { messageDisplayer.invoke( R.string.keyguard_affordance_press_too_short ) val amplitude = view.context.resources .getDimensionPixelSize( R.dimen.keyguard_affordance_shake_amplitude ) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration .inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator( KeyguardBottomAreaVibrations.ShakeAnimationCycles ) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } } else { null } ) cancel() } false } Loading Loading @@ -168,10 +134,10 @@ class KeyguardQuickAffordanceOnTouchListener( view.setOnClickListener(null) } fun cancel(onAnimationEnd: Runnable? = null) { fun cancel() { longPressAnimator?.cancel() longPressAnimator = null view.animate().scaleX(1f).scaleY(1f).withEndAction(onAnimationEnd) view.animate().scaleX(1f).scaleY(1f) } companion object { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +23 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.Size import android.view.View import android.view.ViewGroup import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams Loading Loading @@ -216,6 +218,27 @@ object KeyguardQuickAffordanceViewBinder { falsingManager, ) view.setOnTouchListener(onTouchListener) view.setOnClickListener { messageDisplayer.invoke(R.string.keyguard_affordance_press_too_short) val amplitude = view.context.resources .getDimensionPixelSize(R.dimen.keyguard_affordance_shake_amplitude) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } view.onLongClickListener = OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) } else { Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +23 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.view.View import android.view.ViewGroup import android.view.ViewPropertyAnimator import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams Loading Loading @@ -393,6 +395,27 @@ object KeyguardBottomAreaViewBinder { falsingManager, ) view.setOnTouchListener(onTouchListener) view.setOnClickListener { messageDisplayer.invoke(R.string.keyguard_affordance_press_too_short) val amplitude = view.context.resources .getDimensionPixelSize(R.dimen.keyguard_affordance_shake_amplitude) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } view.onLongClickListener = OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) } else { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt +3 −37 Original line number Diff line number Diff line Loading @@ -99,41 +99,7 @@ class KeyguardQuickAffordanceOnTouchListener( // When not using a stylus, lifting the finger/pointer will actually cancel // the long-press gesture. Calling cancel after the quick affordance was // already long-press activated is a no-op, so it's safe to call from here. cancel( onAnimationEnd = if (event.eventTime - event.downTime < longPressDurationMs) { Runnable { messageDisplayer.invoke( R.string.keyguard_affordance_press_too_short ) val amplitude = view.context.resources .getDimensionPixelSize( R.dimen.keyguard_affordance_shake_amplitude ) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration .inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator( KeyguardBottomAreaVibrations.ShakeAnimationCycles ) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } } else { null } ) cancel() } false } Loading Loading @@ -168,10 +134,10 @@ class KeyguardQuickAffordanceOnTouchListener( view.setOnClickListener(null) } fun cancel(onAnimationEnd: Runnable? = null) { fun cancel() { longPressAnimator?.cancel() longPressAnimator = null view.animate().scaleX(1f).scaleY(1f).withEndAction(onAnimationEnd) view.animate().scaleX(1f).scaleY(1f) } companion object { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +23 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.Size import android.view.View import android.view.ViewGroup import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams Loading Loading @@ -216,6 +218,27 @@ object KeyguardQuickAffordanceViewBinder { falsingManager, ) view.setOnTouchListener(onTouchListener) view.setOnClickListener { messageDisplayer.invoke(R.string.keyguard_affordance_press_too_short) val amplitude = view.context.resources .getDimensionPixelSize(R.dimen.keyguard_affordance_shake_amplitude) .toFloat() val shakeAnimator = ObjectAnimator.ofFloat( view, "translationX", -amplitude / 2, amplitude / 2, ) shakeAnimator.duration = KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) } view.onLongClickListener = OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) } else { Loading