List of usage examples for android.support.v4.view ScrollingView computeVerticalScrollOffset
int computeVerticalScrollOffset();
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.
From source file:com.callba.phone.widget.refreshlayout.RefreshLayout.java
/** * @return {@code true} if child view almost scroll to bottom. *//* w ww . ja v a 2s .c o m*/ public boolean isAlmostBottom() { if (mTarget instanceof AbsListView) { final AbsListView absListView = (AbsListView) mTarget; return absListView.getLastVisiblePosition() >= absListView.getCount() - 1; } else if (mTarget instanceof ScrollingView) { final ScrollingView scrollingView = (ScrollingView) mTarget; final int offset = scrollingView.computeVerticalScrollOffset(); final int range = scrollingView.computeVerticalScrollRange() - scrollingView.computeVerticalScrollExtent(); return offset >= range; } else { return !ViewCompat.canScrollVertically(mTarget, 1); } }
From source file:com.hippo.refreshlayout.RefreshLayout.java
/** * @return {@code true} if child view almost scroll to bottom. *//*from w w w.j ava 2 s . c o m*/ public boolean isAlmostBottom() { if (null == mTarget) { return false; } if (mTarget instanceof AbsListView) { final AbsListView absListView = (AbsListView) mTarget; return absListView.getLastVisiblePosition() >= absListView.getCount() - 1; } else if (mTarget instanceof ScrollingView) { final ScrollingView scrollingView = (ScrollingView) mTarget; final int offset = scrollingView.computeVerticalScrollOffset(); final int range = scrollingView.computeVerticalScrollRange() - scrollingView.computeVerticalScrollExtent(); return offset >= range; } else { return !ViewCompat.canScrollVertically(mTarget, 1); } }