Skip to content

Commit 81af21e

Browse files
cwrenAndroid (Google) Code Review
authored andcommitted
Merge "hide the correct text, and more text, on bounce" into jb-mr1-lockscreen-dev
2 parents a96cd63 + 052999f commit 81af21e

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityContainer.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.android.internal.policy.impl.keyguard;
22

33
import android.animation.Animator;
4+
import android.animation.AnimatorSet;
45
import android.animation.ObjectAnimator;
56
import android.content.Context;
67
import android.graphics.Canvas;
78
import android.graphics.drawable.Drawable;
89
import android.util.AttributeSet;
10+
import android.view.View;
911
import android.widget.FrameLayout;
1012

1113
import com.android.internal.R;
@@ -51,18 +53,42 @@ protected void dispatchDraw(Canvas canvas) {
5153
}
5254

5355
public void showBouncer(int duration) {
54-
SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this);
56+
SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView());
5557
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));
5760
anim.setDuration(duration);
5861
anim.start();
5962
}
6063

6164
public void hideBouncer(int duration) {
62-
SecurityMessageDisplay message = new KeyguardMessageArea.Helper(this);
65+
SecurityMessageDisplay message = new KeyguardMessageArea.Helper(getSecurityView());
6366
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));
6569
anim.setDuration(duration);
6670
anim.start();
6771
}
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+
}
6894
}

policy/src/com/android/internal/policy/impl/keyguard/SlidingChallengeLayout.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
6666

6767
// Initialized during measurement from child layoutparams
6868
private View mExpandChallengeView;
69-
private View mChallengeView;
69+
private KeyguardSecurityContainer mChallengeView;
7070
private View mScrimView;
7171
private View mWidgetsView;
7272

@@ -511,7 +511,9 @@ public void showBouncer() {
511511
if (mScrimView != null) {
512512
mScrimView.setVisibility(VISIBLE);
513513
}
514-
514+
if (mChallengeView != null) {
515+
mChallengeView.showBouncer(HANDLE_ANIMATE_DURATION);
516+
}
515517
// Mess with padding/margin to inset the bouncer frame.
516518
// We have more space available to us otherwise.
517519
if (mChallengeView != null) {
@@ -540,6 +542,9 @@ public void hideBouncer() {
540542
if (mScrimView != null) {
541543
mScrimView.setVisibility(GONE);
542544
}
545+
if (mChallengeView != null) {
546+
mChallengeView.hideBouncer(HANDLE_ANIMATE_DURATION);
547+
}
543548
animateFrame(false, true);
544549
if (mBouncerListener != null) {
545550
mBouncerListener.onBouncerStateChanged(false);
@@ -817,7 +822,11 @@ protected void onMeasure(int widthSpec, int heightSpec) {
817822
throw new IllegalStateException(
818823
"There may only be one child with layout_isChallenge=\"true\"");
819824
}
820-
mChallengeView = child;
825+
if (!(child instanceof KeyguardSecurityContainer)) {
826+
throw new IllegalArgumentException(
827+
"Challenge must be a KeyguardSecurityContainer");
828+
}
829+
mChallengeView = (KeyguardSecurityContainer) child;
821830
if (mChallengeView != oldChallengeView) {
822831
mChallengeView.setVisibility(mChallengeShowing ? VISIBLE : INVISIBLE);
823832
}

0 commit comments

Comments
 (0)