List of usage examples for android.support.v4.view ScrollingView computeVerticalScrollRange
int computeVerticalScrollRange();
Compute the vertical range that the vertical scrollbar represents.
The range is expressed in arbitrary units that must be the same as the units used by #computeVerticalScrollExtent() and #computeVerticalScrollOffset() .
From source file:com.callba.phone.widget.refreshlayout.RefreshLayout.java
/** * @return {@code true} if child view almost scroll to bottom. */// www. ja v a2 s . com 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. */// www . j av a 2 s. c om 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); } }