Package com.example.skeddly.ui.adapter
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
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
ConstructorsConstructorDescriptionGalleryImageAdapter(android.content.Context context, ArrayList<GalleryImage> images) Constructor for the GalleryImageAdapter -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if all images are selectedintGets the number of images selectedandroid.view.ViewgetView(int position, android.view.View convertView, android.view.ViewGroup parent) booleanReturns if in selection modevoidsetSelectionMode(boolean selectionMode) Sets if in selection modevoidtoggleSelectAll(boolean toggle) Toggles the selection of all imagesMethods 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, sortMethods inherited from class android.widget.BaseAdapter
areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface android.widget.Adapter
getItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
-
Constructor Details
-
GalleryImageAdapter
Constructor for the GalleryImageAdapter- Parameters:
context- Context of the appimages- 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:
getViewin interfaceandroid.widget.Adapter- Overrides:
getViewin classandroid.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.
-