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


Java ListAdapter.isEmpty方法代码示例

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


在下文中一共展示了ListAdapter.isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRefreshingInternal

import android.widget.ListAdapter; //导入方法依赖的package包/类
protected void setRefreshingInternal(boolean doScroll) {
    ListAdapter adapter = ((ListView) this.mRefreshableView).getAdapter();
    if (adapter == null || adapter.isEmpty()) {
        super.setRefreshingInternal(doScroll);
        return;
    }
    PullToRefreshHeaderView originalLoadingLayout;
    PullToRefreshHeaderView listViewLoadingLayout;
    int selection;
    int scrollToY;
    super.setRefreshingInternal(false);
    switch (getCurrentMode()) {
        case 2:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = this.mFooterLoadingView;
            selection = ((ListView) this.mRefreshableView).getCount() - 1;
            scrollToY = getScrollY() - getHeaderHeight();
            break;
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = this.mHeaderLoadingView;
            selection = 0;
            scrollToY = getScrollY() + getHeaderHeight();
            break;
    }
    if (doScroll) {
        setHeaderScroll(scrollToY);
    }
    originalLoadingLayout.setVisibility(4);
    listViewLoadingLayout.setVisibility(0);
    listViewLoadingLayout.setParams(this.objs);
    listViewLoadingLayout.refreshing();
    if (doScroll) {
        ((ListView) this.mRefreshableView).setSelection(selection);
        smoothScrollTo(0);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:38,代码来源:PullToRefreshListView.java

示例2: resetHeader

import android.widget.ListAdapter; //导入方法依赖的package包/类
protected void resetHeader(boolean immediately) {
    ListAdapter adapter = ((ListView) this.mRefreshableView).getAdapter();
    if (adapter == null || adapter.isEmpty()) {
        super.resetHeader(immediately);
        return;
    }
    PullToRefreshHeaderView originalLoadingLayout;
    PullToRefreshHeaderView listViewLoadingLayout;
    boolean doScroll;
    int scrollToHeight = getHeaderHeight();
    switch (getCurrentMode()) {
        case 2:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = this.mFooterLoadingView;
            doScroll = isReadyForPullUp();
            break;
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = this.mHeaderLoadingView;
            scrollToHeight *= -1;
            doScroll = isReadyForPullDown();
            break;
    }
    originalLoadingLayout.setVisibility(0);
    if (doScroll) {
        setHeaderScroll(scrollToHeight);
    }
    listViewLoadingLayout.setVisibility(8);
    super.resetHeader(immediately);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:31,代码来源:PullToRefreshListView.java

示例3: setRefreshingInternal

import android.widget.ListAdapter; //导入方法依赖的package包/类
protected void setRefreshingInternal(boolean doScroll) {
    ListAdapter adapter = ((ExpandableListView) this.mRefreshableView).getAdapter();
    if (adapter == null || adapter.isEmpty()) {
        super.setRefreshingInternal(doScroll);
        return;
    }
    PullToRefreshHeaderView originalLoadingLayout;
    PullToRefreshHeaderView listViewLoadingLayout;
    int selection;
    int scrollToY;
    super.setRefreshingInternal(false);
    switch (getCurrentMode()) {
        case 2:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = this.mFooterLoadingView;
            selection = ((ExpandableListView) this.mRefreshableView).getCount() - 1;
            scrollToY = getScrollY() - getHeaderHeight();
            break;
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = this.mHeaderLoadingView;
            selection = 0;
            scrollToY = getScrollY() + getHeaderHeight();
            break;
    }
    if (doScroll) {
        setHeaderScroll(scrollToY);
    }
    originalLoadingLayout.setVisibility(4);
    listViewLoadingLayout.setParams(this.objs);
    listViewLoadingLayout.setVisibility(0);
    listViewLoadingLayout.refreshing();
    if (doScroll) {
        ((ExpandableListView) this.mRefreshableView).setSelection(selection);
        smoothScrollTo(0);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:38,代码来源:PullToRefreshExpandableListView.java

示例4: resetHeader

import android.widget.ListAdapter; //导入方法依赖的package包/类
protected void resetHeader(boolean immediately) {
    ListAdapter adapter = ((ExpandableListView) this.mRefreshableView).getAdapter();
    if (adapter == null || adapter.isEmpty()) {
        super.resetHeader(immediately);
        return;
    }
    PullToRefreshHeaderView originalLoadingLayout;
    PullToRefreshHeaderView listViewLoadingLayout;
    boolean doScroll;
    int scrollToHeight = getHeaderHeight();
    switch (getCurrentMode()) {
        case 2:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = this.mFooterLoadingView;
            doScroll = isReadyForPullUp();
            break;
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = this.mHeaderLoadingView;
            scrollToHeight *= -1;
            doScroll = isReadyForPullDown();
            break;
    }
    originalLoadingLayout.setVisibility(0);
    if (doScroll) {
        setHeaderScroll(scrollToHeight);
    }
    listViewLoadingLayout.setVisibility(8);
    super.resetHeader(immediately);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:31,代码来源:PullToRefreshExpandableListView.java

示例5: onMeasure

import android.widget.ListAdapter; //导入方法依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

    int newHeight = 0;
    final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);
    if (heightMode != MeasureSpec.EXACTLY) {
        ListAdapter listAdapter = getAdapter();
        if (listAdapter != null && !listAdapter.isEmpty()) {
            int listPosition = 0;
            for (listPosition = 0; listPosition < listAdapter.getCount()
                    && listPosition < MAXIMUM_LIST_ITEMS_VIEWABLE; listPosition++) {
                View listItem = listAdapter.getView(listPosition, null, this);
                //now it will not throw a NPE if listItem is a ViewGroup instance
                if (listItem instanceof ViewGroup) {
                    listItem.setLayoutParams(mParams);
                }
                listItem.measure(widthMeasureSpec, heightMeasureSpec);
                newHeight += listItem.getMeasuredHeight();
            }
            newHeight += getDividerHeight() * listPosition;
        }
        if ((heightMode == MeasureSpec.AT_MOST) && (newHeight > heightSize)) {
            if (newHeight > heightSize) {
                newHeight = heightSize;
            }
        }
    } else {
        newHeight = getMeasuredHeight();
    }
    setMeasuredDimension(getMeasuredWidth(), newHeight);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:34,代码来源:NestedListView.java

示例6: onRefreshing

import android.widget.ListAdapter; //导入方法依赖的package包/类
@Override
protected void onRefreshing(final boolean doScroll) {
	/**
	 * If we're not showing the Refreshing view, or the list is empty, the
	 * the header/footer views won't show so we use the normal method.
	 */
	ListAdapter adapter = mRefreshableView.getAdapter();
	if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty()) {
		super.onRefreshing(doScroll);
		return;
	}

	super.onRefreshing(false);

	final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView;
	final int selection, scrollToY;

	switch (getCurrentMode()) {
		case MANUAL_REFRESH_ONLY:
		case PULL_FROM_END:
			origLoadingView = getFooterLayout();
			listViewLoadingView = mFooterLoadingView;
			oppositeListViewLoadingView = mHeaderLoadingView;
			selection = mRefreshableView.getCount() - 1;
			scrollToY = getScrollY() - getFooterSize();
			break;
		case PULL_FROM_START:
		default:
			origLoadingView = getHeaderLayout();
			listViewLoadingView = mHeaderLoadingView;
			oppositeListViewLoadingView = mFooterLoadingView;
			selection = 0;
			scrollToY = getScrollY() + getHeaderSize();
			break;
	}

	// Hide our original Loading View
	origLoadingView.reset();
	origLoadingView.hideAllViews();

	// Make sure the opposite end is hidden too
	oppositeListViewLoadingView.setVisibility(View.GONE);

	// Show the ListView Loading View and set it to refresh.
	listViewLoadingView.setVisibility(View.VISIBLE);
	listViewLoadingView.refreshing();

	if (doScroll) {
		// We need to disable the automatic visibility changes for now
		disableLoadingLayoutVisibilityChanges();

		// We scroll slightly so that the ListView's header/footer is at the
		// same Y position as our normal header/footer
		setHeaderScroll(scrollToY);

		// Make sure the ListView is scrolled to show the loading
		// header/footer
		mRefreshableView.setSelection(selection);

		// Smooth scroll as normal
		smoothScrollTo(0);
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:64,代码来源:PullToRefreshListView.java

示例7: onRefreshing

import android.widget.ListAdapter; //导入方法依赖的package包/类
@Override
protected void onRefreshing(final boolean doScroll) {
	/**
	 * If we're not showing the Refreshing view, or the list is empty, the
	 * the header/footer views won't show so we use the normal method.
	 */
	ListAdapter adapter = mRefreshableView.getAdapter();
	if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing()
			|| null == adapter || adapter.isEmpty()) {
		super.onRefreshing(doScroll);
		return;
	}

	super.onRefreshing(false);

	final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView;
	final int selection, scrollToY;

	switch (getCurrentMode()) {
	case MANUAL_REFRESH_ONLY:
	case PULL_FROM_END:
		origLoadingView = getFooterLayout();
		listViewLoadingView = mFooterLoadingView;
		oppositeListViewLoadingView = mHeaderLoadingView;
		selection = mRefreshableView.getCount() - 1;
		scrollToY = getScrollY() - getFooterSize();
		break;
	case PULL_FROM_START:
	default:
		origLoadingView = getHeaderLayout();
		listViewLoadingView = mHeaderLoadingView;
		oppositeListViewLoadingView = mFooterLoadingView;
		selection = 0;
		scrollToY = getScrollY() + getHeaderSize();
		break;
	}

	// Hide our original Loading View
	origLoadingView.reset();
	origLoadingView.hideAllViews();

	// Make sure the opposite end is hidden too
	oppositeListViewLoadingView.setVisibility(View.GONE);

	// Show the ListView Loading View and set it to refresh.
	listViewLoadingView.setVisibility(View.VISIBLE);
	listViewLoadingView.refreshing();

	if (doScroll) {
		// We need to disable the automatic visibility changes for now
		disableLoadingLayoutVisibilityChanges();

		// We scroll slightly so that the ListView's header/footer is at the
		// same Y position as our normal header/footer
		setHeaderScroll(scrollToY);

		// Make sure the ListView is scrolled to show the progress_loading
		// header/footer
		mRefreshableView.setSelection(selection);

		// Smooth scroll as normal
		smoothScrollTo(0);
	}
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:65,代码来源:PullToRefreshSwipeListView.java

示例8: onRefreshing

import android.widget.ListAdapter; //导入方法依赖的package包/类
@Override
protected void onRefreshing(final boolean doScroll) {
	/**
	 * If we're not showing the Refreshing view, or the list is empty, the
	 * the header/footer views won't show so we use the normal method.
	 */
	ListAdapter adapter = mRefreshableView.getAdapter();
	if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty() || getCurrentMode() == Mode.GOOGLE_STYLE) {
		super.onRefreshing(doScroll);
		return;
	}

	super.onRefreshing(false);

	final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView;
	final int selection, scrollToY;

	switch (getCurrentMode()) {
		case MANUAL_REFRESH_ONLY:
		case PULL_FROM_END:
			origLoadingView = getFooterLayout();
			listViewLoadingView = mFooterLoadingView;
			oppositeListViewLoadingView = mHeaderLoadingView;
			selection = mRefreshableView.getCount() - 1;
			scrollToY = getScrollY() - getFooterSize();
			break;
		case PULL_FROM_START:
		default:
			origLoadingView = getHeaderLayout();
			listViewLoadingView = mHeaderLoadingView;
			oppositeListViewLoadingView = mFooterLoadingView;
			selection = 0;
			scrollToY = getScrollY() + getHeaderSize();
			break;
	}

	// Hide our original Loading View
	origLoadingView.reset();
	origLoadingView.hideAllViews();

	// Make sure the opposite end is hidden too
	oppositeListViewLoadingView.setVisibility(View.GONE);

	// Show the ListView Loading View and set it to refresh.
	listViewLoadingView.setVisibility(View.VISIBLE);
	listViewLoadingView.refreshing();

	if (doScroll) {
		// We need to disable the automatic visibility changes for now
		disableLoadingLayoutVisibilityChanges();

		// We scroll slightly so that the ListView's header/footer is at the
		// same Y position as our normal header/footer
		setHeaderScroll(scrollToY);

		// Make sure the ListView is scrolled to show the loading
		// header/footer
		mRefreshableView.setSelection(selection);

		// Smooth scroll as normal
		smoothScrollTo(0);
	}
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:64,代码来源:PullToRefreshListView.java

示例9: onRefreshing

import android.widget.ListAdapter; //导入方法依赖的package包/类
protected void onRefreshing(boolean doScroll) {
    ListAdapter adapter = ((ListView) this.mRefreshableView).getAdapter();
    if (!this.mListViewExtrasEnabled || !getShowViewWhileRefreshing() || adapter == null ||
            adapter.isEmpty()) {
        super.onRefreshing(doScroll);
        return;
    }
    LoadingLayout origLoadingView;
    LoadingLayout listViewLoadingView;
    LoadingLayout oppositeListViewLoadingView;
    int selection;
    int scrollToY;
    super.onRefreshing(false);
    switch (getCurrentMode()) {
        case MANUAL_REFRESH_ONLY:
        case PULL_FROM_END:
            origLoadingView = getFooterLayout();
            listViewLoadingView = this.mFooterLoadingView;
            oppositeListViewLoadingView = this.mHeaderLoadingView;
            selection = ((ListView) this.mRefreshableView).getCount() - 1;
            scrollToY = getScrollY() - getFooterSize();
            break;
        default:
            origLoadingView = getHeaderLayout();
            listViewLoadingView = this.mHeaderLoadingView;
            oppositeListViewLoadingView = this.mFooterLoadingView;
            selection = 0;
            scrollToY = getScrollY() + getHeaderSize();
            break;
    }
    origLoadingView.reset();
    origLoadingView.hideAllViews();
    oppositeListViewLoadingView.setVisibility(8);
    listViewLoadingView.setVisibility(0);
    listViewLoadingView.refreshing();
    if (doScroll) {
        disableLoadingLayoutVisibilityChanges();
        setHeaderScroll(scrollToY);
        ((ListView) this.mRefreshableView).setSelection(selection);
        smoothScrollTo(0);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:PullToRefreshListView.java


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