diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-29 10:04:51 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-04-29 10:04:51 -0700 |
commit | 10812203e52353f666cbb3ef02e423711dd64758 (patch) | |
tree | a8f87ecf974564242d654bfc0b981049fc3c50dd /src | |
parent | 40bb6b9b90855e2377bdc634d553e3def65e483e (diff) |
Remove unneeded dimming code
Change-Id: I42b86f0404faeca1beed8cca5c73d1fe73d76596
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 1 | ||||
-rw-r--r-- | src/com/android/dialer/widget/OverlappingPaneLayout.java | 190 |
2 files changed, 5 insertions, 186 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 7cabe6fd5..477db2711 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -228,7 +228,6 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste shortcutCardsListView.setAdapter(mMergedAdapter); final OverlappingPaneLayout paneLayout = (OverlappingPaneLayout) parentView; - paneLayout.setSliderFadeColor(android.R.color.transparent); // TODO: Remove the notion of a capturable view. The entire view be slideable, once // the framework better supports nested scrolling. paneLayout.setCapturableView(mViewPagerTabs); diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java index aa9de6377..d6ebbb09c 100644 --- a/src/com/android/dialer/widget/OverlappingPaneLayout.java +++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java @@ -66,21 +66,11 @@ public class OverlappingPaneLayout extends ViewGroup { private static final int DEFAULT_FADE_COLOR = 0xcccccccc; /** - * The fade color used for the sliding panel. 0 = no fading. - */ - private int mSliderFadeColor = DEFAULT_FADE_COLOR; - - /** * Minimum velocity that will be detected as a fling */ private static final int MIN_FLING_VELOCITY = 400; // dips per second /** - * The fade color used for the panel covered by the slider. 0 = no fading. - */ - private int mCoveredFadeColor; - - /** * The size of the overhang in pixels. * This is the minimum section of the sliding panel that will * be visible in the open state to allow for a closing drag. @@ -136,9 +126,6 @@ public class OverlappingPaneLayout extends ViewGroup { private final Rect mTmpRect = new Rect(); - private final ArrayList<DisableLayerRunnable> mPostedRunnables = - new ArrayList<DisableLayerRunnable>(); - /** * Listener for monitoring events about sliding panes. */ @@ -194,39 +181,6 @@ public class OverlappingPaneLayout extends ViewGroup { mCapturableView = capturableView; } - /** - * Set the color used to fade the sliding pane out when it is slid most of the way offscreen. - * - * @param color An ARGB-packed color value - */ - public void setSliderFadeColor(int color) { - mSliderFadeColor = color; - } - - /** - * @return The ARGB-packed color value used to fade the sliding pane - */ - public int getSliderFadeColor() { - return mSliderFadeColor; - } - - /** - * Set the color used to fade the pane covered by the sliding pane out when the pane - * will become fully covered in the closed state. - * - * @param color An ARGB-packed color value - */ - public void setCoveredFadeColor(int color) { - mCoveredFadeColor = color; - } - - /** - * @return The ARGB-packed color value used to fade the fixed pane - */ - public int getCoveredFadeColor() { - return mCoveredFadeColor; - } - public void setPanelSlideListener(PanelSlideListener listener) { mPanelSlideListener = listener; } @@ -323,12 +277,6 @@ public class OverlappingPaneLayout extends ViewGroup { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mFirstLayout = true; - - for (int i = 0, count = mPostedRunnables.size(); i < count; i++) { - final DisableLayerRunnable dlr = mPostedRunnables.get(i); - dlr.run(); - } - mPostedRunnables.clear(); } @Override @@ -399,7 +347,6 @@ public class OverlappingPaneLayout extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (child.getVisibility() == GONE) { - lp.dimWhenOffset = false; continue; } @@ -578,8 +525,6 @@ public class OverlappingPaneLayout extends ViewGroup { height - paddingBottom - mOverhangSize) - yStart - margin; mSlideRange = range; final int lpMargin = lp.topMargin; - lp.dimWhenOffset = yStart + lpMargin + range + childHeight / 2 > - height - paddingBottom; final int pos = (int) (range * mSlideOffset); yStart += pos + lpMargin; mSlideOffset = (float) pos / mSlideRange; @@ -598,16 +543,6 @@ public class OverlappingPaneLayout extends ViewGroup { } if (mFirstLayout) { - if (mCanSlide) { - if (((LayoutParams) mSlideableView.getLayoutParams()).dimWhenOffset) { - dimChildView(mSlideableView, mSlideOffset, mSliderFadeColor); - } - } else { - // Reset the dim level of all children; it's irrelevant when nothing moves. - for (int i = 0; i < childCount; i++) { - dimChildView(getChildAt(i), 0, mSliderFadeColor); - } - } updateObscuredViewsVisibility(mSlideableView); } @@ -655,8 +590,6 @@ public class OverlappingPaneLayout extends ViewGroup { return false; } - boolean interceptTap = false; - switch (action) { case MotionEvent.ACTION_DOWN: { mIsUnableToDrag = false; @@ -665,10 +598,6 @@ public class OverlappingPaneLayout extends ViewGroup { mInitialMotionX = x; mInitialMotionY = y; - if (mDragHelper.isViewUnder(mSlideableView, (int) x, (int) y) && - isDimmed(mSlideableView)) { - interceptTap = true; - } break; } @@ -688,7 +617,7 @@ public class OverlappingPaneLayout extends ViewGroup { final boolean interceptForDrag = mDragHelper.shouldInterceptTouchEvent(ev); - return interceptForDrag || interceptTap; + return interceptForDrag; } @Override @@ -710,23 +639,6 @@ public class OverlappingPaneLayout extends ViewGroup { mInitialMotionY = y; break; } - - case MotionEvent.ACTION_UP: { - if (isDimmed(mSlideableView)) { - final float x = ev.getX(); - final float y = ev.getY(); - final float dx = x - mInitialMotionX; - final float dy = y - mInitialMotionY; - final int slop = mDragHelper.getTouchSlop(); - if (dx * dx + dy * dy < slop * slop && - mDragHelper.isViewUnder(mSlideableView, (int) x, (int) y)) { - // Taps close a dimmed open pane. - closePane(mSlideableView, 0); - break; - } - } - break; - } } return wantTouchEvents; @@ -801,37 +713,9 @@ public class OverlappingPaneLayout extends ViewGroup { mSlideOffset = (float) (newTop - topBound) / mSlideRange; - if (lp.dimWhenOffset) { - dimChildView(mSlideableView, mSlideOffset, mSliderFadeColor); - } dispatchOnPanelSlide(mSlideableView); } - private void dimChildView(View v, float mag, int fadeColor) { - final LayoutParams lp = (LayoutParams) v.getLayoutParams(); - - if (mag > 0 && fadeColor != 0) { - final int baseAlpha = (fadeColor & 0xff000000) >>> 24; - int imag = (int) (baseAlpha * mag); - int color = imag << 24 | (fadeColor & 0xffffff); - if (lp.dimPaint == null) { - lp.dimPaint = new Paint(); - } - lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER)); - if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) { - ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint); - } - invalidateChildRegion(v); - } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) { - if (lp.dimPaint != null) { - lp.dimPaint.setColorFilter(null); - } - final DisableLayerRunnable dlr = new DisableLayerRunnable(v); - mPostedRunnables.add(dlr); - ViewCompat.postOnAnimation(this, dlr); - } - } - @Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); @@ -849,24 +733,10 @@ public class OverlappingPaneLayout extends ViewGroup { if (Build.VERSION.SDK_INT >= 11) { // HC result = super.drawChild(canvas, child, drawingTime); } else { - if (lp.dimWhenOffset && mSlideOffset > 0) { - if (!child.isDrawingCacheEnabled()) { - child.setDrawingCacheEnabled(true); - } - final Bitmap cache = child.getDrawingCache(); - if (cache != null) { - canvas.drawBitmap(cache, child.getLeft(), child.getTop(), lp.dimPaint); - result = false; - } else { - Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache"); - result = super.drawChild(canvas, child, drawingTime); - } - } else { - if (child.isDrawingCacheEnabled()) { - child.setDrawingCacheEnabled(false); - } - result = super.drawChild(canvas, child, drawingTime); + if (child.isDrawingCacheEnabled()) { + child.setDrawingCacheEnabled(false); } + result = super.drawChild(canvas, child, drawingTime); } canvas.restoreToCount(save); @@ -874,10 +744,6 @@ public class OverlappingPaneLayout extends ViewGroup { return result; } - private void invalidateChildRegion(View v) { - ViewCompat.setLayerPaint(v, ((LayoutParams) v.getLayoutParams()).dimPaint); - } - /** * Smoothly animate mDraggingPane to the target X position within its range. * @@ -933,14 +799,6 @@ public class OverlappingPaneLayout extends ViewGroup { && screenY < viewLocation[1] + capturableView.getHeight(); } - boolean isDimmed(View child) { - if (child == null) { - return false; - } - final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - return mCanSlide && lp.dimWhenOffset && mSlideOffset > 0; - } - @Override protected ViewGroup.LayoutParams generateDefaultLayoutParams() { return new LayoutParams(); @@ -1082,14 +940,6 @@ public class OverlappingPaneLayout extends ViewGroup { */ boolean slideable; - /** - * True if this view should be drawn dimmed - * when it's been offset from its default position. - */ - boolean dimWhenOffset; - - Paint dimPaint; - public LayoutParams() { super(FILL_PARENT, FILL_PARENT); } @@ -1174,7 +1024,7 @@ public class OverlappingPaneLayout extends ViewGroup { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); - if (!filter(child) && (child.getVisibility() == View.VISIBLE)) { + if (child.getVisibility() == View.VISIBLE) { // Force importance to "yes" since we can't read the value. ViewCompat.setImportantForAccessibility( child, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); @@ -1190,19 +1040,6 @@ public class OverlappingPaneLayout extends ViewGroup { event.setClassName(OverlappingPaneLayout.class.getName()); } - @Override - public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, - AccessibilityEvent event) { - if (!filter(child)) { - return super.onRequestSendAccessibilityEvent(host, child, event); - } - return false; - } - - public boolean filter(View child) { - return isDimmed(child); - } - /** * This should really be in AccessibilityNodeInfoCompat, but there unfortunately * seem to be a few elements that are not easily cloneable using the underlying API. @@ -1236,21 +1073,4 @@ public class OverlappingPaneLayout extends ViewGroup { dest.setMovementGranularities(src.getMovementGranularities()); } } - - private class DisableLayerRunnable implements Runnable { - final View mChildView; - - DisableLayerRunnable(View childView) { - mChildView = childView; - } - - @Override - public void run() { - if (mChildView.getParent() == OverlappingPaneLayout.this) { - ViewCompat.setLayerType(mChildView, ViewCompat.LAYER_TYPE_NONE, null); - invalidateChildRegion(mChildView); - } - mPostedRunnables.remove(this); - } - } } |