List of usage examples for android.support.v4.view ScrollingView computeVerticalScrollExtent
int computeVerticalScrollExtent();
Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.
From source file:com.callba.phone.widget.refreshlayout.RefreshLayout.java
/** * @return {@code true} if child view almost scroll to bottom. */// w ww. j av a 2 s. 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. */// w w w.j av a 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); } }