當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。