List of usage examples for android.widget ListView isItemChecked
public boolean isItemChecked(int position)
From source file:org.sufficientlysecure.keychain.compatibility.ListFragmentWorkaround.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { l.setItemChecked(position, l.isItemChecked(position)); }
From source file:at.bitfire.davdroid.syncadapter.SelectCollectionsFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { boolean ok = false; try {/* ww w.j a v a 2 s .co m*/ ListView listView = getListView(); for (int i = listView.getCount() - 1; i >= 0; i--) { if (listView.isItemChecked(i)) { ok = true; break; } } } catch (IllegalStateException e) { } MenuItem item = menu.findItem(R.id.next); item.setEnabled(ok); }
From source file:com.jefftharris.passwdsafe.sync.SyncLogsFragment.java
@Override public void onListItemClick(ListView l, View v, int pos, long id) { if (l.isItemChecked(pos)) { if (pos == itsSelItemPos) { l.setItemChecked(pos, false); itsSelItemPos = -1;// w ww. ja va2s. c o m } else { itsSelItemPos = pos; } } l.invalidateViews(); }
From source file:br.com.PartoHumanizado.fragment.base.ResStringArrayListFragment.java
private boolean[] getCheckedBooleanArray() { ListView listView = getListView(); int count = listView.getCount(); boolean[] booleans = new boolean[count]; for (int i = 0; i < count; i++) { booleans[i] = listView.isItemChecked(i); }//from w w w. j a va 2 s. c o m return booleans; }
From source file:com.akalipetis.action_mode_list_fragment.ActionModeListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); int choiceMode = l.getChoiceMode(); if (!(choiceMode == ListView.CHOICE_MODE_MULTIPLE)) return;//from ww w . j av a 2 s .co m boolean checked = l.isItemChecked(position); if (mListener != null) mListener.onItemCheckedStateChanged(mWrapper, position, id, checked); int checkedCount = calculateCheckedItems(); if (checkedCount <= 0) { if (mWrapper != null) mWrapper.finish(); } }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
private void actionModeDialpad() { ListView lv = getListView(); for (int i = 0; i < lv.getCount(); i++) { if (lv.isItemChecked(i)) { mAdapter.getItem(i);/* w w w. ja va2s . co m*/ String number = mAdapter.getCallRemoteAtPostion(i); if (!TextUtils.isEmpty(number)) { Intent it = new Intent(Intent.ACTION_DIAL); it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_SIP, number)); startActivity(it); } break; } } mMode.invalidate(); }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
private void actionModeInvertSelection() { ListView lv = getListView(); for (int i = 0; i < lv.getCount(); i++) { lv.setItemChecked(i, !lv.isItemChecked(i)); }//from ww w . ja v a2 s . c om mMode.invalidate(); }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
@Override public void viewDetails(int position, long[] callIds) { ListView lv = getListView(); if (mMode != null) { lv.setItemChecked(position, !lv.isItemChecked(position)); mMode.invalidate();/*ww w. j a va2s . com*/ // Don't see details in this case return; } if (mDualPane) { // If we are not currently showing a fragment for the new // position, we need to create and install a new one. CallLogDetailsFragment df = new CallLogDetailsFragment(); Bundle bundle = new Bundle(); bundle.putLongArray(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds); df.setArguments(bundle); // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details, df, null); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); getListView().setItemChecked(position, true); } else { Intent it = new Intent(getActivity(), CallLogDetailsActivity.class); it.putExtra(CallLogDetailsFragment.EXTRA_CALL_LOG_IDS, callIds); getActivity().startActivity(it); } }
From source file:org.flerda.android.honeypad.NoteListFragment.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.checkbox: Integer position = (Integer) v.getTag(R.id.list); if (null != position) { ListView lv = getListView(); int pos = position; boolean isChecked = !lv.isItemChecked(pos); lv.setItemChecked(pos, isChecked); if (!mIsV11) { showMultiPanel();/*from w ww . j a v a 2 s. c o m*/ } } break; case R.id.btn_multi_delete: { Activity a = getActivity(); ContentResolver cr = a.getContentResolver(); ListView lv = mLV; int deletedCount = 0; /** Badness. Don't loop a delete operation on the UI thread **/ /** We also assume that the ID's and positions are constant **/ for (long id : lv.getCheckItemIds()) { deletedCount += cr.delete(ContentUris.withAppendedId(NotesProvider.CONTENT_URI, id), null, null); } // clear any selections lv.clearChoices(); // update container mContainerCallback.onNoteDeleted(); // show a toast to confirm delete Toast.makeText(a, String.format(getString(R.string.num_deleted), deletedCount, (deletedCount == 1 ? "" : "s")), Toast.LENGTH_SHORT).show(); showMultiPanel(); break; } } }
From source file:com.lge.friendsCamera.CustomListAdapter.java
/** * Set background of the row view/*w ww . j a v a 2 s .com*/ * * @param position position of row view * @param rowView row view which will set background * @param parent parent of row view */ private void setRowBackground(int position, View rowView, ViewGroup parent) { final ListView lv = (ListView) parent; int colorHighlight = ContextCompat.getColor(mContext, R.color.colorHighlight); int colorTransparent = ContextCompat.getColor(mContext, R.color.colorTransparent); if (lv.isItemChecked(position)) { rowView.setBackgroundColor(colorHighlight); } else { rowView.setBackgroundColor(colorTransparent); } }