當前位置: 首頁>>代碼示例>>Java>>正文


Java OnScrollListener.SCROLL_STATE_IDLE屬性代碼示例

本文整理匯總了Java中android.widget.AbsListView.OnScrollListener.SCROLL_STATE_IDLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java OnScrollListener.SCROLL_STATE_IDLE屬性的具體用法?Java OnScrollListener.SCROLL_STATE_IDLE怎麽用?Java OnScrollListener.SCROLL_STATE_IDLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.widget.AbsListView.OnScrollListener的用法示例。


在下文中一共展示了OnScrollListener.SCROLL_STATE_IDLE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onScrollStateChanged

@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,代碼行數:21,代碼來源:PauseOnScrollListener.java

示例2: onScrollStateChanged

@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,代碼行數:24,代碼來源:PauseOnScrollListener.java

示例3: 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) {
		if (isLoadAvailable()) {
			setLoadAvailable(false);
			mOnLastItemVisibleListener.onLastItemVisible();
		}
	}

	if (null != mOnScrollListener) {
		mOnScrollListener.onScrollStateChanged(view, state);
	}
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:16,代碼來源:PullToRefreshAdapterViewBase.java

示例4: onScrollStateChanged

@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,代碼行數:16,代碼來源:ImageGridActivity.java

示例5: onScrollStateChanged

@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,代碼行數:21,代碼來源:PauseOnScrollListener.java

示例6: onScrollStateChanged

@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,代碼行數:21,代碼來源:PauseOnScrollListener.java

示例7: onScrollStateChanged

@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,代碼行數:12,代碼來源:XListView.java

示例8: 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 (null != mOnScrollListener) {
		mOnScrollListener.onScrollStateChanged(view, state);
	}
}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:13,代碼來源:PullToRefreshAdapterViewBase.java

示例9: run

@Override
public void run() {
    mCurrentScrollState = mNewState;
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG,
                "new scroll state: " + mNewState + " old state: " + mPreviousScrollState);
    }
    // Fix the position after a scroll or a fling ends
    if (mNewState == OnScrollListener.SCROLL_STATE_IDLE
            && mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE
            && mPreviousScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
        mPreviousScrollState = mNewState;
        int i = 0;
        View child = getChildAt(i);
        while (child != null && child.getBottom() <= 0) {
            child = getChildAt(++i);
        }
        if (child == null) {
            // The view is no longer visible, just return
            return;
        }
        int firstPosition = getFirstVisiblePosition();
        int lastPosition = getLastVisiblePosition();
        boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1;
        final int top = child.getTop();
        final int bottom = child.getBottom();
        final int midpoint = getHeight() / 2;
        if (scroll && top < LIST_TOP_OFFSET) {
            if (bottom > midpoint) {
                smoothScrollBy(top, GOTO_SCROLL_DURATION);
            } else {
                smoothScrollBy(bottom, GOTO_SCROLL_DURATION);
            }
        }
    } else {
        mPreviousScrollState = mNewState;
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:38,代碼來源:DayPickerView.java

示例10: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    /******解決abslistview數據不滿一屏的時候,會重複加載更多的問題 start ******/
    if (mParent.isStopLoadMore() && scrollState == OnScrollListener.SCROLL_STATE_FLING) {
        isForbidLoadMore = true;
    }
    if (isForbidLoadMore) {
        if (!mParent.isStopLoadMore() && scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
            isForbidLoadMore = false;
        }
        return;
    }
    /******解決abslistview數據不滿一屏的時候,會重複加載更多的問題 end ******/
    if (mSilenceLoadMore) {
        if (mRefreshViewListener != null && !hasLoadCompleted() && !mIsLoadingMore && mTotalItemCount - 1 <= view.getLastVisiblePosition() + mPreLoadCount) {
            mRefreshViewListener.onLoadMore(true);
            mIsLoadingMore = true;
        }
    } else if (mContainer != null && !hasLoadCompleted()
            && scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
        if (mPreLoadCount == 0) {
            if (isBottom()) {
                if (!mIsLoadingMore) {
                    mIsLoadingMore = mContainer.invokeLoadMore();
                }
            }
        } else {
            if (mTotalItemCount - 1 <= view.getLastVisiblePosition() + mPreLoadCount) {
                if (!mIsLoadingMore) {
                    mIsLoadingMore = mContainer.invokeLoadMore();
                }
            }
        }
    }
    if (mAbsListViewScrollListener != null) {
        mAbsListViewScrollListener.onScrollStateChanged(view, scrollState);
    }
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:38,代碼來源:XRefreshContentView.java

示例11: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState)
{
	// 滑到底部後自動加載,判斷listview已經停止滾動並且最後可視的條目等於adapter的條目
	if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && lastVisibleIndex >= musicOnlineListAdapter.getCount())
	{
           progressBar.setVisibility(View.VISIBLE);
           loadingTip.setVisibility(View.VISIBLE);
           loadVideo();
	}
}
 
開發者ID:hubcarl,項目名稱:mobile-manager-tool,代碼行數:11,代碼來源:MusicOnlineListActivity.java

示例12: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState)
{
	// 滑到底部後自動加載,判斷listview已經停止滾動並且最後可視的條目等於adapter的條目
	if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && lastVisibleIndex >= videoListAdapter.getCount())
	{
           progressBar.setVisibility(View.VISIBLE);
           loadingTip.setVisibility(View.VISIBLE);
           loadVideo();
	}
}
 
開發者ID:hubcarl,項目名稱:mobile-manager-tool,代碼行數:11,代碼來源:SiteDetailActivity.java

示例13: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
	switch (scrollState) {
	case OnScrollListener.SCROLL_STATE_IDLE:
		if (view.getFirstVisiblePosition() == 0 && !isloading && haveMoreData) {
			loadmorePB.setVisibility(View.VISIBLE);
			// sdk初始化加載的聊天記錄為20條,到頂時去db裏獲取更多
			List<EMMessage> messages;
			try {
				// 獲取更多messges,調用此方法的時候從db獲取的messages
				// sdk會自動存入到此conversation中
				if (chatType == CHATTYPE_SINGLE)
					messages = conversation.loadMoreMsgFromDB(adapter.getItem(0).getMsgId(), pagesize);
				else
					messages = conversation.loadMoreGroupMsgFromDB(adapter.getItem(0).getMsgId(), pagesize);
			} catch (Exception e1) {
				loadmorePB.setVisibility(View.GONE);
				return;
			}
			try {
				Thread.sleep(300);
			} catch (InterruptedException e) {
			}
			if (messages.size() != 0) {
				// 刷新ui
				adapter.notifyDataSetChanged();
				listView.setSelection(messages.size() - 1);
				if (messages.size() != pagesize)
					haveMoreData = false;
			} else {
				haveMoreData = false;
			}
			loadmorePB.setVisibility(View.GONE);
			isloading = false;

		}
		break;
	}
}
 
開發者ID:macyuan,項目名稱:TAG,代碼行數:39,代碼來源:ChatActivity.java

示例14: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if(OnScrollListener.SCROLL_STATE_IDLE == scrollState){
        isScrolling = false;
        notifyDataSetChanged();
    }
    else{
        isScrolling = true;
    }
    if(outScrollListener != null){
        outScrollListener.onScrollStateChanged(view, scrollState);
    }
}
 
開發者ID:feer921,項目名稱:BaseProject,代碼行數:13,代碼來源:BaseCommonAdapter.java

示例15: onScrollStateChanged

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && view.getLastVisiblePosition() + 1 == view.getCount()) {// 如果滾動到最後一行
        if (onScrollBottomListener != null) {
            onScrollBottomListener.onScorllBootom();
        }
    }
}
 
開發者ID:2402091500,項目名稱:CommonPullToRefresh-master,代碼行數:8,代碼來源:GridViewHandler.java


注:本文中的android.widget.AbsListView.OnScrollListener.SCROLL_STATE_IDLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。