Java Code Examples for android.support.v4.view.ViewCompat#isNestedScrollingEnabled()

The following examples show how to use android.support.v4.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: MyBottomBehavior.java    From OpenWeatherPlus-Android with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
View findScrollingChild(View view) {
    if (ViewCompat.isNestedScrollingEnabled(view)) {
        return view;
    } else {
        if (view instanceof ViewGroup) {
            ViewGroup group = (ViewGroup) view;
            int i = 0;

            for (int count = group.getChildCount(); i < count; ++i) {
                View scrollingChild = this.findScrollingChild(group.getChildAt(i));
                if (scrollingChild != null) {
                    return scrollingChild;
                }
            }
        }

        return null;
    }
}
 
Example 2
Source File: GoogleMapsBottomSheetBehavior.java    From Google-Maps-BottomSheet with The Unlicense 6 votes vote down vote up
@VisibleForTesting
private 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: QRefreshLayout.java    From QRefreshLayout with MIT License 5 votes vote down vote up
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
    if ((android.os.Build.VERSION.SDK_INT < 21 && viewTarget instanceof AbsListView) || (viewTarget != null && !ViewCompat.isNestedScrollingEnabled(viewTarget))) {
    } else {
        super.requestDisallowInterceptTouchEvent(b);
    }
}
 
Example 4
Source File: SmartRefreshLayout.java    From CollapsingRefresh 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
	View target = mRefreshContent.getScrollableView();
	if ((Build.VERSION.SDK_INT >= 21 || !(target instanceof AbsListView))
			&& (target == null || ViewCompat.isNestedScrollingEnabled(target))) {
		super.requestDisallowInterceptTouchEvent(b);
		//} else {
		// Nope.
	}
}
 
Example 5
Source File: ISwipeRefreshLayout.java    From AndroidUiKit 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 6
Source File: SwipeRefreshLayout.java    From letv with Apache License 2.0 5 votes vote down vote up
public void requestDisallowInterceptTouchEvent(boolean b) {
    if (VERSION.SDK_INT < 21 && (this.mTarget instanceof AbsListView)) {
        return;
    }
    if (this.mTarget == null || ViewCompat.isNestedScrollingEnabled(this.mTarget)) {
        super.requestDisallowInterceptTouchEvent(b);
    }
}
 
Example 7
Source File: SwipeRefreshLayout.java    From android-source-codes with Creative Commons Attribution 4.0 International 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 8
Source File: AbsRefreshLayout.java    From NestRefreshLayout with MIT License 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 && mTargetView instanceof AbsListView)
            || (mTargetView != null && !ViewCompat.isNestedScrollingEnabled(mTargetView))) {
        // Nope.
    } else {
        super.requestDisallowInterceptTouchEvent(b);
    }
}
 
Example 9
Source File: ChandelierLayout.java    From Chandelier with MIT License 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 || !(target instanceof AbsListView))
      && (target == null || ViewCompat.isNestedScrollingEnabled(target))) {
    super.requestDisallowInterceptTouchEvent(b);
  }
}
 
Example 10
Source File: TempGraphFragment.java    From octoandroid with GNU General Public License v3.0 4 votes vote down vote up
private void toggleLock() {
    mListener.setSwipeEnabled(!mListener.isSwipeEnabled());
    if (getView() == null) return;
    boolean isNestedScrollingEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isNestedScrollingEnabled);
}
 
Example 11
Source File: ConsoleFragment.java    From octoandroid with GNU General Public License v3.0 4 votes vote down vote up
private void updateLockIcon(@NonNull MenuItem menuItem) {
    if (getView() == null) return;
    boolean isEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    menuItem.setTitle(isEnabled ? UNLOCK : LOCK);
    menuItem.setIcon(isEnabled ? mUnlockDrawable : mLockDrawable);
}
 
Example 12
Source File: ConsoleFragment.java    From octoandroid with GNU General Public License v3.0 4 votes vote down vote up
private void toggleLock() {
    if (getView() == null) return;
    boolean isEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isEnabled);
}