use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by DirtyUnicorns.
the class KeyguardAffordanceHelper method setTranslation.
private void setTranslation(float translation, boolean isReset, boolean animateReset) {
translation = rightSwipePossible() ? translation : Math.max(0, translation);
translation = leftSwipePossible() ? translation : Math.min(0, translation);
float absTranslation = Math.abs(translation);
if (translation != mTranslation || isReset) {
KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon;
KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon;
float alpha = absTranslation / getMinTranslationAmount();
// We interpolate the alpha of the other icons to 0
float fadeOutAlpha = 1.0f - alpha;
fadeOutAlpha = Math.max(fadeOutAlpha, 0.0f);
boolean animateIcons = isReset && animateReset;
boolean forceNoCircleAnimation = isReset && !animateReset;
float radius = getRadiusFromTranslation(absTranslation);
boolean slowAnimation = isReset && isBelowFalsingThreshold();
if (!isReset) {
updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(), false, false, false, false);
} else {
updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(), animateIcons, slowAnimation, false, forceNoCircleAnimation);
}
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(), animateIcons, slowAnimation, false, forceNoCircleAnimation);
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(), animateIcons, slowAnimation, false, forceNoCircleAnimation);
mTranslation = translation;
}
}
use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.
the class KeyguardAffordanceHelper method getAnimatorToRadius.
private ValueAnimator getAnimatorToRadius(final boolean right, int radius) {
final KeyguardAffordanceView targetView = right ? mRightIcon : mLeftIcon;
ValueAnimator animator = ValueAnimator.ofFloat(targetView.getCircleRadius(), radius);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float newRadius = (float) animation.getAnimatedValue();
targetView.setCircleRadiusWithoutAnimation(newRadius);
float translation = getTranslationFromRadius(newRadius);
mTranslation = right ? -translation : translation;
updateIconsFromTranslation(targetView);
}
});
return animator;
}
use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.
the class NotificationPanelView method updateUnlockIcon.
private void updateUnlockIcon() {
if (mStatusBar.getBarState() == StatusBarState.KEYGUARD || mStatusBar.getBarState() == StatusBarState.SHADE_LOCKED) {
boolean active = getMaxPanelHeight() - getExpandedHeight() > mUnlockMoveDistance;
KeyguardAffordanceView lockIcon = mKeyguardBottomArea.getLockIcon();
if (active && !mUnlockIconActive && mTracking) {
lockIcon.setImageAlpha(1.0f, true, 150, Interpolators.FAST_OUT_LINEAR_IN, null);
lockIcon.setImageScale(LOCK_ICON_ACTIVE_SCALE, true, 150, Interpolators.FAST_OUT_LINEAR_IN);
} else if (!active && mUnlockIconActive && mTracking) {
lockIcon.setImageAlpha(lockIcon.getRestingAlpha(), true, /* animate */
150, Interpolators.FAST_OUT_LINEAR_IN, null);
lockIcon.setImageScale(1.0f, true, 150, Interpolators.FAST_OUT_LINEAR_IN);
}
mUnlockIconActive = active;
}
}
use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.
the class KeyguardAffordanceHelper method startHintAnimationPhase1.
private void startHintAnimationPhase1(final boolean right, final Runnable onFinishedListener) {
final KeyguardAffordanceView targetView = right ? mRightIcon : mLeftIcon;
ValueAnimator animator = getAnimatorToRadius(right, mHintGrowAmount);
animator.addListener(new AnimatorListenerAdapter() {
private boolean mCancelled;
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
if (mCancelled) {
mSwipeAnimator = null;
mTargetedView = null;
onFinishedListener.run();
} else {
startUnlockHintAnimationPhase2(right, onFinishedListener);
}
}
});
animator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
animator.setDuration(HINT_PHASE1_DURATION);
animator.start();
mSwipeAnimator = animator;
mTargetedView = targetView;
}
use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.
the class KeyguardAffordanceHelper method startFinishingCircleAnimation.
private void startFinishingCircleAnimation(float velocity, Runnable mAnimationEndRunnable, boolean right) {
KeyguardAffordanceView targetView = right ? mRightIcon : mLeftIcon;
targetView.finishAnimation(velocity, mAnimationEndRunnable);
}
Aggregations