Back to project page FloatingActionButton.
The source code is released under:
MIT License
If you think the Android project FloatingActionButton listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.melnykov.fab; /*from www . ja va 2 s . c om*/ import android.widget.ScrollView; abstract class ScrollViewScrollDetector implements ObservableScrollView.OnScrollChangedListener { private int mLastScrollY; private int mScrollThreshold; abstract void onScrollUp(); abstract void onScrollDown(); @Override public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) { boolean isSignificantDelta = Math.abs(t - mLastScrollY) > mScrollThreshold; if (isSignificantDelta) { if (t > mLastScrollY) { onScrollUp(); } else { onScrollDown(); } } mLastScrollY = t; } public void setScrollThreshold(int scrollThreshold) { mScrollThreshold = scrollThreshold; } }