本文整理匯總了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();
}
}