Search in sources :

Example 11 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by AOSPA.

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;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) KeyguardAffordanceView(com.android.systemui.statusbar.KeyguardAffordanceView) ValueAnimator(android.animation.ValueAnimator)

Example 12 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by AOSPA.

the class KeyguardAffordanceHelper method updateIconsFromTranslation.

private void updateIconsFromTranslation(KeyguardAffordanceView targetView) {
    float absTranslation = Math.abs(mTranslation);
    float alpha = absTranslation / getMinTranslationAmount();
    // We interpolate the alpha of the other icons to 0
    float fadeOutAlpha = 1.0f - alpha;
    fadeOutAlpha = Math.max(0.0f, fadeOutAlpha);
    // We interpolate the alpha of the targetView to 1
    KeyguardAffordanceView otherView = targetView == mRightIcon ? mLeftIcon : mRightIcon;
    updateIconAlpha(targetView, alpha + fadeOutAlpha * targetView.getRestingAlpha(), false);
    updateIconAlpha(otherView, fadeOutAlpha * otherView.getRestingAlpha(), false);
    updateIconAlpha(mCenterIcon, fadeOutAlpha * mCenterIcon.getRestingAlpha(), false);
}
Also used : KeyguardAffordanceView(com.android.systemui.statusbar.KeyguardAffordanceView)

Example 13 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.

the class KeyguardAffordanceHelper method updateIconsFromTranslation.

private void updateIconsFromTranslation(KeyguardAffordanceView targetView) {
    float absTranslation = Math.abs(mTranslation);
    float alpha = absTranslation / getMinTranslationAmount();
    // We interpolate the alpha of the other icons to 0
    float fadeOutAlpha = 1.0f - alpha;
    fadeOutAlpha = Math.max(0.0f, fadeOutAlpha);
    // We interpolate the alpha of the targetView to 1
    KeyguardAffordanceView otherView = targetView == mRightIcon ? mLeftIcon : mRightIcon;
    updateIconAlpha(targetView, alpha + fadeOutAlpha * targetView.getRestingAlpha(), false);
    updateIconAlpha(otherView, fadeOutAlpha * otherView.getRestingAlpha(), false);
    updateIconAlpha(mCenterIcon, fadeOutAlpha * mCenterIcon.getRestingAlpha(), false);
}
Also used : KeyguardAffordanceView(com.android.systemui.statusbar.KeyguardAffordanceView)

Example 14 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.

the class KeyguardAffordanceHelper method launchAffordance.

public void launchAffordance(boolean animate, boolean left) {
    if (mSwipingInProgress) {
        // We don't want to mess with the state if the user is actually swiping already.
        return;
    }
    KeyguardAffordanceView targetView = left ? mLeftIcon : mRightIcon;
    KeyguardAffordanceView otherView = left ? mRightIcon : mLeftIcon;
    startSwiping(targetView);
    if (animate) {
        fling(0, false, !left);
        updateIcon(otherView, 0.0f, 0, true, false, true, false);
        updateIcon(mCenterIcon, 0.0f, 0, true, false, true, false);
    } else {
        mCallback.onAnimationToSideStarted(!left, mTranslation, 0);
        mTranslation = left ? mCallback.getMaxTranslationDistance() : mCallback.getMaxTranslationDistance();
        updateIcon(mCenterIcon, 0.0f, 0.0f, false, false, true, false);
        updateIcon(otherView, 0.0f, 0.0f, false, false, true, false);
        targetView.instantFinishAnimation();
        mFlingEndListener.onAnimationEnd(null);
        mAnimationEndRunnable.run();
    }
}
Also used : KeyguardAffordanceView(com.android.systemui.statusbar.KeyguardAffordanceView)

Example 15 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project android_frameworks_base by crdroidandroid.

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;
    }
}
Also used : KeyguardAffordanceView(com.android.systemui.statusbar.KeyguardAffordanceView)

Aggregations

KeyguardAffordanceView (com.android.systemui.statusbar.KeyguardAffordanceView)40 ValueAnimator (android.animation.ValueAnimator)10 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5