|
1 | 1 | package com.android.internal.policy.impl.keyguard; |
2 | 2 |
|
3 | 3 | import android.animation.Animator; |
| 4 | +import android.animation.AnimatorSet; |
4 | 5 | import android.animation.ObjectAnimator; |
5 | 6 | import android.content.Context; |
6 | 7 | import android.graphics.Canvas; |
7 | 8 | import android.graphics.drawable.Drawable; |
8 | 9 | import android.util.AttributeSet; |
| 10 | +import android.view.View; |
9 | 11 | import android.widget.FrameLayout; |
10 | 12 |
|
11 | 13 | import com.android.internal.R; |
@@ -51,18 +53,42 @@ protected void dispatchDraw(Canvas canvas) { |
51 | 53 | } |
52 | 54 |
|
53 | 55 | public void showBouncer(int duration) { |
54 | | - SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this); |
| 56 | + SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView()); |
55 | 57 | message.showBouncer(duration); |
56 | | - Animator anim = ObjectAnimator.ofFloat(this, "BackgroundAlpha", 1f); |
| 58 | + AnimatorSet anim = new AnimatorSet(); |
| 59 | + anim.playTogether(ObjectAnimator.ofFloat(this, "backgroundAlpha", 1f), getEcaAnim(0f)); |
57 | 60 | anim.setDuration(duration); |
58 | 61 | anim.start(); |
59 | 62 | } |
60 | 63 |
|
61 | 64 | public void hideBouncer(int duration) { |
62 | | - SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this); |
| 65 | + SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView()); |
63 | 66 | message.hideBouncer(duration); |
64 | | - Animator anim = ObjectAnimator.ofFloat(this, "BackgroundAlpha", 0f); |
| 67 | + AnimatorSet anim = new AnimatorSet(); |
| 68 | + anim.playTogether(ObjectAnimator.ofFloat(this, "backgroundAlpha", 0f), getEcaAnim(1f)); |
65 | 69 | anim.setDuration(duration); |
66 | 70 | anim.start(); |
67 | 71 | } |
| 72 | + |
| 73 | + View getSecurityView() { |
| 74 | + for (int i = 0; i < getChildCount(); i++) { |
| 75 | + View child = getChildAt(i); |
| 76 | + if (child instanceof KeyguardSecurityViewFlipper) { |
| 77 | + return (View) (((KeyguardSecurityViewFlipper) child).getSecurityView()); |
| 78 | + } |
| 79 | + } |
| 80 | + return null; |
| 81 | + } |
| 82 | + |
| 83 | + Animator getEcaAnim(float alpha) { |
| 84 | + Animator anim = null; |
| 85 | + View securityView = getSecurityView(); |
| 86 | + if (securityView != null) { |
| 87 | + View ecaView = securityView.findViewById(R.id.keyguard_selector_fade_container); |
| 88 | + if (ecaView != null) { |
| 89 | + anim = ObjectAnimator.ofFloat(ecaView, "alpha", alpha); |
| 90 | + } |
| 91 | + } |
| 92 | + return anim; |
| 93 | + } |
68 | 94 | } |
0 commit comments