Search in sources :

Example 1 with ScrollingView

use of androidx.core.view.ScrollingView in project SmoothRefreshLayout by dkzwm.

the class ScrollCompat method isScrollingView.

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;
    }
}
Also used : NestedScrollView(androidx.core.widget.NestedScrollView) ScrollView(android.widget.ScrollView) ScrollingView(androidx.core.view.ScrollingView) AbsListView(android.widget.AbsListView) RecyclerView(androidx.recyclerview.widget.RecyclerView) StaggeredGridLayoutManager(androidx.recyclerview.widget.StaggeredGridLayoutManager) WebView(android.webkit.WebView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

WebView (android.webkit.WebView)1 AbsListView (android.widget.AbsListView)1 ScrollView (android.widget.ScrollView)1 ScrollingView (androidx.core.view.ScrollingView)1 NestedScrollView (androidx.core.widget.NestedScrollView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 StaggeredGridLayoutManager (androidx.recyclerview.widget.StaggeredGridLayoutManager)1