am 331b598b: Merge "Fix blank lockscreen." into lmp-preview-dev

* commit '331b598b261c6e531095b37185739b16bfefdd68':
  Fix blank lockscreen.
This commit is contained in:
Jorim Jaggi
2014-06-11 22:16:53 +00:00
committed by Android Git Automerger
3 changed files with 61 additions and 15 deletions

View File

@@ -423,6 +423,7 @@ public class KeyguardPageSwipeHelper {
return;
}
if (!animate) {
view.animate().cancel();
view.setAlpha(alpha);
view.setScaleX(scale);
view.setScaleY(scale);
@@ -465,6 +466,13 @@ public class KeyguardPageSwipeHelper {
}
public void reset() {
if (mSwipeAnimator != null) {
mSwipeAnimator.cancel();
}
ArrayList<View> targetViews = mCallback.getTranslationViews();
for (View view : targetViews) {
view.animate().cancel();
}
setTranslation(0.0f, true);
mSwipingInProgress = false;
}

View File

@@ -27,6 +27,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.ViewTreeObserver;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
@@ -67,6 +68,11 @@ public abstract class PanelView extends FrameLayout {
private VelocityTrackerInterface mVelocityTracker;
private FlingAnimationUtils mFlingAnimationUtils;
/**
* Whether an instant expand request is currently pending and we are just waiting for layout.
*/
private boolean mInstantExpanding;
PanelBar mBar;
protected int mMaxPanelHeight = -1;
@@ -128,6 +134,9 @@ public abstract class PanelView extends FrameLayout {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mInstantExpanding) {
return false;
}
/*
* We capture touch events here and update the expand height here in case according to
@@ -263,6 +272,9 @@ public abstract class PanelView extends FrameLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (mInstantExpanding) {
return false;
}
/*
* If the user drags anywhere inside the panel we intercept it if he moves his finger
@@ -556,6 +568,41 @@ public abstract class PanelView extends FrameLayout {
}
}
public void instantExpand() {
mInstantExpanding = true;
abortAnimations();
if (mTracking) {
onTrackingStopped(true /* expands */); // The panel is expanded after this call.
onExpandingFinished();
}
setVisibility(VISIBLE);
// Wait for window manager to pickup the change, so we know the maximum height of the panel
// then.
getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (mStatusBar.getStatusBarWindow().getHeight()
!= mStatusBar.getStatusBarHeight()) {
getViewTreeObserver().removeOnGlobalLayoutListener(this);
setExpandedFraction(1f);
mInstantExpanding = false;
}
}
});
// Make sure a layout really happens.
requestLayout();
}
private void abortAnimations() {
cancelPeek();
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
}
protected void startUnlockHintAnimation() {
// We don't need to hint the user if an animation is already running or the user is changing

View File

@@ -815,6 +815,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return mStatusBarView;
}
public StatusBarWindowView getStatusBarWindow() {
return mStatusBarWindow;
}
@Override
protected WindowManager.LayoutParams getSearchLayoutParams(LayoutParams layoutParams) {
boolean opaque = false;
@@ -2971,22 +2975,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private void instantExpandNotificationsPanel() {
// Make our window larger and the panel visible.
// Make our window larger and the panel expanded.
makeExpandedVisible(true);
mNotificationPanel.setVisibility(View.VISIBLE);
// Wait for window manager to pickup the change, so we know the maximum height of the panel
// then.
mNotificationPanel.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (mStatusBarWindow.getHeight() != getStatusBarHeight()) {
mNotificationPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
mNotificationPanel.setExpandedFraction(1);
}
}
});
mNotificationPanel.instantExpand();
}
private void instantCollapseNotificationPanel() {