|
8 | 8 | import android.support.v4.view.NestedScrollingParent;
|
9 | 9 | import android.support.v4.view.NestedScrollingParentHelper;
|
10 | 10 | import android.support.v4.view.ViewCompat;
|
| 11 | +import android.support.v4.widget.SwipeRefreshLayout; |
11 | 12 | import android.util.AttributeSet;
|
12 | 13 | import android.util.DisplayMetrics;
|
13 | 14 | import android.util.Log;
|
@@ -239,10 +240,6 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
|
239 | 240 | // mInitialMotionY = mInitialDownY + mTouchSlop;
|
240 | 241 | mIsBeingDragged = !canChildScrollUp(yDiff);
|
241 | 242 |
|
242 |
| - if (shouldInterceptTouchEvent(ev)) { |
243 |
| - NativeGestureUtil.notifyNativeGestureStarted(this, ev); |
244 |
| - } |
245 |
| - |
246 | 243 | return mIsBeingDragged;
|
247 | 244 | }
|
248 | 245 | break;
|
@@ -295,16 +292,16 @@ private float getMotionEventY(MotionEvent ev, int activePointerId) {
|
295 | 292 | return MotionEventCompat.getY(ev, index);
|
296 | 293 | }
|
297 | 294 |
|
| 295 | + /** |
| 296 | + * {@link SwipeRefreshLayout} overrides {@link ViewGroup#requestDisallowInterceptTouchEvent} and |
| 297 | + * swallows it. This means that any component underneath SwipeRefreshLayout will now interact |
| 298 | + * incorrectly with Views that are above SwipeRefreshLayout. We fix that by transmitting the call |
| 299 | + * to this View's parents. |
| 300 | + */ |
298 | 301 | @Override
|
299 |
| - public void requestDisallowInterceptTouchEvent(boolean b) { |
300 |
| - // if this is a List < L or another view that doesn't support nested |
301 |
| - // scrolling, ignore this request so that the vertical scroll event |
302 |
| - // isn't stolen |
303 |
| - if ((android.os.Build.VERSION.SDK_INT < 21 && mTarget instanceof AbsListView) |
304 |
| - || (mTarget != null && !ViewCompat.isNestedScrollingEnabled(mTarget))) { |
305 |
| - // Nope. |
306 |
| - } else { |
307 |
| - super.requestDisallowInterceptTouchEvent(b); |
| 302 | + public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { |
| 303 | + if (getParent() != null) { |
| 304 | + getParent().requestDisallowInterceptTouchEvent(disallowIntercept); |
308 | 305 | }
|
309 | 306 | }
|
310 | 307 |
|
|
0 commit comments