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


Java ListView.CHOICE_MODE_MULTIPLE_MODAL属性代码示例

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


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

示例1: updateDisplayState

private void updateDisplayState() {
	final State state = getDisplayState(this);

       mDefaultColor = SettingsActivity.getPrimaryColor(getActivity());
       int accentColor = SettingsActivity.getAccentColor();
       if (mLastMode == state.derivedMode &&  mLastSortOrder == state.derivedSortOrder
               && mLastShowSize == state.showSize
               && mLastShowFolderSize == state.showFolderSize
			&& mLastShowThumbnail == state.showThumbnail
			&& mLastShowHiddenFiles == state.showHiddenFiles
               && (mLastShowColor != 0 && mLastShowColor == mDefaultColor)
               && (mLastShowAccentColor != 0 && mLastShowAccentColor == accentColor))
		return;
       boolean refreshData = mLastShowHiddenFiles != state.showHiddenFiles;
	mLastMode = state.derivedMode;
       mLastSortOrder = state.derivedSortOrder;
	mLastShowSize = state.showSize;
	mLastShowFolderSize = state.showFolderSize;
	mLastShowThumbnail = state.showThumbnail;
	mLastShowHiddenFiles = state.showHiddenFiles;

       mLastShowColor = mDefaultColor;
       mProgressBar.setColor(mLastShowColor);
	mListView.setVisibility(state.derivedMode == MODE_LIST ? View.VISIBLE : View.GONE);
	mGridView.setVisibility(state.derivedMode == MODE_GRID ? View.VISIBLE : View.GONE);

	final int choiceMode;
	if (state.allowMultiple) {
		choiceMode = ListView.CHOICE_MODE_MULTIPLE_MODAL;
	} else {
		choiceMode = ListView.CHOICE_MODE_NONE;
	}

	final int thumbSize;
	if (state.derivedMode == MODE_GRID) {
		thumbSize = getResources().getDimensionPixelSize(R.dimen.grid_width);
		mListView.setAdapter(null);
		mListView.setChoiceMode(ListView.CHOICE_MODE_NONE);
		mGridView.setAdapter(mAdapter);
		mGridView.setColumnWidth(thumbSize);
		mGridView.setNumColumns(GridView.AUTO_FIT);
		mGridView.setChoiceMode(choiceMode);
		mCurrentView = mGridView;
	} else if (state.derivedMode == MODE_LIST) {
		thumbSize = getResources().getDimensionPixelSize(R.dimen.icon_size);
		mGridView.setAdapter(null);
		mGridView.setChoiceMode(ListView.CHOICE_MODE_NONE);
		mListView.setAdapter(mAdapter);
		mListView.setChoiceMode(choiceMode);
		mCurrentView = mListView;
	} else {
		throw new IllegalStateException("Unknown state " + state.derivedMode);
	}

       ((BaseActivity) getActivity()).upadateActionItems(mCurrentView);
	mThumbSize = new Point(thumbSize, thumbSize);

       if(refreshData) {
           onUserSortOrderChanged();
       }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:61,代码来源:DirectoryFragment.java


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