android.support.v7.view.ActionMode Java Examples
The following examples show how to use
android.support.v7.view.ActionMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChannelListFragment.java From Plumble with GNU General Public License v3.0 | 6 votes |
@Override public void onUserClick(IUser user) { if (mTargetProvider.getChatTarget() != null && user.equals(mTargetProvider.getChatTarget().getUser()) && mActionMode != null) { // Dismiss action mode if double pressed. FIXME: use list view selection instead? mActionMode.finish(); } else { ActionMode.Callback cb = new ChatTargetActionModeCallback(mTargetProvider, new ChatTargetProvider.ChatTarget(user)) { @Override public void onDestroyActionMode(ActionMode actionMode) { super.onDestroyActionMode(actionMode); mActionMode = null; } }; mActionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(cb); } }
Example #2
Source File: MultiSelectionUtil.java From FireFiles with Apache License 2.0 | 6 votes |
@Override public final boolean onCreateActionMode(ActionMode actionMode, Menu menu) { if (mListener.onCreateActionMode(actionMode, menu)) { mActionMode = actionMode; // Keep a reference to the existing OnItemClickListener so we can restore it mOldItemClickListener = mListView.getOnItemClickListener(); // Set-up the ListView to emulate CHOICE_MODE_MULTIPLE_MODAL mListView.setOnItemClickListener(this); mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); mListView.removeCallbacks(mSetChoiceModeNoneRunnable); // If there are some items to check, do it now if (mItemsToCheck != null) { for (Pair<Integer, Long> posAndId : mItemsToCheck) { mListView.setItemChecked(posAndId.first, true); // Notify the listener that the item has been checked mListener.onItemCheckedStateChanged(mActionMode, posAndId.first, posAndId.second, true); } } return true; } return false; }
Example #3
Source File: FileExplorerAction.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add(0, R.id.select_all, 0, R.string.select_all).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.cut, 0, R.string.cut).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, R.id.copy, 0, R.string.copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem pasteMenu = menu.add(0, R.id.paste, 0, R.string.paste); pasteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); pasteMenu.setEnabled(fileClipboard.canPaste()); renameMenu = menu.add(0, R.id.rename, 0, R.string.rename); renameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareMenu = menu.add(0, R.id.share, 0, R.string.share); shareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); shareActionProvider = new ShareActionProvider(context); shareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(shareMenu, shareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true; }
Example #4
Source File: FilesListFragment.java From secrecy with Apache License 2.0 | 6 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.action_send: sendRawSelectedItems(); mode.finish(); return true; case R.id.action_decrypt: decryptSelectedItems(); mode.finish(); return true; case R.id.action_delete: deleteSelectedItems(); mode.finish(); return true; case R.id.action_rename: renameSelectedItems(); mode.finish(); return true; case R.id.action_select_all: selectAll(); return true; default: return false; } }
Example #5
Source File: ChannelListFragment.java From Plumble with GNU General Public License v3.0 | 6 votes |
@Override public void onChannelClick(IChannel channel) { if (mTargetProvider.getChatTarget() != null && channel.equals(mTargetProvider.getChatTarget().getChannel()) && mActionMode != null) { // Dismiss action mode if double pressed. FIXME: use list view selection instead? mActionMode.finish(); } else { ActionMode.Callback cb = new ChatTargetActionModeCallback(mTargetProvider, new ChatTargetProvider.ChatTarget(channel)) { @Override public void onDestroyActionMode(ActionMode actionMode) { super.onDestroyActionMode(actionMode); mActionMode = null; } }; mActionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(cb); } }
Example #6
Source File: PostDetailsActivity.java From social-app-android with Apache License 2.0 | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.comment_context_menu, menu); menu.findItem(R.id.editMenuItem).setVisible(presenter.hasAccessToEditComment(selectedComment.getAuthorId())); return true; }
Example #7
Source File: ActionModeActivity.java From FileManager with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.actionmove: mPresenter.clickMove(); return true; case R.id.actioncopy: mPresenter.clickCopy(); return true; case R.id.actiondelete: mPresenter.clickDelete(); return true; case R.id.actionshare: mPresenter.clickShare(); return true; case R.id.actionzip: mPresenter.clickZip(Settings.getDefaultDir()); return true; case R.id.actionrename: mPresenter.clickRename(); return true; case R.id.actionall: mPresenter.clickSetlectAll(); return true; default: return false; } }
Example #8
Source File: SuntimesConfigActivity0.java From SuntimesWidget with GNU General Public License v3.0 | 5 votes |
protected WidgetSettings.ActionMode[] supportedActionModes() { WidgetSettings.ActionMode[] allModes = WidgetSettings.ActionMode.values(); WidgetSettings.ActionMode[] supportedModes = new WidgetSettings.ActionMode[allModes.length - 1]; System.arraycopy(allModes, 0, supportedModes, 0, supportedModes.length); return supportedModes; }
Example #9
Source File: ActionModeTitle.java From PlayMusicExporter with MIT License | 5 votes |
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { updateViews(); // Update the title mode.setTitle(mContext.getString(R.string.action_mode_track_selection, mSelectionList.getSelectedItems().size())); return false; // Return false if nothing is done }
Example #10
Source File: AssignmentViewFragment.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.action_close: actionMode.finish(); break; case R.id.action_next: getBinding().mdView.findNext(true); break; case R.id.action_last: getBinding().mdView.findNext(false); break; } return true; }
Example #11
Source File: PostDetailsActivity.java From social-app-android with Apache License 2.0 | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.comment_context_menu, menu); menu.findItem(R.id.editMenuItem).setVisible(presenter.hasAccessToEditComment(selectedComment.getAuthorId())); return true; }
Example #12
Source File: SuntimesConfigActivity0.java From SuntimesWidget with GNU General Public License v3.0 | 5 votes |
/** * Load settings into UI state (action group). * * @param context the android application context */ protected void loadActionSettings(Context context) { // load: action mode WidgetSettings.ActionMode actionMode = WidgetSettings.loadActionModePref(context, appWidgetId, defaultActionMode()); spinner_onTap.setSelection(actionMode.ordinal(supportedActionModes())); // load: launch activity String launchString = WidgetSettings.loadActionLaunchPref(context, appWidgetId); text_launchActivity.setText(launchString); }
Example #13
Source File: MultiChoiceFacade.java From LrcJaeger with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { boolean res = false; if (mActionModeListener != null) { res = mActionModeListener.onActionItemClicked(mode, item); } if (mActionMode != null) { mActionMode.finish(); } return res; }
Example #14
Source File: CountriesAdapter.java From MultiChoiceAdapter with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == R.id.menu_share) { Toast.makeText(getContext(), "Share", Toast.LENGTH_SHORT).show(); return true; } if (item.getItemId() == R.id.menu_discard) { discardSelectedItems(); return true; } return false; }
Example #15
Source File: MultiChoiceAdapterHelper.java From MultiChoiceAdapter with Apache License 2.0 | 5 votes |
@Override protected void startActionMode() { if (!(adapterView.getContext() instanceof ActionBarActivity)) { throw new IllegalStateException("List view must belong to an ActionBarActivity"); } if (!(owner instanceof ActionMode.Callback)) { throw new IllegalStateException("Owner adapter must implement ActionMode.Callback"); } ActionBarActivity activity = (ActionBarActivity) adapterView.getContext(); actionMode = activity.startSupportActionMode((ActionMode.Callback)owner); }
Example #16
Source File: Card.java From Pimp_my_Z1 with GNU General Public License v2.0 | 5 votes |
public Card(String title, String desc, String unit, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) { this.title = title; this.desc = desc; this.unit = unit; this.seekBarMax = seekBarMax; this.seekBarProgress = seekBarProgress; this.fa = fa; this.callback = callback; }
Example #17
Source File: FilesListFragment.java From secrecy with Apache License 2.0 | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.file_action, menu); return true; }
Example #18
Source File: ChatActivity.java From Yahala-Messenger with MIT License | 5 votes |
@Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { menu.clear(); MenuInflater inflater = actionMode.getMenuInflater(); inflater.inflate(R.menu.messages_full_menu, menu); menu.findItem(R.id.copy).setVisible(selectedMessagesCanCopyIds.size() != 0); return true; }
Example #19
Source File: CourseScheduleFragment.java From utexas-utilities with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.locate_class: ArrayList<String> building = new ArrayList<>(); Intent map = new Intent(getString(R.string.building_intent), null, parentAct, CampusMapActivity.class); building.add(currentClasstime.getBuilding().getId()); map.putStringArrayListExtra("buildings", building); startActivity(map); break; } return true; }
Example #20
Source File: MultiChoiceFacade.java From LrcJaeger with Apache License 2.0 | 5 votes |
@Override public void onItemCheckedStateChanged(ActionMode mode, int position, boolean checked) { //Log.v(TAG, "onItemCheckedStateChanged " + position + " - " + checked); if (mActionMode == null) { mActionMode = mActivity.startSupportActionMode(mActionModeCallback); } if (mActionModeListener != null) { mActionModeListener.onItemCheckedStateChanged(mActionMode, position, checked); } }
Example #21
Source File: PostDetailsActivity.java From social-app-android with Apache License 2.0 | 4 votes |
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; // Return false if nothing is done }
Example #22
Source File: ActionModeCallback.java From MarkdownEditors with Apache License 2.0 | 4 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; }
Example #23
Source File: BlueprintActivity.java From CompositeAndroid with Apache License 2.0 | 4 votes |
@Override public void onSupportActionModeFinished(@NonNull ActionMode mode) { super.onSupportActionModeFinished(mode); }
Example #24
Source File: GroupDialogDetailsActivity.java From q-municate-android with Apache License 2.0 | 4 votes |
@Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { actionMode.getMenuInflater().inflate(R.menu.done_menu, menu); return true; }
Example #25
Source File: MultipleSelectFragment.java From TitanRecyclerView with MIT License | 4 votes |
@Override public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { return false; }
Example #26
Source File: SuntimesConfigActivity0.java From SuntimesWidget with GNU General Public License v3.0 | 4 votes |
protected WidgetSettings.ActionMode defaultActionMode() { return WidgetSettings.PREF_DEF_ACTION_MODE; }
Example #27
Source File: ToolbarActionMode.java From GPSLogger with GNU General Public License v3.0 | 4 votes |
@Override public void onDestroyActionMode(ActionMode mode) { EventBus.getDefault().unregister(this); if ((gpsApplication.getNumberOfSelectedTracks() > 0) && gpsApplication.getGPSActivity_activeTab() == 2) GPSApplication.getInstance().DeselectAllTracks(); }
Example #28
Source File: VideoRecyclerAdapter.java From screenrecorder with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.video_list_action_menu, menu); return true; }
Example #29
Source File: StartActivity.java From EverMemo with MIT License | 4 votes |
@Override public void onDestroyActionMode(ActionMode arg0) { mActionMode = null; mContextMenu = null; mMemosAdapter.setCheckMode(false); }
Example #30
Source File: BlueprintActivity.java From CompositeAndroid with Apache License 2.0 | 4 votes |
@Override public void onSupportActionModeStarted(@NonNull ActionMode mode) { super.onSupportActionModeStarted(mode); }