本文整理汇总了Java中android.widget.AbsListView.OnScrollListener类的典型用法代码示例。如果您正苦于以下问题:Java OnScrollListener类的具体用法?Java OnScrollListener怎么用?Java OnScrollListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnScrollListener类属于android.widget.AbsListView包,在下文中一共展示了OnScrollListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
imageLoader.resume();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
imageLoader.pause();
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
imageLoader.pause();
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例2: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
bitmapUtils.resumeTasks();
LogUtils.i("当前ListView停止滚动,加载图片开始......................");
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
bitmapUtils.pauseTasks();
LogUtils.i("当前ListView被触摸滚动,暂停加载......................");
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
bitmapUtils.pauseTasks();
LogUtils.i("当前ListView被手势离开滚动,暂停加载......................");
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例3: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
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) {
if (isLoadAvailable()) {
setLoadAvailable(false);
mOnLastItemVisibleListener.onLastItemVisible();
}
}
if (null != mOnScrollListener) {
mOnScrollListener.onScrollStateChanged(view, state);
}
}
示例4: addScrollListener
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
public static void addScrollListener(ListView listview, OnScrollListener listener){
if (listview == null || listener == null) {
return;
}
OnScrollListener originListener = getScrollListenerFromListView(listview);
if (originListener instanceof MultiScrollListener) {
(((MultiScrollListener)originListener)).addListener(listener);
} else {
MultiScrollListener multiScrollListener = new MultiScrollListener();
if (originListener != null) {
multiScrollListener.addListener(originListener);
}
multiScrollListener.addListener(listener);
listview.setOnScrollListener(multiScrollListener);
}
}
示例5: removeScrollListener
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
public static void removeScrollListener(ListView listview, OnScrollListener listener) {
if (listview == null || listener == null) {
return;
}
OnScrollListener originListener = getScrollListenerFromListView(listview);
if (originListener == listener) {
listview.setOnScrollListener(null);
} else {
if (originListener instanceof MultiScrollListener) {
MultiScrollListener multiScrollListener = (MultiScrollListener)originListener;
multiScrollListener.removeListener(listener);
if (multiScrollListener.isEmpty()) {
listview.setOnScrollListener(null);
}
}
}
}
示例6: setScrollViewScrollListener
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
private void setScrollViewScrollListener() {
if (child instanceof XScrollView) {
XScrollView scrollView = (XScrollView) child;
scrollView.setOnScrollListener(mParent, new XScrollView.OnScrollListener() {
@Override
public void onScrollStateChanged(ScrollView view, int scrollState, boolean arriveBottom) {
if (scrollState == SCROLL_STATE_IDLE && arriveBottom) {
if (mSilenceLoadMore) {
if (mRefreshViewListener != null) {
mRefreshViewListener.onLoadMore(true);
}
} else if (mContainer != null && !hasLoadCompleted()) {
mContainer.invokeLoadMore();
}
}
}
@Override
public void onScroll(int l, int t, int oldl, int oldt) {
}
});
} else {
throw new RuntimeException("please use XScrollView instead of ScrollView!");
}
}
示例7: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_FLING:
adapter.lock();
break;
case OnScrollListener.SCROLL_STATE_IDLE:
adapter.unlock();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
adapter.lock();
break;
default:
break;
}
}
示例8: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
magic.magicEngine.resume();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
magic.magicEngine.pause();
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
magic.magicEngine.pause();
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例9: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (isScrollLoadEnabled() && hasMoreData()) {
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE
|| scrollState == OnScrollListener.SCROLL_STATE_FLING) {
if (isReadyForPullUp()) {
startLoading();
}
}
}
if (mListView instanceof SlideListView)
((SlideListView) mListView).onScrollStateChanged(view, scrollState);
if (null != mScrollListener) {
mScrollListener.onScrollStateChanged(view, scrollState);
}
}
示例10: getScrollStateString
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
private String getScrollStateString(int flag) {
String str = "";
switch (flag) {
case OnScrollListener.SCROLL_STATE_IDLE:
str = "SCROLL_STATE_IDLE";
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
str = "SCROLL_STATE_TOUCH_SCROLL";
break;
case OnScrollListener.SCROLL_STATE_FLING:
str = "SCROLL_STATE_FLING";
break;
default:
str = "wrong state";
}
return str;
}
示例11: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
taskHandler.resume();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
taskHandler.pause();
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
taskHandler.pause();
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
示例12: checkScrolledBottom
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
private void checkScrolledBottom(AbsListView view, int scrollState)
{
int cc = view.getCount();
int last = view.getLastVisiblePosition();
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && cc == last + 1)
{
if (last != lastBottom)
{
lastBottom = last;
invoke(view, scrollState);
}
}
else
{
lastBottom = -1;
}
}
示例13: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
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 (null != mOnScrollListener)
{
mOnScrollListener.onScrollStateChanged(view, state);
}
}
示例14: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
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 && null != mOnLoadMoreListener) {
int lastPosition = getRefreshableView().getLastVisiblePosition();
int total = getRefreshableView().getCount() - 1;
if (total - lastPosition < mLoadMoreRemainCount) {
mOnLoadMoreListener.onLoadMore();
}
}
if (null != mOnScrollListener) {
mOnScrollListener.onScrollStateChanged(view, state);
}
}
示例15: onScrollStateChanged
import android.widget.AbsListView.OnScrollListener; //导入依赖的package包/类
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (mScrollListener != null) {
mScrollListener.onScrollStateChanged(view, scrollState);
}
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
if (mEnableAutoLoad && getLastVisiblePosition() == getCount() - 1) {
startLoadMore();
}
}
}