OSDN Git Service

hide the correct text, and more text, on bounce
authorChris Wren <cwren@android.com>
Fri, 2 Nov 2012 18:36:56 +0000 (14:36 -0400)
committerChris Wren <cwren@android.com>
Fri, 2 Nov 2012 20:28:18 +0000 (16:28 -0400)
Bug: 7464865
Change-Id: I39dc6f06ce0403a29e4802fcc5288788cffb6070

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

index 04ab0a2..7b11507 100644 (file)
@@ -1,11 +1,13 @@
 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;
+    }
 }
index 1f33fc3..16e2f9e 100644 (file)
@@ -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);
                 }