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

The following examples show how to use android.support.v4.view.ViewCompat#stopNestedScroll() . 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: FixAppBarLayoutBehavior.java    From CameraBlur with Apache License 2.0 5 votes vote down vote up
private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
    if (type == ViewCompat.TYPE_NON_TOUCH) {
        final int currOffset = getTopAndBottomOffset();
        if ((dy < 0 && currOffset == 0)
                || (dy > 0 && currOffset == -child.getTotalScrollRange())) {
            ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
        }
    }
}
 
Example 2
Source File: FixAppBarLayoutBehavior.java    From px-android with MIT License 5 votes vote down vote up
private void stopNestedScrollIfNeeded(final int dy,
    @NonNull final AppBarLayout child,
    @NonNull final View target, final int type) {

    if (type == ViewCompat.TYPE_NON_TOUCH) {
        final int currOffset = getTopAndBottomOffset();
        if ((dy < 0 && currOffset == 0)
            || (dy > 0 && currOffset == -child.getTotalScrollRange())) {
            ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
        }
    }
}
 
Example 3
Source File: FixAppBarLayoutBehavior.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
    if (type == ViewCompat.TYPE_NON_TOUCH) {
        final int currOffset = getTopAndBottomOffset();
        if ((dy < 0 && currOffset == 0)
                || (dy > 0 && currOffset == -child.getTotalScrollRange())) {
            ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
        }
    }
}
 
Example 4
Source File: NestedChildHelper.java    From customview-samples with Apache License 2.0 3 votes vote down vote up
/**
 * Enable nested scrolling.
 *
 * <p>This is a delegate method. Call it from your {@link android.view.View View} subclass
 * method/{@link android.support.v4.view.NestedScrollingChild} interface method with the same
 * signature to implement the standard policy.</p>
 *
 * @param enabled true to enable nested scrolling dispatch from this view, false otherwise
 */
public void setNestedScrollingEnabled(boolean enabled) {
    if (mIsNestedScrollingEnabled) {
        ViewCompat.stopNestedScroll(mView);
    }
    mIsNestedScrollingEnabled = enabled;
}
 
Example 5
Source File: NestedChildHelper.java    From customview-samples with Apache License 2.0 2 votes vote down vote up
/**
 * View subclasses should always call this method on their
 * <code>NestedScrollingChildHelper</code> when detached from a window.
 *
 * <p>This is a delegate method. Call it from your {@link android.view.View View} subclass
 * method/{@link android.support.v4.view.NestedScrollingChild} interface method with the same
 * signature to implement the standard policy.</p>
 */
public void onDetachedFromWindow() {
    ViewCompat.stopNestedScroll(mView);
}
 
Example 6
Source File: NestedChildHelper.java    From customview-samples with Apache License 2.0 2 votes vote down vote up
/**
 * Called when a nested scrolling child stops its current nested scroll operation.
 *
 * <p>This is a delegate method. Call it from your {@link android.view.View View} subclass
 * method/{@link android.support.v4.view.NestedScrollingChild} interface method with the same
 * signature to implement the standard policy.</p>
 *
 * @param child Child view stopping its nested scroll. This may not be a direct child view.
 */
public void onStopNestedScroll(@NonNull View child) {
    ViewCompat.stopNestedScroll(mView);
}