diff options
author | Chris Wren <cwren@android.com> | 2012-06-11 10:39:36 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2012-06-12 16:41:54 -0400 |
commit | 9b2cd15f0fed990f532f35590c2a2896b90dc7fc (patch) | |
tree | 0086b69a02ddede3284ba632dabdf6a72a7839c8 /packages | |
parent | f958732bd3924205d9f8bda94f4f6e3bb4045b28 (diff) | |
download | frameworks_base-9b2cd15f0fed990f532f35590c2a2896b90dc7fc.zip frameworks_base-9b2cd15f0fed990f532f35590c2a2896b90dc7fc.tar.gz frameworks_base-9b2cd15f0fed990f532f35590c2a2896b90dc7fc.tar.bz2 |
Invert the sense of the two-figner direction on tablets.
Bug: 6506376
Change-Id: Ife336c6695608f14554e18e32ea35f118d7f12e2
Diffstat (limited to 'packages')
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 71657f5..992dcee 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; @@ -116,6 +118,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() { |