Class GalleryImageAdapter

java.lang.Object
android.widget.BaseAdapter
android.widget.ArrayAdapter<GalleryImage>
com.example.skeddly.ui.adapter.GalleryImageAdapter
All Implemented Interfaces:
android.widget.Adapter, android.widget.Filterable, android.widget.ListAdapter, android.widget.SpinnerAdapter, android.widget.ThemedSpinnerAdapter

public class GalleryImageAdapter extends android.widget.ArrayAdapter<GalleryImage>
An adapter for showing images in the gallery.
  • Field Summary

    Fields inherited from interface android.widget.Adapter

    IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
  • Constructor Summary

    Constructors
    Constructor
    Description
    GalleryImageAdapter(android.content.Context context, ArrayList<GalleryImage> images)
    Constructor for the GalleryImageAdapter
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if all images are selected
    int
    Gets the number of images selected
    android.view.View
    getView(int position, android.view.View convertView, android.view.ViewGroup parent)
     
    boolean
    Returns if in selection mode
    void
    setSelectionMode(boolean selectionMode)
    Sets if in selection mode
    void
    toggleSelectAll(boolean toggle)
    Toggles the selection of all images

    Methods inherited from class android.widget.ArrayAdapter

    add, addAll, addAll, clear, createFromResource, getAutofillOptions, getContext, getCount, getDropDownView, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sort

    Methods inherited from class android.widget.BaseAdapter

    areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserver

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface android.widget.Adapter

    getItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
  • Constructor Details

    • GalleryImageAdapter

      public GalleryImageAdapter(android.content.Context context, ArrayList<GalleryImage> images)
      Constructor for the GalleryImageAdapter
      Parameters:
      context - Context of the app
      images - List of images to display
  • Method Details

    • getView

      @NonNull public android.view.View getView(int position, @Nullable android.view.View convertView, @NonNull android.view.ViewGroup parent)
      Specified by:
      getView in interface android.widget.Adapter
      Overrides:
      getView in class android.widget.ArrayAdapter<GalleryImage>
    • getSelectedCount

      public int getSelectedCount()
      Gets the number of images selected
      Returns:
      The number of images selected
    • isSelectionMode

      public boolean isSelectionMode()
      Returns if in selection mode
      Returns:
      True if in selection mode. False otherwise.
    • setSelectionMode

      public void setSelectionMode(boolean selectionMode)
      Sets if in selection mode
      Parameters:
      selectionMode - True if in selection mode. False otherwise.
    • toggleSelectAll

      public void toggleSelectAll(boolean toggle)
      Toggles the selection of all images
      Parameters:
      toggle - True if the images should be selected. False otherwise.
    • allSelected

      public boolean allSelected()
      Checks if all images are selected
      Returns:
      True if all images are selected. False otherwise.