android.support.v4.view.ViewCompat#isNestedScrollingEnabled ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#isNestedScrollingEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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;
    }
}
 
@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;
}
 
源代码3 项目: QRefreshLayout   文件: QRefreshLayout.java
@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);
    }
}
 
源代码4 项目: CollapsingRefresh   文件: SmartRefreshLayout.java
@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.
	}
}
 
源代码5 项目: AndroidUiKit   文件: ISwipeRefreshLayout.java
@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);
    }
}
 
源代码6 项目: letv   文件: SwipeRefreshLayout.java
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);
    }
}
 
源代码7 项目: android-source-codes   文件: SwipeRefreshLayout.java
@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);
    }
}
 
源代码8 项目: NestRefreshLayout   文件: AbsRefreshLayout.java
@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);
    }
}
 
源代码9 项目: Chandelier   文件: ChandelierLayout.java
@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);
  }
}
 
源代码10 项目: octoandroid   文件: TempGraphFragment.java
private void toggleLock() {
    mListener.setSwipeEnabled(!mListener.isSwipeEnabled());
    if (getView() == null) return;
    boolean isNestedScrollingEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isNestedScrollingEnabled);
}
 
源代码11 项目: octoandroid   文件: ConsoleFragment.java
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);
}
 
源代码12 项目: octoandroid   文件: ConsoleFragment.java
private void toggleLock() {
    if (getView() == null) return;
    boolean isEnabled = ViewCompat.isNestedScrollingEnabled(getView());
    ViewCompat.setNestedScrollingEnabled(getView(), !isEnabled);
}
 
 同类方法