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