summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-06-14 05:46:49 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-14 05:46:49 -0700
commita54c01eccbb9256fd7bcecf7b2f398a7e2ef0041 (patch)
tree0fefe23c850bb46a81322c8cb4876d217f43447e /packages
parentb44700f27dc0f0673c54e422c62a49d0891b67d7 (diff)
parent9b2cd15f0fed990f532f35590c2a2896b90dc7fc (diff)
downloadframeworks_base-a54c01eccbb9256fd7bcecf7b2f398a7e2ef0041.zip
frameworks_base-a54c01eccbb9256fd7bcecf7b2f398a7e2ef0041.tar.gz
frameworks_base-a54c01eccbb9256fd7bcecf7b2f398a7e2ef0041.tar.bz2
Merge "Invert the sense of the two-figner direction on tablets." into jb-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/ExpandHelper.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java3
3 files changed, 27 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index df41d25..48efbc7 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -23,11 +23,14 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.Log;
+import android.view.Gravity;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
+import android.widget.ScrollView;
+import android.widget.FrameLayout;
public class ExpandHelper implements Gefingerpoken, OnClickListener {
public interface Callback {
@@ -38,7 +41,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
}
private static final String TAG = "ExpandHelper";
- protected static final boolean DEBUG = false;
+ protected static final boolean DEBUG = true;
private static final long EXPAND_DURATION = 250;
private static final long GLOW_DURATION = 150;
@@ -82,8 +85,11 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private int mLargeSize;
private float mMaximumStretch;
+ private int mGravity;
+
private class ViewScaler {
View mView;
+
public ViewScaler() {}
public void setView(View v) {
mView = v;
@@ -119,6 +125,15 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
}
}
+ /**
+ * Handle expansion gestures to expand and contract children of the callback.
+ *
+ * @param context application context
+ * @param callback the container that holds the items to be manipulated
+ * @param small the smallest allowable size for the manuipulated items.
+ * @param large the largest allowable size for the manuipulated items.
+ * @param scoller if non-null also manipulate the scroll position to obey the gravity.
+ */
public ExpandHelper(Context context, Callback callback, int small, int large) {
mSmallSize = small;
mMaximumStretch = mSmallSize * STRETCH_INTERVAL;
@@ -126,7 +141,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mContext = context;
mCallback = callback;
mScaler = new ViewScaler();
-
+ mGravity = Gravity.TOP;
mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f);
mScaleAnimation.setDuration(EXPAND_DURATION);
@@ -194,6 +209,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
span *= USE_SPAN ? 1f : 0f;
float drag = detector.getFocusY() - mInitialTouchFocusY;
drag *= USE_DRAG ? 1f : 0f;
+ drag *= mGravity == Gravity.BOTTOM ? -1f : 1f;
float pull = Math.abs(drag) + Math.abs(span) + 1f;
float hand = drag * Math.abs(drag) / pull + span * Math.abs(span) / pull;
if (DEBUG) Log.d(TAG, "current span handle is: " + hand);
@@ -227,6 +243,10 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
mEventSource = eventSource;
}
+ public void setGravity(int gravity) {
+ mGravity = gravity;
+ }
+
public void setGlow(float glow) {
if (!mGlowAnimationSet.isRunning() || glow == 0f) {
if (mGlowAnimationSet.isRunning()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index ed1b2f5..9317561 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -22,6 +22,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.FrameLayout;
+import android.widget.ScrollView;
import android.widget.TextSwitcher;
import com.android.systemui.ExpandHelper;
@@ -47,6 +48,7 @@ public class StatusBarWindowView extends FrameLayout
protected void onAttachedToWindow () {
super.onAttachedToWindow();
latestItems = (NotificationRowLayout) findViewById(R.id.latestItems);
+ ScrollView scroller = (ScrollView) findViewById(R.id.scroll);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index d8166f1..af0f9d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Slog;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -33,6 +34,7 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.RelativeLayout;
+import android.widget.ScrollView;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
@@ -114,6 +116,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, latestItems, minHeight, maxHeight);
mExpandHelper.setEventSource(this);
+ mExpandHelper.setGravity(Gravity.BOTTOM);
}
private View.OnClickListener mClearButtonListener = new View.OnClickListener() {