androidx.core.view.NestedScrollingChild Java Examples

The following examples show how to use androidx.core.view.NestedScrollingChild. 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: ViewUtil.java    From NCalendar with Apache License 2.0 5 votes vote down vote up
private static void traverseView(View view) throws ViewException {
    if (view instanceof NestedScrollingChild && isViewVisible(view)) {
        throw new ViewException(view);
    } else if (view instanceof ViewGroup) {
        int childCount = ((ViewGroup) view).getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = ((ViewGroup) view).getChildAt(i);
            if (childAt instanceof NestedScrollingChild && isViewVisible(childAt)) {
                throw new ViewException(childAt);
            } else {
                traverseView(childAt);
            }
        }
    }
}
 
Example #2
Source File: BottomSheetBehaviorGoogleMapsLike.java    From CustomBottomSheetBehavior with Apache License 2.0 5 votes vote down vote up
private View findScrollingChild(View view) {
    if (view instanceof NestedScrollingChild) {
        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: AppBarLayout.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Nullable
private View findFirstScrollingChild(@NonNull CoordinatorLayout parent) {
  for (int i = 0, z = parent.getChildCount(); i < z; i++) {
    final View child = parent.getChildAt(i);
    if (child instanceof NestedScrollingChild
        || child instanceof ListView
        || child instanceof ScrollView) {
      return child;
    }
  }
  return null;
}