am 1b459f89: Merge "Cleaned up status bar closing handling" into lmp-mr1-dev

* commit '1b459f89a738fa913ed12fe893e435b2f6cc9416':
  Cleaned up status bar closing handling
This commit is contained in:
Selim Cinek
2014-10-24 16:48:21 +00:00
committed by Android Git Automerger
4 changed files with 41 additions and 21 deletions

View File

@@ -236,4 +236,8 @@ public class PanelBar extends FrameLayout {
public void onExpandingFinished() { public void onExpandingFinished() {
} }
public void onClosingFinished() {
}
} }

View File

@@ -106,7 +106,7 @@ public abstract class PanelView extends FrameLayout {
}; };
protected void onExpandingFinished() { protected void onExpandingFinished() {
mClosing = false; endClosing();
mBar.onExpandingFinished(); mBar.onExpandingFinished();
} }
@@ -249,9 +249,7 @@ public abstract class PanelView extends FrameLayout {
trackMovement(event); trackMovement(event);
if (!waitForTouchSlop || (mHeightAnimator != null && !mHintAnimationRunning) || if (!waitForTouchSlop || (mHeightAnimator != null && !mHintAnimationRunning) ||
mPeekPending || mPeekAnimator != null) { mPeekPending || mPeekAnimator != null) {
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel(); // end any outstanding animations
}
cancelPeek(); cancelPeek();
mTouchSlopExceeded = (mHeightAnimator != null && !mHintAnimationRunning) mTouchSlopExceeded = (mHeightAnimator != null && !mHintAnimationRunning)
|| mPeekPending || mPeekAnimator != null; || mPeekPending || mPeekAnimator != null;
@@ -292,9 +290,7 @@ public abstract class PanelView extends FrameLayout {
mInitialTouchY = y; mInitialTouchY = y;
h = 0; h = 0;
} }
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel(); // end any outstanding animations
}
removeCallbacks(mPeekRunnable); removeCallbacks(mPeekRunnable);
mPeekPending = false; mPeekPending = false;
onTrackingStarted(); onTrackingStarted();
@@ -371,7 +367,7 @@ public abstract class PanelView extends FrameLayout {
} }
protected void onTrackingStarted() { protected void onTrackingStarted() {
mClosing = false; endClosing();
mTracking = true; mTracking = true;
mCollapseAfterPeek = false; mCollapseAfterPeek = false;
mBar.onTrackingStarted(PanelView.this); mBar.onTrackingStarted(PanelView.this);
@@ -406,9 +402,7 @@ public abstract class PanelView extends FrameLayout {
mStatusBar.userActivity(); mStatusBar.userActivity();
if (mHeightAnimator != null && !mHintAnimationRunning || if (mHeightAnimator != null && !mHintAnimationRunning ||
mPeekPending || mPeekAnimator != null) { mPeekPending || mPeekAnimator != null) {
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel(); // end any outstanding animations
}
cancelPeek(); cancelPeek();
mTouchSlopExceeded = true; mTouchSlopExceeded = true;
return true; return true;
@@ -440,9 +434,7 @@ public abstract class PanelView extends FrameLayout {
trackMovement(event); trackMovement(event);
if (scrolledToBottom) { if (scrolledToBottom) {
if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) { if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) {
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel();
}
mInitialOffsetOnTouch = mExpandedHeight; mInitialOffsetOnTouch = mExpandedHeight;
mInitialTouchY = y; mInitialTouchY = y;
mInitialTouchX = x; mInitialTouchX = x;
@@ -460,6 +452,20 @@ public abstract class PanelView extends FrameLayout {
return false; return false;
} }
private void cancelHeightAnimator() {
if (mHeightAnimator != null) {
mHeightAnimator.cancel();
}
endClosing();
}
private void endClosing() {
if (mClosing) {
mClosing = false;
onClosingFinished();
}
}
private void initVelocityTracker() { private void initVelocityTracker() {
if (mVelocityTracker != null) { if (mVelocityTracker != null) {
mVelocityTracker.recycle(); mVelocityTracker.recycle();
@@ -699,9 +705,7 @@ public abstract class PanelView extends FrameLayout {
mPeekRunnable.run(); mPeekRunnable.run();
} }
} else if (!isFullyCollapsed() && !mTracking && !mClosing) { } else if (!isFullyCollapsed() && !mTracking && !mClosing) {
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel();
}
mClosing = true; mClosing = true;
notifyExpandingStarted(); notifyExpandingStarted();
if (delayed) { if (delayed) {
@@ -784,13 +788,16 @@ public abstract class PanelView extends FrameLayout {
private void abortAnimations() { private void abortAnimations() {
cancelPeek(); cancelPeek();
if (mHeightAnimator != null) { cancelHeightAnimator();
mHeightAnimator.cancel();
}
removeCallbacks(mPostCollapseRunnable); removeCallbacks(mPostCollapseRunnable);
removeCallbacks(mFlingCollapseRunnable); removeCallbacks(mFlingCollapseRunnable);
} }
protected void onClosingFinished() {
mBar.onClosingFinished();
}
protected void startUnlockHintAnimation() { protected void startUnlockHintAnimation() {
// We don't need to hint the user if an animation is already running or the user is changing // We don't need to hint the user if an animation is already running or the user is changing

View File

@@ -3795,6 +3795,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
runPostCollapseRunnables(); runPostCollapseRunnables();
} }
public void onClosingFinished() {
runPostCollapseRunnables();
}
public void onUnlockHintStarted() { public void onUnlockHintStarted() {
mKeyguardIndicationController.showTransientIndication(R.string.keyguard_unlock); mKeyguardIndicationController.showTransientIndication(R.string.keyguard_unlock);
} }

View File

@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent;
@@ -151,6 +150,12 @@ public class PhoneStatusBarView extends PanelBar {
mScrimController.onTrackingStarted(); mScrimController.onTrackingStarted();
} }
@Override
public void onClosingFinished() {
super.onClosingFinished();
mBar.onClosingFinished();
}
@Override @Override
public void onTrackingStopped(PanelView panel, boolean expand) { public void onTrackingStopped(PanelView panel, boolean expand) {
super.onTrackingStopped(panel, expand); super.onTrackingStopped(panel, expand);