Java Code Examples for android.widget.ListView.CHOICE_MODE_NONE

The following are Jave code examples for showing how to use CHOICE_MODE_NONE of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: godlibrary   File: DialogFragmentList.java   Source Code and License Vote up 5 votes
private void initView() {
    if (mCheckMode == CheckMode.CHOICE_MODE_MULTIPLE) {
        listViewChoiceMode = ListView.CHOICE_MODE_MULTIPLE;
        checkBoxAll.setVisibility(View.VISIBLE);
        checkBoxAll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fragmentListView.checkAll(isCheckAll);
                isCheckAll = !isCheckAll;
            }
        });
    } else if (mCheckMode == CheckMode.CHOICE_MODE_SINGLE) {
        listViewChoiceMode = ListView.CHOICE_MODE_SINGLE;
        checkBoxAll.setVisibility(View.GONE);
    } else if (mCheckMode == CheckMode.CHOICE_MODE_NONE) {
        listViewChoiceMode = ListView.CHOICE_MODE_NONE;
        checkBoxAll.setVisibility(View.GONE);
        buttonOk.setVisibility(View.GONE);
    }

    fragmentListView = FragmentListView.newInstance(mData, listViewChoiceMode);
    fragmentListView.setListListener(this);

    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    ft.add(R.id.gb_df_fl, fragmentListView);
    ft.commit();
}
 
Example 2
Project: CSipSimple   File: IcsListPopupWindow.java   Source Code and License Vote up 5 votes
/**
 * Set the selected position of the list.
 * Only valid when {@link #isShowing()} == {@code true}.
 *
 * @param position List position to set as selected.
 */
public void setSelection(int position) {
    DropDownListView list = mDropDownList;
    if (isShowing() && list != null) {
        list.mListSelectionHidden = false;
        list.setSelection(position);
        if (list.getChoiceMode() != ListView.CHOICE_MODE_NONE) {
            list.setItemChecked(position, true);
        }
    }
}
 
Example 3
Project: godlibrary   File: ExpandableListViewCheckAdapter.java   Source Code and License Vote up 4 votes
@Override
    public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        HolderChild holderChild;
        if (convertView == null) {
            holderChild = new HolderChild();
            View v = View.inflate(context, R.layout.item_exp_child_check_01, null);
            holderChild.imageView = (ImageView) v.findViewById(R.id.imageView);
            holderChild.title = (TextView) v.findViewById(R.id.exp_title);
            holderChild.describe = (TextView) v.findViewById(R.id.describe);
            holderChild.time = (TextView) v.findViewById(R.id.exp_time);
            holderChild.checkBox = (CheckBox) v.findViewById(R.id.checkBox);
            holderChild.radioButton = (RadioButton) v.findViewById(R.id.exp_radioButton);
            holderChild.exp_child_linear_layout = (RelativeLayout) v.findViewById(R.id.exp_child_linear_layout);
            if (choiceMode == ListView.CHOICE_MODE_NONE) {
                holderChild.checkBox.setVisibility(View.GONE);
                holderChild.radioButton.setVisibility(View.GONE);
            } else if (choiceMode == ListView.CHOICE_MODE_MULTIPLE) {
                holderChild.checkBox.setVisibility(View.VISIBLE);
                holderChild.radioButton.setVisibility(View.GONE);
            } else if (choiceMode == ListView.CHOICE_MODE_SINGLE) {
                holderChild.checkBox.setVisibility(View.GONE);
                holderChild.radioButton.setVisibility(View.VISIBLE);
            }
            if (!childImage)
                holderChild.imageView.setVisibility(View.GONE);
            v.setTag(holderChild);
            convertView = v;
        } else {
            holderChild = (HolderChild) convertView.getTag();
        }


        ExpChildBean child = data.get(groupPosition).getChilds().get(childPosition);
        if (child.getImageUrl() instanceof String)
            imageLoader.bindBitmap((String) child.getImageUrl(), holderChild.imageView, 80, 80);
        if (child.getImageUrl() instanceof Integer)
            holderChild.imageView.setImageResource((Integer) child.getImageUrl());

//        if (expandableListView.getChoiceMode() != ListView.CHOICE_MODE_NONE)
//            holderChild.exp_child_linear_layout.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    updateChildItem(v, groupPosition, childPosition);
//                }
//            });

        holderChild.title.setText(child.getTitle());
        holderChild.describe.setText(child.getDescribe());
        holderChild.time.setText(child.getTime());
        if (choiceMode == ListView.CHOICE_MODE_MULTIPLE)
            holderChild.checkBox.setChecked(getCheckedItemPositions(groupPosition, childPosition));
        else if (choiceMode == ListView.CHOICE_MODE_SINGLE) {
            if (groupPosition == singleGroupPosition && singleId == childPosition)
                holderChild.radioButton.setChecked(true);
            else
                holderChild.radioButton.setChecked(false);
        } else {
            holderChild.checkBox.setChecked(false);
            holderChild.radioButton.setChecked(false);
        }
        return convertView;
    }
 
Example 4
Project: easyfilemanager   File: DirectoryFragment.java   Source Code and License Vote up 4 votes
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();
       }
}
 
Example 5
Project: FireFiles   File: DirectoryFragment.java   Source Code and License Vote up 4 votes
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();
       }
}
 
Example 6
Project: simple-share-android   File: DirectoryFragment.java   Source Code and License Vote up 4 votes
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();
       }
}