Android-ObservableScrollView icon indicating copy to clipboard operation
Android-ObservableScrollView copied to clipboard

if you scroll up quickly, it will scroll back bottom rather than show toolbar

Open zhonglushu opened this issue 8 years ago • 4 comments

After I scroll down bottom, I want to scroll up top, and I scroll up very quickly, then I found scroller will scroll up top but not show toolbar, and it will scroll back from top to bottom.

zhonglushu avatar Oct 19 '15 02:10 zhonglushu

this happens for me too! when I fling quickly to the top, my header image suddenly appears at the bottom where it shouldn't be appearing

here's my scroll callback, I thought maybe I'm doing something wrong here:

 new ObservableScrollViewCallbacks(){
    @Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging){
        //if (!layout_ready) return;

        float coeff = getFloat(scrollY / (float) title_container.getTop(), 0, 1);
        pinned_background.setAlpha(coeff);
        bottom_shadow.setAlpha(pinned_background.getAlpha());
        header_image.setTranslationY(-scrollY);

        title.setAlpha(getFloat(1f - coeff, 0.9f, 1f));

        title_container.setTranslationY(
                getFloat(-scrollY, -(title_container.getTop()) + U.dp2px(10), 0));
        title_container.setTranslationX(-coeff * U.dp2px(25));

        pinned_background.setTranslationY(
                getFloat(-scrollY, -header_image.getHeight() + toolbar.getHeight(), 0));
        bottom_shadow.setTranslationY(pinned_background.getTranslationY());

        fab.setTranslationY(-scrollY);
    }

    @Override public void onDownMotionEvent(){

    }

    @Override public void onUpOrCancelMotionEvent(ScrollState scrollState){

    }
}

MohMah avatar Dec 16 '15 23:12 MohMah

I logged the scrollY parameter and yes it returns negative numbers sometimes when i fling fast!

E: onScrollChanged() called with: scrollY = [5516], firstScroll = [false], dragging = [true]
E: onScrollChanged() called with: scrollY = [5092], firstScroll = [false], dragging = [true]
E: onScrollChanged() called with: scrollY = [5070], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [4856], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [4578], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [4192], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [1939], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [-87], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [-1011], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [-1308], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [534], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [249], firstScroll = [false], dragging = [false]
E: onScrollChanged() called with: scrollY = [0], firstScroll = [false], dragging = [false]

MohMah avatar Dec 16 '15 23:12 MohMah

I'm facing the same problem here!! Any updates ??

MikePetitfils avatar Feb 22 '16 14:02 MikePetitfils

I switched to RecyclerView's own onScrollListener and everything worked smoothly, you should too.

MohMah avatar Feb 23 '16 05:02 MohMah