Class BasicSelectionActionDelegate

Object
org.mozilla.geckoview.BasicSelectionActionDelegate
All Implemented Interfaces:
ActionMode.Callback, GeckoSession.SelectionActionDelegate

@UiThread public class BasicSelectionActionDelegate extends Object implements ActionMode.Callback, GeckoSession.SelectionActionDelegate
Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by default if the consumer does not explicitly set a SelectionActionDelegate.

To provide custom actions, extend this class and override the following methods,

1) Override getAllActions() to include custom action IDs in the returned array. This array must include all actions, available or not, and must not change over the class lifetime.

2) Override isActionAvailable(java.lang.String) to return whether a custom action is currently available.

3) Override prepareAction(java.lang.String, android.view.MenuItem) to set custom title and/or icon for a custom action.

4) Override performAction(java.lang.String, android.view.MenuItem) to perform a custom action when used.

  • Field Details

    • ACTION_PROCESS_TEXT

      protected static final String ACTION_PROCESS_TEXT
      Intent action for processing text.
      See Also:
    • mActivity

      @NonNull protected final Activity mActivity
      The activity associated with this delegate.
    • mUseFloatingToolbar

      protected final boolean mUseFloatingToolbar
      Whether to use floating toolbar for selection actions.
    • mActionMode

      @Nullable protected ActionMode mActionMode
      The current action mode, if any.
    • mSession

      @Nullable protected GeckoSession mSession
      The current GeckoSession associated with selection.
    • mSelection

      @Nullable protected GeckoSession.SelectionActionDelegate.Selection mSelection
      The current text selection.
    • mRepopulatedMenu

      protected boolean mRepopulatedMenu
      Whether the menu has been repopulated.
  • Constructor Details

    • BasicSelectionActionDelegate

      public BasicSelectionActionDelegate(@NonNull Activity activity)
      Construct a BasicSelectionActionDelegate.
      Parameters:
      activity - The activity to associate with this delegate
    • BasicSelectionActionDelegate

      public BasicSelectionActionDelegate(@NonNull Activity activity, boolean useFloatingToolbar)
      Construct a BasicSelectionActionDelegate.
      Parameters:
      activity - The activity to associate with this delegate
      useFloatingToolbar - Whether to use floating toolbar for selection
  • Method Details