androidx.core.view.ScrollingView Java Examples

The following examples show how to use androidx.core.view.ScrollingView. 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: ScrollCompat.java    From SmoothRefreshLayout with MIT License 6 votes vote down vote up
public static boolean isScrollingView(View view) {
    if (view instanceof AbsListView || view instanceof ScrollView || view instanceof WebView) {
        return true;
    }
    if (ViewCatcherUtil.isRecyclerView(view)) {
        RecyclerView recyclerView = (RecyclerView) view;
        RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
        if (manager != null) {
            if (manager instanceof LinearLayoutManager) {
                LinearLayoutManager linearManager = ((LinearLayoutManager) manager);
                return linearManager.getOrientation() == RecyclerView.VERTICAL;
            } else if (manager instanceof StaggeredGridLayoutManager) {
                StaggeredGridLayoutManager gridLayoutManager =
                        (StaggeredGridLayoutManager) manager;
                return gridLayoutManager.getOrientation() == RecyclerView.VERTICAL;
            }
        }
        return true;
    } else {
        return view instanceof ScrollingView;
    }
}