Class DynamicMenuPopup

All Implemented Interfaces:
DynamicProductFlavor

public class DynamicMenuPopup extends DynamicSimplePopup
A DynamicSimplePopup to display a list of items.

It will be used internally by the DynamicSpinnerPreference but can be used by the other views also.

  • Constructor Details

    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @NonNull List<DynamicMenu> menus, int selectedPosition, @NonNull AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      menus - The menu items for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @NonNull CharSequence[] titles, @NonNull AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      titles - The titles for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener, int viewType)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
      viewType - The view type for the popup.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener, int viewType)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
      viewType - The view type for the popup.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener, int viewType)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
      viewType - The view type for the popup.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, @Nullable AdapterView.OnItemClickListener onItemClickListener, int viewType)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      onItemClickListener - The on click listener for the list view.
      viewType - The view type for the popup.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
    • DynamicMenuPopup

      public DynamicMenuPopup(@NonNull View anchor, @Nullable int[] iconsRes, @Nullable Drawable[] icons, @Nullable CharSequence[] titles, @Nullable CharSequence[] subtitles, @Nullable boolean[] hasSubmenus, int selectedPosition, @Nullable AdapterView.OnItemClickListener onItemClickListener, int viewType)
      Constructor to initialize an object of this class.
      Parameters:
      anchor - The anchor view for this popup.
      iconsRes - The icons for this popup.
      icons - The icons for this popup.
      titles - The titles for this popup.
      subtitles - The subtitles for this popup.
      hasSubmenus - The submenu states for this popup.
      selectedPosition - The selected menu position for this popup.
      onItemClickListener - The on click listener for the list view.
      viewType - The view type for the popup.
  • Method Details

    • build

      @NonNull public DynamicPopup build()
      Description copied from class: DynamicPopup
      Build this popup and make it ready to show.

      Please call DynamicPopup.show() method to show the popup.

      Overrides:
      build in class DynamicSimplePopup
      Returns:
      The popup after building it according to the supplied parameters.
    • getView

      @Nullable protected View getView()
      Description copied from class: DynamicPopup
      This method will be called to return the content view for the popup.
      Overrides:
      getView in class DynamicSimplePopup
      Returns:
      The content view for the popup.
    • getIconsRes

      @Nullable public int[] getIconsRes()
      Get the menu icons used by this popup.
      Returns:
      The menu icons used by this popup.
    • setIconsRes

      public void setIconsRes(@Nullable int[] iconsRes)
      Set the menu icons for this popup.
      Parameters:
      iconsRes - The menu icons to be set.
    • getIcons

      @Nullable public Drawable[] getIcons()
      Get the menu icons used by this popup.
      Returns:
      The menu icons used by this popup.
    • setIcons

      public void setIcons(@Nullable Drawable[] icons)
      Set the menu icons for this popup.
      Parameters:
      icons - The menu icons to be set.
    • getTitles

      @Nullable public CharSequence[] getTitles()
      Get the menu titles used by this popup.
      Returns:
      The menu titles used by this popup.
    • setTitles

      public void setTitles(@Nullable CharSequence[] titles)
      Set the menu titles for this popup.
      Parameters:
      titles - The menu titles to be set.
    • getSubtitles

      @Nullable public CharSequence[] getSubtitles()
      Get the menu subtitles used by this popup.
      Returns:
      The menu subtitles used by this popup.
    • setSubtitles

      public void setSubtitles(@Nullable CharSequence[] subtitles)
      Set the menu subtitles for this popup.
      Parameters:
      subtitles - The menu subtitles to be set.
    • getHasSubmenus

      @Nullable public boolean[] getHasSubmenus()
      Get the submenu states used by this popup.
      Returns:
      The submenu states used by this popup.
    • setHasSubmenus

      public void setHasSubmenus(@Nullable boolean[] hasSubmenus)
      Set the submenu states for this popup.
      Parameters:
      hasSubmenus - The submenu states to be set.
    • getSelectedPosition

      public int getSelectedPosition()
      Get the selected position.
      Returns:
      The selected position.
    • setSelectedPosition

      public void setSelectedPosition(int selectedPosition)
      Set the selected position.
      Parameters:
      selectedPosition - The position to be selected.
    • getOnItemClickListener

      @Nullable public AdapterView.OnItemClickListener getOnItemClickListener()
      Get the on click listener used by the list view.
      Returns:
      The on click listener used by the list view.
    • setOnItemClickListener

      public void setOnItemClickListener(@Nullable AdapterView.OnItemClickListener onItemClickListener)
      Set the on click listener used by the list view.
      Parameters:
      onItemClickListener - The listener to be set.