Class PresetMenuItemGroupingRule

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • groupMenuItems

        @NonNull() List<ContextualToolbarMenuItem> groupMenuItems(@NonNull() List<ContextualToolbarMenuItem> flatItems, @IntRange(from = ContextualToolbar.MIN_TOOLBAR_CAPACITY) 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.

      • getGroupPreset

        @NonNull() abstract List<MenuItem> getGroupPreset(@IntRange(from = ContextualToolbar.MIN_TOOLBAR_CAPACITY) 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.