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