summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-08-16 13:00:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-16 13:00:29 -0700
commit7455dc3bf46fac0eb8da9e8825c2de6552d45154 (patch)
treead9acc4f4c5190ceefe2a5a2bda8b7708d9f1343 /packages/SystemUI
parent2c35514efb5e5ce5062a5c9c25c5262bf871a504 (diff)
parent9744ad68e212ce9d08c63ac4ed7b25c81797fd65 (diff)
downloadframeworks_base-7455dc3bf46fac0eb8da9e8825c2de6552d45154.zip
frameworks_base-7455dc3bf46fac0eb8da9e8825c2de6552d45154.tar.gz
frameworks_base-7455dc3bf46fac0eb8da9e8825c2de6552d45154.tar.bz2
am 9744ad68: am 5050813f: Allow the panels to be temporarily dragged past their contents.
* commit '9744ad68e212ce9d08c63ac4ed7b25c81797fd65': Allow the panels to be temporarily dragged past their contents.
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java54
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java1
6 files changed, 46 insertions, 21 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 828dba4..cb32d63 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -23,10 +23,11 @@
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:id="@+id/notification_panel"
android:layout_width="0dp"
- android:layout_height="0dp"
+ android:layout_height="wrap_content"
android:background="@drawable/notification_panel_bg"
android:paddingTop="@dimen/notification_panel_padding_top"
android:layout_marginLeft="@dimen/notification_panel_margin_left"
+ android:animateLayoutChanges="true"
>
<TextView
@@ -45,6 +46,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/close_handle_underlap"
android:orientation="vertical"
+ android:animateLayoutChanges="true"
>
<include layout="@layout/status_bar_expanded_header"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
index 427cd8c..bffb903 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
@@ -69,14 +69,14 @@ public class PanelBar extends FrameLayout {
return mPanels.get((int)(N * x / getMeasuredWidth()));
}
- public boolean isEnabled() {
+ public boolean panelsEnabled() {
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// Allow subclasses to implement enable/disable semantics
- if (!isEnabled()) return false;
+ if (!panelsEnabled()) return false;
// figure out which panel needs to be talked to here
if (event.getAction() == MotionEvent.ACTION_DOWN) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 336eee4..b595257 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -22,6 +22,7 @@ public class PanelView extends FrameLayout {
}
public static final boolean BRAKES = false;
+ private static final boolean STRETCH_PAST_CONTENTS = true;
private float mSelfExpandVelocityPx; // classic value: 2000px/s
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
@@ -45,6 +46,9 @@ public class PanelView extends FrameLayout {
private float mTouchOffset;
private float mExpandedFraction = 0;
private float mExpandedHeight = 0;
+ private boolean mClosing;
+ private boolean mRubberbanding;
+ private boolean mTracking;
private TimeAnimator mTimeAnimator;
private VelocityTracker mVelocityTracker;
@@ -61,12 +65,13 @@ public class PanelView extends FrameLayout {
private final Runnable mStopAnimator = new Runnable() { public void run() {
if (mTimeAnimator.isStarted()) {
- mTimeAnimator.end(); }
+ mTimeAnimator.end();
+ }
}};
private float mVel, mAccel;
private int mFullHeight = 0;
- private String mViewName;
+ private String mViewName;
private void animationTick(long dtms) {
if (!mTimeAnimator.isStarted()) {
@@ -75,16 +80,18 @@ public class PanelView extends FrameLayout {
mTimeAnimator.setTimeListener(mAnimationCallback);
mTimeAnimator.start();
+
+ mRubberbanding = STRETCH_PAST_CONTENTS && mExpandedHeight > getFullHeight();
+ mClosing = (mExpandedHeight > 0 && mVel < 0) || mRubberbanding;
} else if (dtms > 0) {
final float dt = dtms * 0.001f; // ms -> s
LOG("tick: v=%.2fpx/s dt=%.4fs", mVel, dt);
LOG("tick: before: h=%d", (int) mExpandedHeight);
final float fh = getFullHeight();
- final boolean closing = mExpandedHeight > 0 && mVel < 0;
boolean braking = false;
if (BRAKES) {
- if (closing) {
+ if (mClosing) {
braking = mExpandedHeight <= mCollapseBrakingDistancePx;
mAccel = braking ? 10*mCollapseAccelPx : -mCollapseAccelPx;
} else {
@@ -92,36 +99,40 @@ public class PanelView extends FrameLayout {
mAccel = braking ? 10*-mExpandAccelPx : mExpandAccelPx;
}
} else {
- mAccel = closing ? -mCollapseAccelPx : mExpandAccelPx;
+ mAccel = mClosing ? -mCollapseAccelPx : mExpandAccelPx;
}
mVel += mAccel * dt;
if (braking) {
- if (closing && mVel > -mBrakingSpeedPx) {
+ if (mClosing && mVel > -mBrakingSpeedPx) {
mVel = -mBrakingSpeedPx;
- } else if (!closing && mVel < mBrakingSpeedPx) {
+ } else if (!mClosing && mVel < mBrakingSpeedPx) {
mVel = mBrakingSpeedPx;
}
} else {
- if (closing && mVel > -mFlingCollapseMinVelocityPx) {
+ if (mClosing && mVel > -mFlingCollapseMinVelocityPx) {
mVel = -mFlingCollapseMinVelocityPx;
- } else if (!closing && mVel > mFlingGestureMaxOutputVelocityPx) {
+ } else if (!mClosing && mVel > mFlingGestureMaxOutputVelocityPx) {
mVel = mFlingGestureMaxOutputVelocityPx;
}
}
float h = mExpandedHeight + mVel * dt;
+
+ if (mRubberbanding && h < fh) {
+ h = fh;
+ }
- LOG("tick: new h=%d closing=%s", (int) h, closing?"true":"false");
+ LOG("tick: new h=%d closing=%s", (int) h, mClosing?"true":"false");
setExpandedHeightInternal(h);
mBar.panelExpansionChanged(PanelView.this, mExpandedFraction);
if (mVel == 0
- || (closing && mExpandedHeight == 0)
- || (!closing && mExpandedHeight == getFullHeight())) {
+ || (mClosing && mExpandedHeight == 0)
+ || ((mRubberbanding || !mClosing) && mExpandedHeight == fh)) {
post(mStopAnimator);
}
}
@@ -183,6 +194,7 @@ public class PanelView extends FrameLayout {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
+ mTracking = true;
mVelocityTracker = VelocityTracker.obtain();
trackMovement(event);
mBar.onTrackingStarted(PanelView.this);
@@ -190,7 +202,7 @@ public class PanelView extends FrameLayout {
break;
case MotionEvent.ACTION_MOVE:
- PanelView.this.setExpandedHeight(rawY - mAbsPos[1] - mTouchOffset);
+ PanelView.this.setExpandedHeightInternal(rawY - mAbsPos[1] - mTouchOffset);
mBar.panelExpansionChanged(PanelView.this, mExpandedFraction);
@@ -199,6 +211,7 @@ public class PanelView extends FrameLayout {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
+ mTracking = false;
mBar.onTrackingStopped(PanelView.this);
trackMovement(event);
mVelocityTracker.computeCurrentVelocity(1000);
@@ -275,6 +288,10 @@ public class PanelView extends FrameLayout {
LOG("onMeasure(%d, %d) -> (%d, %d)",
widthMeasureSpec, heightMeasureSpec, getMeasuredWidth(), getMeasuredHeight());
mFullHeight = getMeasuredHeight();
+ // if one of our children is getting smaller, we should track that
+ if (!mTracking && !mRubberbanding && !mTimeAnimator.isStarted() && mExpandedHeight > 0 && mExpandedHeight != mFullHeight) {
+ mExpandedHeight = mFullHeight;
+ }
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
(int) mExpandedHeight, MeasureSpec.AT_MOST); // MeasureSpec.getMode(heightMeasureSpec));
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
@@ -286,17 +303,22 @@ public class PanelView extends FrameLayout {
setExpandedHeightInternal(height);
}
+ @Override
+ protected void onLayout (boolean changed, int left, int top, int right, int bottom) {
+ LOG("onLayout: changed=%s, bottom=%d eh=%d fh=%d", changed?"T":"f", bottom, (int)mExpandedHeight, (int)mFullHeight);
+ super.onLayout(changed, left, top, right, bottom);
+ }
+
public void setExpandedHeightInternal(float h) {
float fh = getFullHeight();
if (fh == 0) {
// Hmm, full height hasn't been computed yet
}
- LOG("setExpansion: height=%.1f fh=%.1f", h, fh);
+ LOG("setExpansion: height=%.1f fh=%.1f tracking=%s rubber=%s", h, fh, mTracking?"T":"f", mRubberbanding?"T":"f");
if (h < 0) h = 0;
- else if (h > fh) h = fh;
-
+ if (!(STRETCH_PAST_CONTENTS && (mTracking || mRubberbanding)) && h > fh) h = fh;
mExpandedHeight = h;
requestLayout();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index ad06c1b..a20576f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -109,7 +109,7 @@ public class PhoneStatusBar extends BaseStatusBar {
public static final String ACTION_STATUSBAR_START
= "com.android.internal.policy.statusbar.START";
- private static final boolean SHOW_CARRIER_LABEL = true;
+ private static final boolean SHOW_CARRIER_LABEL = false; // XXX: doesn't work with rubberband panels right now
private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index a42e455..2a96d6d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -71,7 +71,7 @@ public class PhoneStatusBarView extends PanelBar {
}
@Override
- public boolean isEnabled() {
+ public boolean panelsEnabled() {
return ((mBar.mDisabled & StatusBarManager.DISABLE_EXPAND) == 0);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index e63735677..89eed1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -78,6 +78,7 @@ public class NotificationRowLayout
super(context, attrs, defStyle);
mRealLayoutTransition = new LayoutTransition();
+ mRealLayoutTransition.setAnimateParentHierarchy(true);
setLayoutTransitionsEnabled(true);
setOrientation(LinearLayout.VERTICAL);