diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-04-23 16:13:15 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-05-02 16:14:38 +0200 |
commit | 4222d9a7fb87d73e1443ec1a2de9782b05741af6 (patch) | |
tree | f68b64e8f19533181f98247acf25dce508d9d789 /packages/SystemUI/src/com/android/systemui/ExpandHelper.java | |
parent | ecbab3662d4474bbb45477939aaa167eb883212b (diff) | |
download | frameworks_base-4222d9a7fb87d73e1443ec1a2de9782b05741af6.zip frameworks_base-4222d9a7fb87d73e1443ec1a2de9782b05741af6.tar.gz frameworks_base-4222d9a7fb87d73e1443ec1a2de9782b05741af6.tar.bz2 |
Change interaction for dragging down to full shade.
Starts expanding the card if it is expandable. If it's not, we
rubberband the expansion a lot. After the threshold has been reached,
we scale all the notifications up and make it fully white and opaque.
Change-Id: I9ecd020ca263b0f84e87fd6ab2332519ac5e9984
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/ExpandHelper.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/ExpandHelper.java | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index 61c268e..4d6d815 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -29,17 +29,16 @@ import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector.OnScaleGestureListener; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewConfiguration; -import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.ExpandableNotificationRow; +import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.policy.ScrollAdapter; -public class ExpandHelper implements Gefingerpoken, OnClickListener { +public class ExpandHelper implements Gefingerpoken { public interface Callback { - View getChildAtRawPosition(float x, float y); - View getChildAtPosition(float x, float y); + ExpandableView getChildAtRawPosition(float x, float y); + ExpandableView getChildAtPosition(float x, float y); boolean canChildBeExpanded(View v); void setUserExpandedChild(View v, boolean userExpanded); void setUserLockedChild(View v, boolean userLocked); @@ -48,9 +47,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { private static final String TAG = "ExpandHelper"; protected static final boolean DEBUG = false; protected static final boolean DEBUG_SCALE = false; - protected static final boolean DEBUG_GLOW = false; private static final long EXPAND_DURATION = 250; - private static final long GLOW_DURATION = 150; // Set to false to disable focus-based gestures (spread-finger vertical pull). private static final boolean USE_DRAG = true; @@ -115,7 +112,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { float focusX = detector.getFocusX(); float focusY = detector.getFocusY(); - final View underFocus = findView(focusX, focusY); + final ExpandableView underFocus = findView(focusX, focusY); startExpanding(underFocus, STRETCH); return mExpanding; } @@ -172,24 +169,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mPopDuration = mContext.getResources().getInteger(R.integer.blinds_pop_duration_ms); mPullGestureMinXSpan = mContext.getResources().getDimension(R.dimen.pull_span_min); - AnimatorListenerAdapter glowVisibilityController = new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - View target = (View) ((ObjectAnimator) animation).getTarget(); - if (target.getAlpha() <= 0.0f) { - target.setVisibility(View.VISIBLE); - } - } - - @Override - public void onAnimationEnd(Animator animation) { - View target = (View) ((ObjectAnimator) animation).getTarget(); - if (target.getAlpha() <= 0.0f) { - target.setVisibility(View.INVISIBLE); - } - } - }; - final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); @@ -221,8 +200,8 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { return out; } - private View findView(float x, float y) { - View v = null; + private ExpandableView findView(float x, float y) { + ExpandableView v; if (mEventSource != null) { int[] location = new int[2]; mEventSource.getLocationOnScreen(location); @@ -271,15 +250,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mScrollAdapter = adapter; } - private float calculateGlow(float target, float actual) { - // glow if overscale - if (DEBUG_GLOW) Log.d(TAG, "target: " + target + " actual: " + actual); - float stretch = Math.abs((target - actual) / mMaximumStretch); - float strength = 1f / (1f + (float) Math.pow(Math.E, -1 * ((8f * stretch) - 5f))); - if (DEBUG_GLOW) Log.d(TAG, "stretch: " + stretch + " strength: " + strength); - return (GLOW_BASE + strength * (1f - GLOW_BASE)); - } - @Override public boolean onInterceptTouchEvent(MotionEvent ev) { final int action = ev.getAction(); @@ -313,7 +283,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { // detect a vertical pulling gesture with fingers somewhat separated if (DEBUG_SCALE) Log.v(TAG, "got pull gesture (xspan=" + xspan + "px)"); - final View underFocus = findView(x, y); + final ExpandableView underFocus = findView(x, y); startExpanding(underFocus, PULL); return true; } @@ -328,7 +298,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { if (yDiff > mTouchSlop) { if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)"); mLastMotionY = y; - final View underFocus = findView(x, y); + final ExpandableView underFocus = findView(x, y); if (startExpanding(underFocus, BLINDS)) { mInitialTouchY = mLastMotionY; mHasPopped = false; @@ -394,7 +364,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { final int x = (int) mSGD.getFocusX(); final int y = (int) mSGD.getFocusY(); - View underFocus = findView(x, y); + ExpandableView underFocus = findView(x, y); if (isFinished && underFocus != null && underFocus != mCurrView) { finishExpanding(false); // @@@ needed? startExpanding(underFocus, BLINDS); @@ -432,7 +402,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { /** * @return True if the view is expandable, false otherwise. */ - private boolean startExpanding(View v, int expandType) { + private boolean startExpanding(ExpandableView v, int expandType) { if (!(v instanceof ExpandableNotificationRow)) { return false; } @@ -512,13 +482,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mCurrView = v; } - @Override - public void onClick(View v) { - startExpanding(v, STRETCH); - finishExpanding(true); - clearView(); - } - /** * Use this to abort any pending expansions in progress. */ |