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