androidoverscroll

OverScrollDecoratorHelper get onOverScrollUpdate callback from view


I'm using "me.everything:overscroll-decor-android:1.0.4". Can I get offset value from image view, that i trying to swipe down? Documentation says
OverScrollDecoratorHelper.setUpStaticOverScroll(view, OverScrollDecoratorHelper.ORIENTATION_VERTICAL); My code is

@BindView(R.id.swipeDownImgV)
ImageView swipeDownImgV;


@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.no_orders_fragment, container, false);
    ButterKnife.bind(this, view);

    setUpSwipeListener();

    return view;
}

private void setUpSwipeListener() {

    OverScrollDecoratorHelper.setUpStaticOverScroll(swipeDownImgV, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
            .setOverScrollUpdateListener(new IOverScrollUpdateListener() {
                @Override
                public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) {
                    Log.d(Tag.SWIPE, offset + " offset");
                }
            });

But it has no effect, what I do wrong? Thanks!


Solution

  • Solved! Need just put image in ScrollView

     <ScrollView
        android:id="@+id/swipeDownContainerScrlV"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">
    
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/v16dp"
            android:rotation="-90"
            android:src="@drawable/no_order_swipe_arrow"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </ScrollView>
    

    D/SWIPE: 2.3315098 offset

    D/SWIPE: 5.9953127 offset

    D/SWIPE: 8.992973 offset

    D/SWIPE: 10.325269 offset

    D/SWIPE: 11.990633 offset