Java Code Examples for androidx.core.view.ViewCompat#isNestedScrollingEnabled()

The following examples show how to use androidx.core.view.ViewCompat#isNestedScrollingEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BottomSheetBehavior.java    From bottomsheetrecycler with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
View findScrollingChild(View view) {
    if (ViewCompat.isNestedScrollingEnabled(view)) {
        return view;
    }
    if (view instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) view;
        for (int i = 0, count = group.getChildCount(); i < count; i++) {
            View scrollingChild = findScrollingChild(group.getChildAt(i));
            if (scrollingChild != null) {
                return scrollingChild;
            }
        }
    }
    return null;
}
 
Example 2
Source File: BottomSheetBehavior.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
@Nullable
@VisibleForTesting
View findScrollingChild(View view) {
  if (ViewCompat.isNestedScrollingEnabled(view)) {
    return view;
  }
  if (view instanceof ViewGroup) {
    ViewGroup group = (ViewGroup) view;
    for (int i = 0, count = group.getChildCount(); i < count; i++) {
      View scrollingChild = findScrollingChild(group.getChildAt(i));
      if (scrollingChild != null) {
        return scrollingChild;
      }
    }
  }
  return null;
}
 
Example 3
Source File: BottomSheetBehavior.java    From Mysplash with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Nullable
@VisibleForTesting
View findScrollingChild(View view) {
    if (ViewCompat.isNestedScrollingEnabled(view)) {
        return view;
    }
    if (view instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) view;
        for (int i = 0, count = group.getChildCount(); i < count; i++) {
            View scrollingChild = findScrollingChild(group.getChildAt(i));
            if (scrollingChild != null) {
                return scrollingChild;
            }
        }
    }
    return null;
}
 
Example 4
Source File: CustomSwipeRefreshLayout.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
    // if this is a List < L or another view that doesn't support nested
    // scrolling, ignore this request so that the vertical scroll event
    // isn't stolen
    if ((android.os.Build.VERSION.SDK_INT < 21 && mTarget instanceof AbsListView)
            || (mTarget != null && !ViewCompat.isNestedScrollingEnabled(mTarget))) {
        // Nope.
    } else {
        super.requestDisallowInterceptTouchEvent(b);
    }
}
 
Example 5
Source File: BothWaySwipeRefreshLayout.java    From Mysplash with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
    if ((android.os.Build.VERSION.SDK_INT < 21 && mTarget instanceof AbsListView)
            || (mTarget != null && !ViewCompat.isNestedScrollingEnabled(mTarget))) {
        // do nothing.
    } else {
        super.requestDisallowInterceptTouchEvent(b);
    }
}