@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_at: Intent intent = new Intent(getActivity(), WriteWeiboActivity.class); intent.putExtra("token", GlobalContext.getInstance().getSpecialToken()); intent.putExtra("content", "@" + bean.getScreen_name()); intent.putExtra("account", GlobalContext.getInstance().getAccountBean()); getActivity().startActivity(intent); listView.clearChoices(); mode.finish(); break; case R.id.menu_follow: if (followOrUnfollowTask == null || followOrUnfollowTask.getStatus() == MyAsyncTask.Status.FINISHED) { followOrUnfollowTask = new FollowTask(); followOrUnfollowTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR); } listView.clearChoices(); mode.finish(); break; case R.id.menu_unfollow: if (followOrUnfollowTask == null || followOrUnfollowTask.getStatus() == MyAsyncTask.Status.FINISHED) { followOrUnfollowTask = new UnFollowTask(); followOrUnfollowTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR); } listView.clearChoices(); mode.finish(); break; } return true; }
public void selectPerson(PersonDTO personDTO) { ProfessionalDTO professionalDTO = (ProfessionalDTO) personDTO; professionalLV.clearChoices(); professionalLV.setItemChecked(professionalAdapter.getPosition(professionalDTO), true); professionalLV.setSelection(professionalAdapter.getPosition(professionalDTO)); rearrangeAvailableDates(professionalDTO); }
@Override public void onDestroyActionMode(ActionMode mode) { this.mode = null; listView.clearChoices(); adapter.notifyDataSetChanged(); ((AbstractUserListFragment) fragment).setmActionMode(null); }
private void populateSelections(boolean notify) { this.selections.clear(); ArrayList<Integer> movieCollections = new ArrayList<Integer>(); IDataService dataService = DataServiceFactory.GetInstance().GetDataService(); dataService.Open(); for (CollectionMovie member : dataService.GetCollectionMovies(null, this.movieId)) { movieCollections.add(member.getCollectionId()); } for (Collection collection : dataService.GetCollections()) { KeyValueSelection selection = new KeyValueSelection(); selection.id = collection.getId(); selection.name = collection.getName(); selection.selected = movieCollections.contains(collection.getId()); this.selections.add(selection); } if (notify) { ListView lv = this.getListView(); lv.clearChoices(); this.selectionsAdapter.notifyDataSetChanged(); for (KeyValueSelection selection : this.selections) { if (selection.selected) lv.setItemChecked(this.selections.indexOf(selection), true); } } }
/** * Lists the given directory on the view. When the input parameter is null, it will either refresh * the last known directory. list the root if there never was a directory. * * @param directory Directory to be listed */ public void listDirectory(File directory) { // Check input parameters for null if (directory == null) { if (mDirectory != null) { directory = mDirectory; } else { directory = Environment.getExternalStorageDirectory(); // TODO be careful with the state of the storage; could not be available if (directory == null) return; // no files to show } } // if that's not a directory -> List its parent if (!directory.isDirectory()) { Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString()); directory = directory.getParentFile(); } // by now, only files in the same directory will be kept as selected ((ListView) mCurrentListView).clearChoices(); mAdapter.swapDirectory(directory); if (mDirectory == null || !mDirectory.equals(directory)) { mCurrentListView.setSelection(0); } mDirectory = directory; }
private void clearSelect() { mMsgListView.clearChoices(); final int checkedCount = mMsgListView.getCheckedItemCount(); mSelectionMenu.setTitle(getString(R.string.selected_count, checkedCount)); if (checkedCount == 0) { mActionButton.setEnabled(false); } mMsgListView.invalidateViews(); }
public void clearChoices() { listView.clearChoices(); listView.setChoiceMode(ListView.CHOICE_MODE_NONE); listView.setOnItemClickListener(listener); listener = null; listView.invalidateViews(); }
@Override public void onDestroyActionMode(ActionMode actionMode) { mActionMode = null; for (int i = 0; i < mListView.getCount(); i++) { mListView.setItemChecked(i, false); } mListView.clearChoices(); mListView.setChoiceMode(ListView.CHOICE_MODE_NONE); limparBusca(); }
@Override public boolean onItemLongClick(AdapterView<?> view, View row, int position, long id) { lastPosition = position; modeView.clearChoices(); modeView.setItemChecked(lastPosition, true); if (activeMode == null) { activeMode = host.startActionMode(this); } return (true); }
@Override public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { // We switch on the menu item's id, so we know which is clicked switch (menuItem.getItemId()) { // Our item with the menu_remove ID is used to remove the item(s) from the list. // Here we retrieve which positions are currently checked, then iterate through the // list and remove the checked items. Once finished we notify the adapter to update // the ListView contents and finish the action mode. case R.id.menu_remove: // Retrieve which positions are currently checked final ListView listView = getListView(); SparseBooleanArray checkedPositions = listView.getCheckedItemPositions(); // Check to see if there are any checked items if (checkedPositions.size() == 0) { return false; } // Iterate through the items and remove any which are checked final Iterator<String> iterator = mItems.iterator(); int i = 0; while (iterator.hasNext()) { // Call next() so that the iterator index moves iterator.next(); // Remove the item if it is checked (and increment position) if (checkedPositions.get(i++)) { iterator.remove(); } } // Clear the ListView's checked items listView.clearChoices(); // Finally, notify the adapter so that it updates the ListView ((BaseAdapter) getListAdapter()).notifyDataSetChanged(); // As we're removing all of checked items, we'll close the action mode actionMode.finish(); // We return true to signify that we have handled the action item click return true; } return false; }
@Override public void onActionModeFinished(ActionMode mode) { super.onActionModeFinished(mode); if (inviteIntent) { finish(); } else { this.isActionMode = false; contactsView.clearChoices(); contactsView.requestLayout(); contactsView.post( new Runnable() { @Override public void run() { contactsView.setChoiceMode(ListView.CHOICE_MODE_NONE); } }); search.setEnabled(true); } }
@Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case TIME_DIALOG_ID: ((TimePickerDialog) dialog) .updateTime(mCalendar.get(Calendar.HOUR_OF_DAY), mCalendar.get(Calendar.MINUTE)); break; case DATE_DIALOG_ID: ((DatePickerDialog) dialog) .updateDate( mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH)); break; case DIALOG_MULTIPLE_CATEGORY: final AlertDialog alert = (AlertDialog) dialog; final ListView list = alert.getListView(); // been // selected, then uncheck // selected categories if (mVectorCategories.size() > 0) { for (String s : mVectorCategories) { try { // @inoran fix if (list != null) { list.setItemChecked(mCategoryLength - Integer.parseInt(s), true); } } catch (NumberFormatException e) { log("NumberFormatException", e); } } } else { if (list != null) { list.clearChoices(); } } break; } }
private void highlightProfessionalDTOList( Set<ProfessionalDTO> availableProfessionalDTOs, Set<ProfessionalDTO> unavailableProfessionalsSet) { // limpa os dias marcados e profissional selecionado para mostrar profissionais disponiveis na // data selecionada for (ProfessionalDTO professionalDTO : availableProfessionalDTOs) { System.out.println("Nome: " + professionalDTO.getName()); } if (selectedProfessionalDTO != null) { // Toast.makeText(getActivity(), selectedProfessionalDTO.getName() + " não está livre no dia // selecionado.", Toast.LENGTH_LONG).show(); professionalLV.clearChoices(); selectedProfessionalDTO = null; } professionalAdapter.highlightProfessionals( availableProfessionalDTOs, unavailableProfessionalsSet); if (selectedProfFreeCalendars != null) selectedProfFreeCalendars.clear(); screenCalendar.clearHighlightedDates(); finishDownViewLoad(); }
public void onItemClick(AdapterView<?> a, View v, int position, long id) { System.out.println("Position..." + position); String ans = (String) a.getItemAtPosition(position); System.out.println("Value is " + ans); s = ans.split(" "); System.out.println("Split Value is: " + s[0]); System.out.println("Split Value is: " + s[1]); lv1.clearChoices(); data.deletecallist(id2); /*AlertDialog.Builder adb=new AlertDialog.Builder(DeleteList.this); adb.setTitle("Delete?"); adb.setMessage("Are you sure you want to delete " + position); final int positionToRemove = position; adb.setNegativeButton("Cancel", null); adb.setPositiveButton("Ok", new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { data.deletecallist(s[0]); lv1.remove(positionToRemove); results.notifyDataSetChanged(); }}); adb.show();*/ Toast.makeText(DeleteList.this, "Contacts Deleted Successfully", Toast.LENGTH_SHORT).show(); }
@Override public void onDestroyActionMode(ActionMode mode) { activeMode = null; modeView.clearChoices(); modeView.requestLayout(); }