本文整理汇总了Java中com.handmark.pulltorefresh.library.PullToRefreshBase.Mode.PULL_FROM_END属性的典型用法代码示例。如果您正苦于以下问题:Java Mode.PULL_FROM_END属性的具体用法?Java Mode.PULL_FROM_END怎么用?Java Mode.PULL_FROM_END使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.handmark.pulltorefresh.library.PullToRefreshBase.Mode
的用法示例。
在下文中一共展示了Mode.PULL_FROM_END属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onScrollStateChanged
public final void onScrollStateChanged(final AbsListView view, final int state) {
/**
* Check that the scrolling has stopped, and that the last item is
* visible.
*/
if (state == OnScrollListener.SCROLL_STATE_IDLE && null != mOnLastItemVisibleListener && mLastItemVisible) {
mOnLastItemVisibleListener.onLastItemVisible();
}
if (state == OnScrollListener.SCROLL_STATE_IDLE && !isRefreshing()
&& (getMode() == Mode.BOTH || getMode() == Mode.PULL_FROM_END)) {
hideLoadMoreView();
}
if (null != mOnScrollListener) {
mOnScrollListener.onScrollStateChanged(view, state);
}
//auto load
mCurrentScrollState = state;
}
示例2: onScroll
public final void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount,
final int totalItemCount) {
/**
* Set whether the Last Item is Visible. lastVisibleItemIndex is a
* zero-based index, so we minus one totalItemCount to check
*/
mLastItemVisible = (totalItemCount > 0) && (firstVisibleItem + visibleItemCount >= totalItemCount - 1);
if (DEBUG) {
Log.d(LOG_TAG, "First Visible: " + firstVisibleItem + ". Visible Count: " + visibleItemCount
+ ". Total Items:" + totalItemCount + " mLastItemVisible:" + mLastItemVisible);
}
// If we're showing the indicator, check positions...
if (getShowIndicatorInternal()) {
updateIndicatorViewsVisibility();
}
// Finally call OnScrollListener if we have one
if (null != mOnScrollListener) {
mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
//auto load
boolean loadMore = firstVisibleItem + visibleItemCount >= totalItemCount;
if(isRefreshing()) {
return;
}
if (DEBUG) {
Log.d(LOG_TAG, "loadMore:" + loadMore + " isAutoLoadMore:"
+ isAutoLoadMore() + " hasMore:" + hasMore()
+ " mCurrentScrollState:" + mCurrentScrollState);
}
if (isAutoLoadMore() && hasMore()
&& mCurrentScrollState != SCROLL_STATE_IDLE
&& (getMode() == Mode.BOTH || getMode() == Mode.PULL_FROM_END)
&& isTouchEvent()) {
if (mCurrentScrollState == SCROLL_STATE_TOUCH_SCROLL) {
showLoadMoreView();
}
if (loadMore && isShowLoadMoreView()) {
onLoadMore();
}
}
// intercept the listview
if(firstVisibleItem == 0 || (mLastItemVisible && !isAutoLoadMore())) {
view.getParent().requestDisallowInterceptTouchEvent(false);
requestDisallowInterceptTouchEvent();
}
}
示例3: loadPullLabel
/**
* Load labels of pull
* <br />Convert an {@code ptrPullLabel} attribute value to {@code mPullLabel} field if each value exists.
* <br />Or if not, then the pull label is assigned some string as default
* <br />If you want to set some custom pull label at sub class, you have to override this method and implement.
* NOTE : This method <b>Must</b> be modified if kinds of {@code Mode} are increased.
* @param context
* @param attrs
* @param mode
* @return String to be a pull label
*/
protected String loadPullLabel(Context context, TypedArray attrs, Mode mode) {
// Pull Label
if (attrs.hasValue(R.styleable.PullToRefresh_ptrPullLabel)) {
return attrs.getString(R.styleable.PullToRefresh_ptrPullLabel);
}
int stringId = (mode == Mode.PULL_FROM_END) ? R.string.pull_to_refresh_from_bottom_pull_label : R.string.pull_to_refresh_pull_label;
return context.getString(stringId);
}
示例4: loadRefreshingLabel
/**
* Load labels of refreshing
* <br />Convert an {@code ptrRefreshLabel} attribute value to {@code mRefreshingLabel} field if each value exists.
* <br />Or if not, then the refreshing label is assigned some string as default
* <br />If you want to set some custom refreshing label at sub class, you have to override this method and implement.
* NOTE : This method <b>Must</b> be modified if kinds of {@code Mode} are increased.
* @param context
* @param attrs
* @param mode
* @return String to be a refreshing label
*/
protected String loadRefreshingLabel(Context context, TypedArray attrs,
Mode mode) {
// Refresh Label
if (attrs.hasValue(R.styleable.PullToRefresh_ptrRefreshLabel)) {
return attrs.getString(R.styleable.PullToRefresh_ptrRefreshLabel);
}
int stringId = (mode == Mode.PULL_FROM_END) ? R.string.pull_to_refresh_from_bottom_refreshing_label : R.string.pull_to_refresh_refreshing_label;
return context.getString(stringId);
}
示例5: loadReleaseLabel
/**
* Load labels of release
* <br />Convert an {@code ptrReleaseLabel} attribute value to {@code mReleaseLabel} field if each value exists.
* <br />Or if not, then the release label is assigned some string as default
* <br />If you want to set some custom release label at sub class, you have to override this method and implement.
* NOTE : This method <b>Must</b> be modified if kinds of {@code Mode} are increased.
* @param context
* @param attrs
* @param mode
* @return String to be a refreshing label
*/
protected String loadReleaseLabel(Context context, TypedArray attrs, Mode mode) {
// Release Label
if (attrs.hasValue(R.styleable.PullToRefresh_ptrReleaseLabel)) {
return attrs.getString(R.styleable.PullToRefresh_ptrReleaseLabel);
}
int stringId = (mode == Mode.PULL_FROM_END) ? R.string.pull_to_refresh_from_bottom_release_label : R.string.pull_to_refresh_release_label;
return context.getString(stringId);
}