Loading core/java/android/view/View.java +15 −9 Original line number Diff line number Diff line Loading @@ -6249,15 +6249,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } // Walk up the hierarchy to determine if we're inside a scrolling container. boolean isInScrollingContainer = false; ViewParent p = getParent(); while (p != null && p instanceof ViewGroup) { if (((ViewGroup) p).shouldDelayChildPressedState()) { isInScrollingContainer = true; break; } p = p.getParent(); } boolean isInScrollingContainer = isInScrollingContainer(); // For views inside a scrolling container, delay the pressed feedback for // a short period in case this is a scroll. Loading Loading @@ -6306,6 +6298,20 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit return false; } /** * @hide */ public boolean isInScrollingContainer() { ViewParent p = getParent(); while (p != null && p instanceof ViewGroup) { if (((ViewGroup) p).shouldDelayChildPressedState()) { return true; } p = p.getParent(); } return false; } /** * Remove the longpress detection timer. */ Loading core/java/android/widget/AbsSeekBar.java +43 −10 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; public abstract class AbsSeekBar extends ProgressBar { private Drawable mThumb; Loading @@ -49,6 +50,10 @@ public abstract class AbsSeekBar extends ProgressBar { private static final int NO_ALPHA = 0xFF; private float mDisabledAlpha; private int mScaledTouchSlop; private float mTouchDownX; private boolean mIsDragging; public AbsSeekBar(Context context) { super(context); } Loading @@ -74,6 +79,8 @@ public abstract class AbsSeekBar extends ProgressBar { com.android.internal.R.styleable.Theme, 0, 0); mDisabledAlpha = a.getFloat(com.android.internal.R.styleable.Theme_disabledAlpha, 0.5f); a.recycle(); mScaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } /** Loading Loading @@ -324,20 +331,42 @@ public abstract class AbsSeekBar extends ProgressBar { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (isInScrollingContainer()) { mTouchDownX = event.getX(); } else { setPressed(true); onStartTrackingTouch(); trackTouchEvent(event); attemptClaimDrag(); } break; case MotionEvent.ACTION_MOVE: if (mIsDragging) { trackTouchEvent(event); } else { final float x = event.getX(); if (Math.abs(x - mTouchDownX) > mScaledTouchSlop) { setPressed(true); onStartTrackingTouch(); trackTouchEvent(event); attemptClaimDrag(); } } break; case MotionEvent.ACTION_UP: if (mIsDragging) { trackTouchEvent(event); onStopTrackingTouch(); setPressed(false); } else { // Touch up when we never crossed the touch slop threshold should // be interpreted as a tap-seek to that location. onStartTrackingTouch(); trackTouchEvent(event); onStopTrackingTouch(); } // ProgressBar doesn't know to repaint the thumb drawable // in its inactive state when the touch stops (because the // value has not apparently changed) Loading @@ -345,8 +374,10 @@ public abstract class AbsSeekBar extends ProgressBar { break; case MotionEvent.ACTION_CANCEL: if (mIsDragging) { onStopTrackingTouch(); setPressed(false); } invalidate(); // see above explanation break; } Loading Loading @@ -388,6 +419,7 @@ public abstract class AbsSeekBar extends ProgressBar { * This is called when the user has started touching this widget. */ void onStartTrackingTouch() { mIsDragging = true; } /** Loading @@ -395,6 +427,7 @@ public abstract class AbsSeekBar extends ProgressBar { * canceled. */ void onStopTrackingTouch() { mIsDragging = false; } /** Loading core/java/android/widget/SeekBar.java +2 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class SeekBar extends AbsSeekBar { @Override void onStartTrackingTouch() { super.onStartTrackingTouch(); if (mOnSeekBarChangeListener != null) { mOnSeekBarChangeListener.onStartTrackingTouch(this); } Loading @@ -111,6 +112,7 @@ public class SeekBar extends AbsSeekBar { @Override void onStopTrackingTouch() { super.onStopTrackingTouch(); if (mOnSeekBarChangeListener != null) { mOnSeekBarChangeListener.onStopTrackingTouch(this); } Loading Loading
core/java/android/view/View.java +15 −9 Original line number Diff line number Diff line Loading @@ -6249,15 +6249,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit } // Walk up the hierarchy to determine if we're inside a scrolling container. boolean isInScrollingContainer = false; ViewParent p = getParent(); while (p != null && p instanceof ViewGroup) { if (((ViewGroup) p).shouldDelayChildPressedState()) { isInScrollingContainer = true; break; } p = p.getParent(); } boolean isInScrollingContainer = isInScrollingContainer(); // For views inside a scrolling container, delay the pressed feedback for // a short period in case this is a scroll. Loading Loading @@ -6306,6 +6298,20 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit return false; } /** * @hide */ public boolean isInScrollingContainer() { ViewParent p = getParent(); while (p != null && p instanceof ViewGroup) { if (((ViewGroup) p).shouldDelayChildPressedState()) { return true; } p = p.getParent(); } return false; } /** * Remove the longpress detection timer. */ Loading
core/java/android/widget/AbsSeekBar.java +43 −10 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; public abstract class AbsSeekBar extends ProgressBar { private Drawable mThumb; Loading @@ -49,6 +50,10 @@ public abstract class AbsSeekBar extends ProgressBar { private static final int NO_ALPHA = 0xFF; private float mDisabledAlpha; private int mScaledTouchSlop; private float mTouchDownX; private boolean mIsDragging; public AbsSeekBar(Context context) { super(context); } Loading @@ -74,6 +79,8 @@ public abstract class AbsSeekBar extends ProgressBar { com.android.internal.R.styleable.Theme, 0, 0); mDisabledAlpha = a.getFloat(com.android.internal.R.styleable.Theme_disabledAlpha, 0.5f); a.recycle(); mScaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } /** Loading Loading @@ -324,20 +331,42 @@ public abstract class AbsSeekBar extends ProgressBar { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (isInScrollingContainer()) { mTouchDownX = event.getX(); } else { setPressed(true); onStartTrackingTouch(); trackTouchEvent(event); attemptClaimDrag(); } break; case MotionEvent.ACTION_MOVE: if (mIsDragging) { trackTouchEvent(event); } else { final float x = event.getX(); if (Math.abs(x - mTouchDownX) > mScaledTouchSlop) { setPressed(true); onStartTrackingTouch(); trackTouchEvent(event); attemptClaimDrag(); } } break; case MotionEvent.ACTION_UP: if (mIsDragging) { trackTouchEvent(event); onStopTrackingTouch(); setPressed(false); } else { // Touch up when we never crossed the touch slop threshold should // be interpreted as a tap-seek to that location. onStartTrackingTouch(); trackTouchEvent(event); onStopTrackingTouch(); } // ProgressBar doesn't know to repaint the thumb drawable // in its inactive state when the touch stops (because the // value has not apparently changed) Loading @@ -345,8 +374,10 @@ public abstract class AbsSeekBar extends ProgressBar { break; case MotionEvent.ACTION_CANCEL: if (mIsDragging) { onStopTrackingTouch(); setPressed(false); } invalidate(); // see above explanation break; } Loading Loading @@ -388,6 +419,7 @@ public abstract class AbsSeekBar extends ProgressBar { * This is called when the user has started touching this widget. */ void onStartTrackingTouch() { mIsDragging = true; } /** Loading @@ -395,6 +427,7 @@ public abstract class AbsSeekBar extends ProgressBar { * canceled. */ void onStopTrackingTouch() { mIsDragging = false; } /** Loading
core/java/android/widget/SeekBar.java +2 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class SeekBar extends AbsSeekBar { @Override void onStartTrackingTouch() { super.onStartTrackingTouch(); if (mOnSeekBarChangeListener != null) { mOnSeekBarChangeListener.onStartTrackingTouch(this); } Loading @@ -111,6 +112,7 @@ public class SeekBar extends AbsSeekBar { @Override void onStopTrackingTouch() { super.onStopTrackingTouch(); if (mOnSeekBarChangeListener != null) { mOnSeekBarChangeListener.onStopTrackingTouch(this); } Loading