本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例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);
}
}
示例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();
}
}
}