public abstract class

PresetMenuItemGroupingRule

extends DefaultMenuItemGroupingRule
java.lang.Object
   ↳ com.pspdfkit.ui.toolbar.grouping.DefaultMenuItemGroupingRule
     ↳ com.pspdfkit.ui.toolbar.grouping.presets.PresetMenuItemGroupingRule
Known Direct Subclasses

Class Overview

Menu item grouping rule to be extended by those rules that have predefined (preset) groups.

Summary

[Expand]
Inherited Fields
From class com.pspdfkit.ui.toolbar.grouping.DefaultMenuItemGroupingRule
Protected Constructors
PresetMenuItemGroupingRule(Context context)
Public Methods
abstract List<MenuItem> getGroupPreset(int capacity, int itemsCount)
Implementation of this method should return desired preset (structured list of menu items) based on the provided capacity (space left on the toolbar) and the amount of items that needs to be fitted.
List<ContextualToolbarMenuItem> groupMenuItems(List<ContextualToolbarMenuItem> flatItems, int capacity)
Performs grouping of the provided list of menu items based on the available toolbar capacity, meaning the max number of items it can fit.
[Expand]
Inherited Methods
From class com.pspdfkit.ui.toolbar.grouping.DefaultMenuItemGroupingRule
From class java.lang.Object
From interface com.pspdfkit.ui.toolbar.grouping.MenuItemGroupingRule

Protected Constructors

protected PresetMenuItemGroupingRule (Context context)

Public Methods

public abstract List<MenuItem> getGroupPreset (int capacity, int itemsCount)

Implementation of this method should return desired preset (structured list of menu items) based on the provided capacity (space left on the toolbar) and the amount of items that needs to be fitted.

Parameters
capacity Number of spaces left on the toolbar for menu icons.
itemsCount Number of items to fit.
Returns
  • Structured list of how items should be grouped.

public List<ContextualToolbarMenuItem> groupMenuItems (List<ContextualToolbarMenuItem> flatItems, int capacity)

Performs grouping of the provided list of menu items based on the available toolbar capacity, meaning the max number of items it can fit.

Parameters
flatItems Menu items originally set to the toolbar (note: there should be no submenus here, just flat items).
capacity Maximum number of items the toolbar can fit (without optional drag and close buttons).
Returns
  • A re-ordered (could be left the same) list of menu items capacity that will ultimately be set on the toolbar.