Java 类android.support.v4.view.NestedScrollingChild 实例源码

项目:GitHub    文件:RefreshContentWrapper.java   
protected View findScrollableViewInternal(View content, boolean selfable) {
    View scrollableView = null;
    Queue<View> views = new LinkedBlockingQueue<>(Collections.singletonList(content));
    while (!views.isEmpty() && scrollableView == null) {
        View view = views.poll();
        if (view != null) {
            if ((selfable || view != content) && (view instanceof AbsListView
                    || view instanceof ScrollView
                    || view instanceof ScrollingView
                    || view instanceof NestedScrollingChild
                    || view instanceof NestedScrollingParent
                    || view instanceof WebView
                    || view instanceof ViewPager)) {
                scrollableView = view;
            } else if (view instanceof ViewGroup) {
                ViewGroup group = (ViewGroup) view;
                for (int j = 0; j < group.getChildCount(); j++) {
                    views.add(group.getChildAt(j));
                }
            }
        }
    }
    return scrollableView;
}
项目:GitHub    文件:RefreshContentWrapper.java   
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
    super.setPrimaryItem(container, position, object);
    if (object instanceof View) {
        mScrollableView = ((View) object);
    } else if (object instanceof Fragment) {
        mScrollableView = ((Fragment) object).getView();
    }
    if (mScrollableView != null) {
        mScrollableView = findScrollableViewInternal(mScrollableView, true);
        if (mScrollableView instanceof NestedScrollingParent
                && !(mScrollableView instanceof NestedScrollingChild)) {
            mScrollableView = findScrollableViewInternal(mScrollableView, false);
        }
    }
}
项目:Rxjava2.0Demo    文件:RefreshContentWrapper.java   
protected void findScrollableView(View content, RefreshKernel kernel) {
    mScrollableView = null;
    while (mScrollableView == null || (mScrollableView instanceof NestedScrollingParent
            && !(mScrollableView instanceof NestedScrollingChild))) {
        content = findScrollableViewInternal(content, mScrollableView == null);
        if (content == mScrollableView) {
            break;
        }
        try {//try 不能删除,不然会出现兼容性问题
            if (content instanceof CoordinatorLayout) {
                kernel.getRefreshLayout().setEnableNestedScroll(false);
                wrapperCoordinatorLayout(((CoordinatorLayout) content), kernel.getRefreshLayout());
            }
        } catch (Throwable ignored) {
        }
        mScrollableView = content;
    }
}
项目:SmartRefresh    文件:RefreshContentWrapper.java   
private View findScrollableViewInternal(View content, boolean selfable) {
    View scrollableView = null;
    Queue<View> views = new LinkedBlockingQueue<>(Collections.singletonList(content));
    while (!views.isEmpty() && scrollableView == null) {
        View view = views.poll();
        if (view != null) {
            if ((selfable || view != content) && (view instanceof AbsListView
                    || view instanceof ScrollView
                    || view instanceof ScrollingView
                    || view instanceof NestedScrollingChild
                    || view instanceof NestedScrollingParent
                    || view instanceof WebView
                    || view instanceof ViewPager)) {
                scrollableView = view;
            } else if (view instanceof ViewGroup) {
                ViewGroup group = (ViewGroup) view;
                for (int j = 0; j < group.getChildCount(); j++) {
                    views.add(group.getChildAt(j));
                }
            }
        }
    }
    return scrollableView;
}
项目:SmartRefresh    文件:RefreshContentWrapper.java   
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
    super.setPrimaryItem(container, position, object);
    if (object instanceof View) {
        mScrollableView = ((View) object);
    } else if (object instanceof Fragment) {
        mScrollableView = ((Fragment) object).getView();
    }
    if (mScrollableView != null) {
        mScrollableView = findScrollableViewInternal(mScrollableView, true);
        if (mScrollableView instanceof NestedScrollingParent
                && !(mScrollableView instanceof NestedScrollingChild)) {
            mScrollableView = findScrollableViewInternal(mScrollableView, false);
        }
    }
}
项目:boohee_v5.6    文件:BottomSheetBehavior.java   
private View findScrollingChild(View view) {
    if (view instanceof NestedScrollingChild) {
        return view;
    }
    if (view instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) view;
        int count = group.getChildCount();
        for (int i = 0; i < count; i++) {
            View scrollingChild = findScrollingChild(group.getChildAt(i));
            if (scrollingChild != null) {
                return scrollingChild;
            }
        }
    }
    return null;
}
项目:SmartRefreshLayout    文件:RefreshContentWrapper.java   
protected void findScrollableView(View content, RefreshKernel kernel) {
    mScrollableView = null;
    while (mScrollableView == null || (mScrollableView instanceof NestedScrollingParent
            && !(mScrollableView instanceof NestedScrollingChild))) {
        content = findScrollableViewInternal(content, mScrollableView == null);
        if (content == mScrollableView) {
            break;
        }
        try {//try 不能删除,不然会出现兼容性问题
            if (content instanceof CoordinatorLayout) {
                kernel.getRefreshLayout().setEnableNestedScroll(false);
                wrapperCoordinatorLayout(((ViewGroup) content), kernel.getRefreshLayout());
            }
        } catch (Throwable ignored) {
        }
        mScrollableView = content;
    }
}
项目:Rxjava2.0Demo    文件:RefreshContentWrapper.java   
protected boolean isScrollableView(View view) {
    return view instanceof AbsListView
            || view instanceof ScrollView
            || view instanceof ScrollingView
            || view instanceof NestedScrollingChild
            || view instanceof NestedScrollingParent
            || view instanceof WebView
            || view instanceof ViewPager;
}
项目:garras    文件:AnchorSheetBehavior.java   
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;
}
项目:SmartRefresh    文件:RefreshContentWrapper.java   
private void findScrollableView(View content) {
    mScrollableView = findScrollableViewInternal(content, true);
    if (mScrollableView instanceof NestedScrollingParent
            && !(mScrollableView instanceof NestedScrollingChild)) {
        mScrollableView = findScrollableViewInternal(mScrollableView, false);
    }
    if (mScrollableView instanceof ViewPager) {
        wrapperViewPager((ViewPager) this.mScrollableView);
    }
    if (mScrollableView == null) {
        mScrollableView = content;
    }
}
项目:Paper-Launcher    文件:BottomSheetBehaviorV2.java   
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;
}
项目:SmartRefreshLayout    文件:RefreshContentWrapper.java   
protected boolean isScrollableView(View view) {
    return view instanceof AbsListView
            || view instanceof ScrollView
            || view instanceof ScrollingView
            || view instanceof NestedScrollingChild
            || view instanceof NestedScrollingParent
            || view instanceof WebView
            || view instanceof ViewPager;
}
项目:Nibo    文件:BottomSheetBehaviorGoogleMapsLike.java   
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;
}
项目:AnchorSheetBehavior    文件:AnchorSheetBehavior.java   
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;
}
项目:AndroidTopSheet    文件:TopSheetBehavior.java   
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;
}
项目:grooo    文件:BottomSheetAnchorBehavior.java   
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;
}
项目:NestedScroll    文件:GoldScrollView.java   
private void analyNestedScrollingChildViews() {
    View localView1 = getChildAt(0);
    if ((localView1 == null) || (!(localView1 instanceof ViewGroup)))
        throw new IllegalArgumentException("EmbeddedScrollView root child illegal");
    this.scrollingChildList = new ArrayList();
    ViewGroup localViewGroup = (ViewGroup) localView1;
    for (int i = 0; i < localViewGroup.getChildCount(); i++) {
        View localView2 = localViewGroup.getChildAt(i);
        if ((localView2 instanceof NestedScrollingChild))
            this.scrollingChildList.add(localView2);
    }
}
项目:NestedScroll    文件:EmbeddedScrollView.java   
private void analyNestedScrollingChildViews() {
    View localView1 = getChildAt(0);
    if ((localView1 == null) || (!(localView1 instanceof ViewGroup)))
        throw new IllegalArgumentException("EmbeddedScrollView root child illegal");
    this.scrollingChildList = new ArrayList();
    ViewGroup localViewGroup = (ViewGroup) localView1;
    for (int i = 0; i < localViewGroup.getChildCount(); i++) {
        View localView2 = localViewGroup.getChildAt(i);
        if ((localView2 instanceof NestedScrollingChild))
            this.scrollingChildList.add(localView2);
    }
}
项目:Google-Maps-BottomSheet    文件:GoogleMapsBottomSheetBehavior.java   
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;
}
项目:react-native-bottom-sheet-behavior    文件:RNBottomSheetBehavior.java   
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;
}
项目:AndroidSweetBehavior    文件:SheetBehavior.java   
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;
}
项目:RRFramework-Android    文件:RefreshLayout.java   
/**
 * 通过id得到相应的view
 */
@Override
protected void onFinishInflate() {

    final int childCount = getChildCount();

    if (childCount > 0) {
        mHeaderView = findViewById(R.id.refresh_header_view);
        mContentView = findViewById(R.id.recyclerview);
        mFooterView = findViewById(R.id.refresh_footer_view);
        mScrollView = findViewById(R.id.refresh_scroll_view);
    }

    if (mContentView == null) {
        throw new IllegalStateException("mContentView is null");
    }

    if (mIsCoo) {
        if (mContentView instanceof CoordinatorLayout) {

            CoordinatorLayout coo = (CoordinatorLayout) mContentView;

            mAppBar = (AppBarLayout) coo.getChildAt(0);


            setAppBarListener();

        } else {
            throw new IllegalStateException("mContentView is not CoordinatorLayout");
        }

        if (mScrollView == null) {
            throw new IllegalStateException("mScrollView is null");
        }

        if (mScrollView instanceof ViewPager) {

            mViewPager = (ViewPager) mScrollView;
            mIsViewPager = true;

        } else if (mScrollView instanceof NestedScrollingChild) {

            mIsViewPager = false;

        } else {
            throw new IllegalStateException("mScrollView is not NestedScrollingChild or ViewPager");
        }
    }

    if (mHeaderView != null && !(mHeaderView instanceof IRefresh)) {

        throw new IllegalStateException("mHeaderView  error");
    }
    if (mFooterView != null && !(mFooterView instanceof IRefresh)) {

        throw new IllegalStateException("mFooterView error");
    }

    if (mHeaderView != null) {

        getHeaderInterface().setIsHeaderOrFooter(true);
    }

    if (mFooterView != null) {

        getFooterInterface().setIsHeaderOrFooter(false);
    }


    super.onFinishInflate();


    setStyle(mHeadStyle, mFootStyle);

}
项目:Android-sticky-navigation-layout    文件:NestedScrollFactory.java   
/**
 * create the nested scroll helper.
 * @param target  the target view
 * @param sensitivity Multiplier for how sensitive the helper should be about detecting
 *                    the start of a drag. Larger values are more sensitive. 1.0f is normal.
 * @param scroller  the scroller
 * @param child the NestedScrollingChild.
 * @param callback the callback
 */
public static NestedScrollHelper create(View target, float sensitivity, OverScroller scroller, NestedScrollingChild child,
                                  NestedScrollHelper.NestedScrollCallback callback) {
    return new NestedScrollHelper(target , sensitivity, scroller, child , callback);
}
项目:Android-sticky-navigation-layout    文件:NestedScrollFactory.java   
/**
 * create the nested scroll helper, but the target view must implements {@link NestedScrollingChild}.
 * @param target  the target view
 * @param scroller  the scroller
 * @param callback the callback
 */
public static NestedScrollHelper create(View target, OverScroller scroller, NestedScrollHelper.NestedScrollCallback callback) {
    return new NestedScrollHelper(target , 1, scroller, (NestedScrollingChild) target, callback);
}
项目:Android-sticky-navigation-layout    文件:NestedScrollFactory.java   
/**
 * create the nested scroll helper, use default {@link OverScroller} , but the target view must implements {@link NestedScrollingChild}.
 * @param target  the target view
 * @param callback the callback
 */
public static NestedScrollHelper create(View target, NestedScrollHelper.NestedScrollCallback callback) {
    return new NestedScrollHelper(target , 1, new OverScroller(target.getContext()), (NestedScrollingChild) target, callback);
}
项目:Android-sticky-navigation-layout    文件:NestedScrollHelper.java   
/**
 * create the nested scroll helper. But,the target view must implements interface {@link NestedScrollingChild}.
 * @param target  the target view
 * @param scroller  the scroller
 * @param callback the callback
 */
public NestedScrollHelper(View target, OverScroller scroller, NestedScrollCallback callback) {
    this(target, 1, scroller, (NestedScrollingChild) target, callback);
}
项目:Android-sticky-navigation-layout    文件:NestedScrollHelper.java   
/**
 * create the nested scroll helper.
 * @param target  the target view
 * @param sensitivity Multiplier for how sensitive the helper should be about detecting
 *                    the start of a drag. Larger values are more sensitive. 1.0f is normal.
 * @param scroller  the scroller
 * @param child the NestedScrollingChild.
 * @param callback the callback
 */
public NestedScrollHelper(View target, float sensitivity, OverScroller scroller, NestedScrollingChild child, NestedScrollCallback callback) {
    super(target, sensitivity, scroller, callback);
    Util.check(child);
    this.mNestedChild = child;
}
项目:-    文件:CanRefreshLayout.java   
/**
 * 通过id得到相应的view
 */
@Override
protected void onFinishInflate() {

    final int childCount = getChildCount();

    if (childCount > 0) {
        mHeaderView = findViewById(com.canyinghao.canrefresh.R.id.can_refresh_header);
        mContentView = findViewById(com.canyinghao.canrefresh.R.id.can_content_view);
        mFooterView = findViewById(com.canyinghao.canrefresh.R.id.can_refresh_footer);
        mScrollView = findViewById(com.canyinghao.canrefresh.R.id.can_scroll_view);
    }

    if (mContentView == null) {
        throw new IllegalStateException("mContentView is null");
    }

    if (mIsCoo) {
        if (mContentView instanceof CoordinatorLayout) {

            CoordinatorLayout coo = (CoordinatorLayout) mContentView;

            mAppBar = (AppBarLayout) coo.getChildAt(0);


            setAppBarListener();

        } else {
            throw new IllegalStateException("mContentView is not CoordinatorLayout");
        }

        if (mScrollView == null) {
            throw new IllegalStateException("mScrollView is null");
        }

        if (!(mScrollView instanceof NestedScrollingChild)) {
            throw new IllegalStateException("mScrollView is not NestedScrollingChild");
        }
    }

    if (mHeaderView != null && !(mHeaderView instanceof CanRefresh)) {

        throw new IllegalStateException("mHeaderView  error");
    }
    if (mFooterView != null && !(mFooterView instanceof CanRefresh)) {

        throw new IllegalStateException("mFooterView error");
    }

    if (mHeaderView != null) {

        getHeaderInterface().setIsHeaderOrFooter(true);
    }

    if (mFooterView != null) {

        getFooterInterface().setIsHeaderOrFooter(false);
    }


    super.onFinishInflate();


    setStyle(mHeadStyle, mFootStyle);

}
项目:CanRefresh    文件:CanRefreshLayout.java   
/**
 * 通过id得到相应的view
 */
@Override
protected void onFinishInflate() {

    final int childCount = getChildCount();

    if (childCount > 0) {
        mHeaderView = findViewById(com.canyinghao.canrefresh.R.id.can_refresh_header);
        mContentView = findViewById(com.canyinghao.canrefresh.R.id.can_content_view);
        mFooterView = findViewById(com.canyinghao.canrefresh.R.id.can_refresh_footer);
        mScrollView = findViewById(com.canyinghao.canrefresh.R.id.can_scroll_view);
    }

    if (mContentView == null) {
        throw new IllegalStateException("mContentView is null");
    }

    if (mIsCoo) {
        if (mContentView instanceof CoordinatorLayout) {

            CoordinatorLayout coo = (CoordinatorLayout) mContentView;

            mAppBar = (AppBarLayout) coo.getChildAt(0);


            setAppBarListener();

        } else {
            throw new IllegalStateException("mContentView is not CoordinatorLayout");
        }

        if (mScrollView == null) {
            throw new IllegalStateException("mScrollView is null");
        }

        if (mScrollView instanceof ViewPager) {

            mViewPager = (ViewPager) mScrollView;
            mIsViewPager = true;

        } else if (mScrollView instanceof NestedScrollingChild) {

            mIsViewPager = false;

        } else {
            throw new IllegalStateException("mScrollView is not NestedScrollingChild or ViewPager");
        }
    }

    if (mHeaderView != null && !(mHeaderView instanceof CanRefresh)) {

        throw new IllegalStateException("mHeaderView  error");
    }
    if (mFooterView != null && !(mFooterView instanceof CanRefresh)) {

        throw new IllegalStateException("mFooterView error");
    }

    if (mHeaderView != null) {

        getHeaderInterface().setIsHeaderOrFooter(true);
    }

    if (mFooterView != null) {

        getFooterInterface().setIsHeaderOrFooter(false);
    }


    super.onFinishInflate();


    setStyle(mHeadStyle, mFootStyle);

}