当前位置: 首页>>代码示例>>Java>>正文


Java OnScrollListener类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:PauseOnScrollListener.java

示例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);
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:25,代码来源:PauseOnScrollListener.java

示例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);
	}
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:17,代码来源:PullToRefreshAdapterViewBase.java

示例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);
    }
}
 
开发者ID:liyuanhust,项目名称:LoadMoreHelper,代码行数:17,代码来源:MultiScrollListener.java

示例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);
            }
        }
    }
}
 
开发者ID:liyuanhust,项目名称:LoadMoreHelper,代码行数:18,代码来源:MultiScrollListener.java

示例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!");
    }
}
 
开发者ID:LonelyMushroom,项目名称:aarLibrary,代码行数:27,代码来源:XRefreshContentView.java

示例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;
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:17,代码来源:ImageGridActivity.java

示例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);
    }
}
 
开发者ID:redleaf2002,项目名称:magic_imageloader_network,代码行数:22,代码来源:PauseOnScrollListener.java

示例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);
	}
}
 
开发者ID:tangjiabing,项目名称:XListView,代码行数:19,代码来源:PullToRefreshListView.java

示例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;
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:19,代码来源:ReboundListView1.java

示例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);
    }
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:22,代码来源:PauseOnScrollListener.java

示例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;
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:18,代码来源:Common.java

示例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);
    }
}
 
开发者ID:BigAppOS,项目名称:BigApp_WordPress_Android,代码行数:17,代码来源:PullToRefreshAdapterViewBase.java

示例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);
	}
}
 
开发者ID:fengyanjava,项目名称:msb-android,代码行数:22,代码来源:PullToRefreshAdapterViewBase.java

示例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();
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:XListView.java


注:本文中的android.widget.AbsListView.OnScrollListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。