Java Code Examples for androidx.core.view.ViewCompat#SCROLL_AXIS_VERTICAL

The following examples show how to use androidx.core.view.ViewCompat#SCROLL_AXIS_VERTICAL . 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: ScrollAwareFABBehavior.java    From FlexibleAdapter with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout,
                                   @NonNull final FloatingActionButton child,
                                   @NonNull final View directTargetChild,
                                   @NonNull final View target,
                                   final int nestedScrollAxes,
                                   final int type) {
    // Ensure we react to vertical scrolling
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
            || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes, type);
}
 
Example 2
Source File: DynamicFABScrollBehavior.java    From dynamic-support with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
        @NonNull View child, @NonNull View directTargetChild,
        @NonNull View target, int nestedScrollAxes, final int type) {
    // Ensure we react to vertical scrolling.
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
            || super.onStartNestedScroll(coordinatorLayout, child,
            directTargetChild, target, nestedScrollAxes, type);
}
 
Example 3
Source File: FabScrollBehavior.java    From XposedSmsCode with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
                                   @NonNull FloatingActionButton child,
                                   @NonNull View directTargetChild,
                                   @NonNull View target, int axes, int type) {
    // Ensure we react to vertical scrolling
    return type == ViewCompat.TYPE_TOUCH && axes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 4
Source File: BothWaySwipeRefreshLayout.java    From Mysplash with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int nestedScrollAxes) {
    return isEnabled()
            && !mReturningToStart && !mRefreshing && !mLoading
            && (mRefreshEnabled || mLoadEnabled)
            && (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
}
 
Example 5
Source File: HideTopViewOnScrollBehavior.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(
    CoordinatorLayout coordinatorLayout,
    V child,
    View directTargetChild,
    View target,
    int nestedScrollAxes) {
  return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 6
Source File: BottomSheetBehavior.java    From bottomsheetrecycler with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(
        @NonNull CoordinatorLayout coordinatorLayout,
        @NonNull V child,
        @NonNull View directTargetChild,
        @NonNull View target,
        int axes,
        int type) {
    lastNestedScrollDy = 0;
    nestedScrolled = false;
    return (axes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
}
 
Example 7
Source File: ScrollAwareFABBehavior.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
                                   FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
            super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
                    nestedScrollAxes);
}
 
Example 8
Source File: HideBottomViewOnScrollBehavior.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(
    @NonNull CoordinatorLayout coordinatorLayout,
    @NonNull V child,
    @NonNull View directTargetChild,
    @NonNull View target,
    int nestedScrollAxes,
    int type) {
  return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 9
Source File: FABSpeedDialBehavior.java    From Kore with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
    //Make sure we respond to vertical scroll events
    return axes == ViewCompat.SCROLL_AXIS_VERTICAL ||
           super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
                                     axes, type);
}
 
Example 10
Source File: NestedScrollingPhotoViewAttacher.java    From Mysplash with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (nestedScrollingAxes == ViewCompat.SCROLL_AXIS_NONE) {
        nestedScrollingAxes = Math.abs(dx) >= Math.abs(dy)
                ? ViewCompat.SCROLL_AXIS_HORIZONTAL
                : ViewCompat.SCROLL_AXIS_VERTICAL;
    }

    scrollX = (int) -dx;
    scrollY = (int) -dy;

    scrollConsumed[0] = scrollConsumed[1] = 0;
    if (nestedScrollingAxes == ViewCompat.SCROLL_AXIS_HORIZONTAL) {
        mImageView.dispatchNestedPreScroll(scrollX, 0, scrollConsumed,
                scrollOffsetInWindow, ViewCompat.TYPE_TOUCH);
        if (scrollConsumed[0] != 0 || scrollX == 0) {
            scrollConsumed[1] = scrollY;
        }
    } else {
        mImageView.dispatchNestedPreScroll(0, scrollY, scrollConsumed,
                scrollOffsetInWindow, ViewCompat.TYPE_TOUCH);
        if (scrollConsumed[1] != 0 || scrollY == 0) {
            scrollConsumed[0] = scrollX;
        }
    }

    scrollX -= scrollConsumed[0];
    scrollY -= scrollConsumed[1];

    nestedScrollingOffsetX += scrollOffsetInWindow[0];
    nestedScrollingOffsetY += scrollOffsetInWindow[1];

    if (mOnViewDragListener != null) {
        mOnViewDragListener.onDrag(-scrollX, -scrollY);
    }
    mSuppMatrix.postTranslate(-scrollX, -scrollY);
    float[] delta = checkAndDisplayMatrix();
    if (delta != null) {
        float consumedX = scrollX - delta[0];
        float consumedY = scrollY - delta[1];

        scrollX -= consumedX;
        scrollY -= consumedY;
        scrollConsumed[0] += consumedX;
        scrollConsumed[1] += consumedY;
    }

    if (nestedScrollingAxes == ViewCompat.SCROLL_AXIS_HORIZONTAL) {
        mImageView.dispatchNestedScroll(scrollConsumed[0], scrollConsumed[1], scrollX, 0,
                scrollOffsetInWindow, ViewCompat.TYPE_TOUCH);
    } else {
        mImageView.dispatchNestedScroll(scrollConsumed[0], scrollConsumed[1], 0, scrollY,
                scrollOffsetInWindow, ViewCompat.TYPE_TOUCH);
    }
    nestedScrollingOffsetX += scrollOffsetInWindow[0];
    nestedScrollingOffsetY += scrollOffsetInWindow[1];
}
 
Example 11
Source File: NestedScrollingParentView.java    From zone-sdk with MIT License 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
    Log.e(TAG, "onStartNestedScroll");
    return nestedScrollAxes== ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 12
Source File: NestedScrollView.java    From AndroidAnimationExercise with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
    return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
}
 
Example 13
Source File: SwipeBackCoordinatorLayout.java    From Mysplash with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes, int type) {
    super.onStartNestedScroll(child, target, nestedScrollAxes, type);
    isVerticalDragged = (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
    return type == ViewCompat.TYPE_TOUCH;
}
 
Example 14
Source File: FabAwareScrollBehavior.java    From materialistic with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
    // Ensure we react to vertical scrolling
    return axes == ViewCompat.SCROLL_AXIS_VERTICAL
            || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type);
}
 
Example 15
Source File: FloatingMusicMenu.java    From FloatingMusicMenu with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingMusicMenu child, View directTargetChild, View target, int nestedScrollAxes) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 16
Source File: FabScrollBehaviour.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 17
Source File: BottomSheet.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
    return !(nestedScrollChild != null && child != nestedScrollChild) &&
            !dismissed && allowNestedScroll && nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL && !canDismissWithSwipe();
}
 
Example 18
Source File: BottomNavBehaviour.java    From WanAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
    return axes == ViewCompat.SCROLL_AXIS_VERTICAL;//表示只接受垂直方向的滑动
}
 
Example 19
Source File: BottomNavigationBehavior.java    From Hentoid with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull BottomNavigationView child, @NonNull View directTargetChild, @NonNull View target, int nestedScrollAxes, @ViewCompat.NestedScrollType int type) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
 
Example 20
Source File: ScrollAwareFabBehavior.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
                                   View directTargetChild, View target, int nestedScrollAxes) {
    return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}