Java Code Examples for android.view.ActionMode#TYPE_FLOATING
The following examples show how to use
android.view.ActionMode#TYPE_FLOATING .
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: ChatSelectTouchListener.java From revolution-irc with GNU General Public License v3.0 | 5 votes |
@Override public void onDestroyActionMode(ActionMode mode) { mActionModeStateCallback.onActionModeStateChanged(mode, false); mCurrentActionMode = null; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || mode.getType() != ActionMode.TYPE_FLOATING) clearSelection(); }
Example 2
Source File: CommentTextView.java From Dashchan with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.M) @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { currentActionMode = mode; currentActionModeMenu = menu; setSelectionMode(true); int pasteResId = ResourceUtils.getSystemSelectionIcon(getContext(), "actionModePasteDrawable", "ic_menu_paste_holo_dark"); ActionIconSet set = new ActionIconSet(getContext()); int flags = MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT; if (C.API_MARSHMALLOW && mode.getType() == ActionMode.TYPE_FLOATING) { int order = 1; // Only "cut" menu item uses this order which doesn't present in non-editable TextView if (replyable != null) { menu.add(0, android.R.id.button1, order, R.string.action_quote) .setIcon(pasteResId).setShowAsAction(flags); } menu.add(0, android.R.id.button2, order, R.string.action_browser) .setIcon(set.getId(R.attr.actionForward)).setShowAsAction(flags); } else { if (replyable != null) { menu.add(0, android.R.id.button1, 0, R.string.action_quote).setIcon(pasteResId) .setShowAsAction(flags); } menu.add(0, android.R.id.button2, 0, R.string.action_browser).setIcon(set.getId(R.attr.actionForward)) .setShowAsAction(flags); } // Stop selection fixation after creating action mode restoreSelectionRunnable = null; return true; }
Example 3
Source File: ToolbarActionModeCallback.java From 365browser with Apache License 2.0 | 4 votes |
private static boolean isFloatingActionMode(ActionMode mode) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false; return mode.getType() == ActionMode.TYPE_FLOATING; }
Example 4
Source File: FloatingActionModeCallback.java From 365browser with Apache License 2.0 | 4 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // If the created ActionMode isn't actually floating, abort creation altogether. if (mode.getType() != ActionMode.TYPE_FLOATING) return false; return mCallback.onCreateActionMode(mode, menu); }
Example 5
Source File: SelectionPopupController.java From 365browser with Apache License 2.0 | 4 votes |
private boolean canHideActionMode() { return supportsFloatingActionMode() && isActionModeValid() && mActionMode.getType() == ActionMode.TYPE_FLOATING; }