public class

SharingMenu

extends ActionMenu
java.lang.Object
   ↳ com.pspdfkit.ui.actionmenu.ActionMenu
     ↳ com.pspdfkit.ui.actionmenu.SharingMenu
Known Direct Subclasses

Class Overview

Bottom sheet menu displaying list of targets for sharing a document. The menu will automatically resolve share targets (i.e. apps installed on the current device) by querying the Android package manager. You can configure the menu to only show specific targets based on a ShareAction or filter Intent.

There are two ways to configure the menu:

  • Calling setShareAction(ShareAction) will tell the menu to display all apps that can handle the given share action. Valid actions are SEND and VIEW.
  • Calling setShareIntents(List) will make the menu display all apps that handle the provided intents. Use this if you only want to share with a small subset of apps (for example email clients).

Summary

Nested Classes
interface SharingMenu.SharingMenuListener Listener for being notified of UI events on a SharingMenu
Public Constructors
SharingMenu(FragmentActivity activity, SharingMenu.SharingMenuListener listener)
Creates a new instance of SharingMenu.
Public Methods
ShareAction getShareAction()
Returns a previously set ShareAction or null if no share action was set.
void setShareAction(ShareAction shareAction)
Sets ShareAction that defines the share targets to display.
ActionMenu setShareIntents(List<Intent> intents)
Replace share menu items with items representing activities that are targets of given intents.
void setSharedFileName(String fileName)
Sets file name (with extension) of the shared file.
boolean show()
Shows action menu.
Protected Methods
boolean onMenuItemClicked(ActionMenuItem menuItem)
Called when item inside action menu is clicked.
boolean onMenuItemLongClicked(ActionMenuItem menuItem)
Called when item inside action menu is long clicked.
void onNoActionsVisible()
Called when there are no actions in the menu.
[Expand]
Inherited Methods
From class com.pspdfkit.ui.actionmenu.ActionMenu
From class java.lang.Object

Public Constructors

public SharingMenu (FragmentActivity activity, SharingMenu.SharingMenuListener listener)

Creates a new instance of SharingMenu.

Parameters
activity The parent activity of the sharing menu. The menu will attach to this activity.
listener SharingMenu.SharingMenuListener for listening to user events on the menu.

Public Methods

public ShareAction getShareAction ()

Returns a previously set ShareAction or null if no share action was set.

Returns
  • Configured ShareAction, or null if no share action was specified.

public void setShareAction (ShareAction shareAction)

Sets ShareAction that defines the share targets to display.

Parameters
shareAction ShareAction or null to only show fixed menu items. Fixed menu items are items of type FIXED.

public ActionMenu setShareIntents (List<Intent> intents)

Replace share menu items with items representing activities that are targets of given intents.

Parameters
intents Hide share menu list when null or empty.

public void setSharedFileName (String fileName)

Sets file name (with extension) of the shared file. This will be used to query share targets that will be displayed.

public boolean show ()

Shows action menu.

Returns
  • True is going to be shown.

Protected Methods

protected boolean onMenuItemClicked (ActionMenuItem menuItem)

Called when item inside action menu is clicked.

Returns
  • True if you want to consume this event.

protected boolean onMenuItemLongClicked (ActionMenuItem menuItem)

Called when item inside action menu is long clicked.

Returns
  • True if you want to consume this event.

protected void onNoActionsVisible ()

Called when there are no actions in the menu.