List of usage examples for android.view ActionMode setTitle
public abstract void setTitle(@StringRes int resId);
From source file:com.jaspersoft.android.jaspermobile.activities.favorites.adapter.FavoritesAdapter.java
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mode.setTitle(R.string.r_cm_remove_from_favorites); return true;/* w ww .j ava2 s . c om*/ }
From source file:it.gulch.linuxday.android.widgets.BookmarksMultiChoiceModeListener.java
private void updateSelectedCountDisplay(ActionMode mode) { int count = listView.getCheckedItemCount(); mode.setTitle(listView.getContext().getResources().getQuantityString(R.plurals.selected, count, count)); }
From source file:org.mariotaku.twidere.util.StatusActionModeCallback.java
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.action_status_text_selection, menu); mode.setTitle(android.R.string.selectTextMode); return true;//from w w w .j a va 2 s . c o m }
From source file:net.kjmaster.cookiemom.booth.add.AddBoothActivity.java
@AfterViews void afterViews() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("add_booth"); if (prev != null) { ft.remove(prev);//from ww w . j a va 2 s .c o m } ft.replace(R.id.content, AddBoothDialogFragment_.builder().build(), "add_booth"); ActionMode actionMode = startActionMode(this); actionMode.setTitle("Add Booth"); int doneButtonId = Resources.getSystem().getIdentifier("action_mode_close_button", "id", "android"); View doneButton = this.findViewById(doneButtonId); doneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { saveScoutData(); finish(); } }); ft.commit(); }
From source file:com.btmura.android.reddit.app.AccountListFragment.java
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { int count = getListView().getCheckedItemCount(); mode.setTitle(getResources().getQuantityString(R.plurals.accounts, count, count)); return true;// ww w.jav a2 s . c o m }
From source file:org.alfresco.mobile.android.application.fragments.actions.AbstractActions.java
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { this.mode = mode; mode.setTitle(createTitle()); return true;// w w w. j av a 2s. co m }
From source file:org.jraf.android.bikey.app.ride.list.RideListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setEmptyText(getString(R.string.ride_list_empty)); ListView listView = getListView(); listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setMultiChoiceModeListener(new MultiChoiceModeListener() { @Override//w w w . java2 s .co m public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.setTitle(R.string.ride_list_title); int quantity = getListView().getCheckedItemCount(); mode.setSubtitle( getResources().getQuantityString(R.plurals.ride_list_cab_subtitle, quantity, quantity)); MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.ride_list_contextual, menu); return true; } @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { int quantity = getListView().getCheckedItemCount(); mode.setSubtitle( getResources().getQuantityString(R.plurals.ride_list_cab_subtitle, quantity, quantity)); // Enable share / edit if only one item is selected (can't share / edit several items at the same time) mode.getMenu().findItem(R.id.action_share).setVisible(quantity == 1); mode.getMenu().findItem(R.id.action_edit).setVisible(quantity == 1); // Enable merge only if several items are selected mode.getMenu().findItem(R.id.action_merge).setVisible(quantity > 1); } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { long[] checkedItemIds = getListView().getCheckedItemIds(); long checkedItemId = checkedItemIds[0]; Uri checkedItemUri = ContentUris.withAppendedId(RideColumns.CONTENT_URI, checkedItemId); switch (item.getItemId()) { case R.id.action_delete: getCallbacks().showDeleteDialog(checkedItemIds); mode.finish(); return true; case R.id.action_share: getCallbacks().showShareDialog(checkedItemUri); mode.finish(); return true; case R.id.action_edit: getCallbacks().edit(checkedItemUri); mode.finish(); return true; case R.id.action_merge: getCallbacks().showMergeDialog(checkedItemIds); mode.finish(); return true; } return false; } @Override public void onDestroyActionMode(ActionMode mode) { } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } }); }
From source file:com.school.mailclient.app.fragment.SentFragment.java
@Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { mode.setTitle(sentList.getCheckedItemCount() + " ausgewhlt"); adapter.toggleSelection(position);//w ww .j a v a 2s . co m }
From source file:com.school.mailclient.app.fragment.InboxFragment.java
@Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { mode.setTitle(inboxList.getCheckedItemCount() + " ausgewhlt"); adapter.toggleSelection(position);/*from ww w . ja v a 2 s . c o m*/ }
From source file:simonlang.coastdove.usagestatistics.ui.app_details.AppUsageDataListFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.loaderID = 100; ListView listView = getListView(); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { @Override/*from w ww . j a v a 2 s . c o m*/ public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { listAdapter().toggleSelected(position); mode.setTitle(listAdapter().selectedCount() + ""); listAdapter().notifyDataSetChanged(); } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.app_usage_data_context_menu, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.item_context_delete: List<AppUsageDataUIContainer> selectedItems = listAdapter().getSelectedItems(); List<Integer> selectedItemsPrimaryKeys = new LinkedList<>(); for (AppUsageDataUIContainer selectedItem : selectedItems) selectedItemsPrimaryKeys.add(selectedItem.id); new SQLiteDataRemover(getActivity(), selectedItemsPrimaryKeys).run(); Toast toast = Toast.makeText(getActivity(), getString(R.string.toast_data_removed), Toast.LENGTH_SHORT); toast.show(); mode.finish(); getLoaderManager().restartLoader(loaderID, getArguments(), AppUsageDataListFragment.this); getListView().invalidate(); return true; default: return false; } } @Override public void onDestroyActionMode(ActionMode mode) { listAdapter().resetSelected(); } }); }