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


Java OnScrollListener.SCROLL_STATE_FLING属性代码示例

本文整理汇总了Java中android.widget.AbsListView.OnScrollListener.SCROLL_STATE_FLING属性的典型用法代码示例。如果您正苦于以下问题:Java OnScrollListener.SCROLL_STATE_FLING属性的具体用法?Java OnScrollListener.SCROLL_STATE_FLING怎么用?Java OnScrollListener.SCROLL_STATE_FLING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.widget.AbsListView.OnScrollListener的用法示例。


在下文中一共展示了OnScrollListener.SCROLL_STATE_FLING属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

@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

示例4: 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

示例5: onScrollStateChanged

@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,代码行数:18,代码来源:PullToRefreshListView.java

示例6: getScrollStateString

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,代码行数:18,代码来源:ReboundListView1.java

示例7: 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

示例8: 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

示例9: goTo

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param day The day to move to
 * @param animate Whether to scroll to the given time or just redraw at the
 *            new location
 * @param setSelected Whether to set the given time as selected
 * @param forceScroll Whether to recenter even if the time is already
 *            visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(MonthAdapter.CalendarDay day, boolean animate, boolean setSelected, boolean forceScroll) {

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(day);
    }

    mTempDay.set(day);
    int minMonth = mController.getStartDate().get(Calendar.MONTH);
    final int position = (day.year - mController.getMinYear())
            * MonthAdapter.MONTHS_IN_YEAR + day.month - minMonth;

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int selectedPosition;
    if (child != null) {
        selectedPosition = getPositionForView(child);
    } else {
        selectedPosition = 0;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position != selectedPosition || forceScroll) {
        setMonthDisplayed(mTempDay);
        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            smoothScrollToPositionFromTop(
                    position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            postSetSelection(position);
        }
    } else if (setSelected) {
        setMonthDisplayed(mSelectedDay);
    }
    return false;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:74,代码来源:DayPickerView.java

示例10: goTo

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param time        The time to move to
 * @param animate     Whether to scroll to the given time or just redraw at the
 *                    new location
 * @param setSelected Whether to set the given time as selected
 * @param forceScroll Whether to recenter even if the time is already
 *                    visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(CalendarDay day, boolean animate, boolean setSelected, boolean forceScroll) {

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(day);
    }

    mTempDay.set(day);
    final int position = (day.year - mController.getMinYear())
            * MonthAdapter.MONTHS_IN_YEAR + day.month;

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int selectedPosition;
    if (child != null) {
        selectedPosition = getPositionForView(child);
    } else {
        selectedPosition = 0;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position != selectedPosition || forceScroll) {
        setMonthDisplayed(mTempDay);
        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            smoothScrollToPositionFromTop(
                    position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            postSetSelection(position);
        }
    } else if (setSelected) {
        setMonthDisplayed(mSelectedDay);
    }
    return false;
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:73,代码来源:DayPickerView.java

示例11: goTo

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param time The time to move to
 * @param animate Whether to scroll to the given time or just redraw at the
 *            new location
 * @param setSelected Whether to set the given time as selected
 * @param forceScroll Whether to recenter even if the time is already
 *            visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(CalendarDay day, boolean animate, boolean setSelected, boolean forceScroll) {

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(day);
    }

    mTempDay.set(day);
    final int position = (day.year - mController.getMinYear())
            * MonthAdapter.MONTHS_IN_YEAR + day.month;

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int selectedPosition;
    if (child != null) {
        selectedPosition = getPositionForView(child);
    } else {
        selectedPosition = 0;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position != selectedPosition || forceScroll) {
        setMonthDisplayed(mTempDay);
        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            smoothScrollToPositionFromTop(
                    position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            postSetSelection(position);
        }
    } else if (setSelected) {
        setMonthDisplayed(mSelectedDay);
    }
    return false;
}
 
开发者ID:philliphsu,项目名称:BottomSheetPickers,代码行数:73,代码来源:DayPickerView.java

示例12: goTo

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param day The day to move to
 * @param animate Whether to scroll to the given time or just redraw at the
 *            new location
 * @param setSelected Whether to set the given time as selected
 * @param forceScroll Whether to recenter even if the time is already
 *            visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(MonthAdapter.CalendarDay day, boolean animate, boolean setSelected, boolean forceScroll) {

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(day);
    }

    mTempDay.set(day);
    final int position = (day.year - mController.getMinYear())
            * MonthAdapter.MONTHS_IN_YEAR + day.month;

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int selectedPosition;
    if (child != null) {
        selectedPosition = getPositionForView(child);
    } else {
        selectedPosition = 0;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position != selectedPosition || forceScroll) {
        setMonthDisplayed(mTempDay);
        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            smoothScrollToPositionFromTop(
                    position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            postSetSelection(position);
        }
    } else if (setSelected) {
        setMonthDisplayed(mSelectedDay);
    }
    return false;
}
 
开发者ID:maysamrasoli,项目名称:Doctor,代码行数:73,代码来源:DayPickerView.java


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