Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81af21e6 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "hide the correct text, and more text, on bounce" into jb-mr1-lockscreen-dev

parents a96cd636 052999f3
Loading
Loading
Loading
Loading
+30 −4
Original line number Diff line number Diff line
package com.android.internal.policy.impl.keyguard;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

import com.android.internal.R;
@@ -51,18 +53,42 @@ public class KeyguardSecurityContainer extends FrameLayout {
    }

    public void showBouncer(int duration) {
        SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this);
        SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView());
        message.showBouncer(duration);
        Animator anim = ObjectAnimator.ofFloat(this, "BackgroundAlpha", 1f);
        AnimatorSet anim = new AnimatorSet();
        anim.playTogether(ObjectAnimator.ofFloat(this, "backgroundAlpha", 1f), getEcaAnim(0f));
        anim.setDuration(duration);
        anim.start();
    }

    public void hideBouncer(int duration) {
        SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this);
        SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView());
        message.hideBouncer(duration);
        Animator anim = ObjectAnimator.ofFloat(this, "BackgroundAlpha", 0f);
        AnimatorSet anim = new AnimatorSet();
        anim.playTogether(ObjectAnimator.ofFloat(this, "backgroundAlpha", 0f), getEcaAnim(1f));
        anim.setDuration(duration);
        anim.start();
    }

    View getSecurityView() {
        for (int i = 0; i < getChildCount(); i++) {
            View child = getChildAt(i);
            if (child instanceof KeyguardSecurityViewFlipper) {
                return (View) (((KeyguardSecurityViewFlipper) child).getSecurityView());
            }
        }
        return null;
    }

    Animator getEcaAnim(float alpha) {
        Animator anim = null;
        View securityView = getSecurityView();
        if (securityView != null) {
            View ecaView = securityView.findViewById(R.id.keyguard_selector_fade_container);
            if (ecaView != null) {
                anim = ObjectAnimator.ofFloat(ecaView, "alpha", alpha);
            }
        }
        return anim;
    }
}
+12 −3
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout

    // Initialized during measurement from child layoutparams
    private View mExpandChallengeView;
    private View mChallengeView;
    private KeyguardSecurityContainer mChallengeView;
    private View mScrimView;
    private View mWidgetsView;

@@ -511,7 +511,9 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
        if (mScrimView != null) {
            mScrimView.setVisibility(VISIBLE);
        }

        if (mChallengeView != null) {
            mChallengeView.showBouncer(HANDLE_ANIMATE_DURATION);
        }
        // Mess with padding/margin to inset the bouncer frame.
        // We have more space available to us otherwise.
        if (mChallengeView != null) {
@@ -540,6 +542,9 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
        if (mScrimView != null) {
            mScrimView.setVisibility(GONE);
        }
        if (mChallengeView != null) {
            mChallengeView.hideBouncer(HANDLE_ANIMATE_DURATION);
        }
        animateFrame(false, true);
        if (mBouncerListener != null) {
            mBouncerListener.onBouncerStateChanged(false);
@@ -817,7 +822,11 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
                    throw new IllegalStateException(
                            "There may only be one child with layout_isChallenge=\"true\"");
                }
                mChallengeView = child;
                if (!(child instanceof KeyguardSecurityContainer)) {
                            throw new IllegalArgumentException(
                                    "Challenge must be a KeyguardSecurityContainer");
                }
                mChallengeView = (KeyguardSecurityContainer) child;
                if (mChallengeView != oldChallengeView) {
                    mChallengeView.setVisibility(mChallengeShowing ? VISIBLE : INVISIBLE);
                }