Search in sources :

Example 21 with KeyguardAffordanceView

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

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 22 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project platform_frameworks_base by android.

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

Example 23 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project platform_frameworks_base by android.

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 24 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project platform_frameworks_base by android.

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 25 with KeyguardAffordanceView

use of com.android.systemui.statusbar.KeyguardAffordanceView in project platform_frameworks_base by android.

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;
    }
}
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