Class LandmarkCarouselAdapter


  • public class LandmarkCarouselAdapter
    extends androidx.viewpager.widget.PagerAdapter
    This class provides an adapter to display a carousel of user profiles. extends PagerAdapter to handle the swipe functionality.
    • Field Summary

      • Fields inherited from class androidx.viewpager.widget.PagerAdapter

        POSITION_NONE, POSITION_UNCHANGED
    • Constructor Summary

      Constructors 
      Constructor Description
      LandmarkCarouselAdapter​(android.content.Context context, java.util.ArrayList<java.lang.String> carouselItems)
      Constructor for the UserCarouselAdapter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroyItem​(android.view.ViewGroup container, int position, java.lang.Object object)
      This method is called when the adapter is about to destroy the item previously instantiated by the instantiateItem() method.
      int getCount()
      Returns the number of items in the carousel.
      java.lang.Object instantiateItem​(android.view.ViewGroup container, int position)
      Creates the page view for the given position in the carousel.
      boolean isViewFromObject​(android.view.View view, java.lang.Object object)
      Determines if a page view is associated with a given object.
      • Methods inherited from class androidx.viewpager.widget.PagerAdapter

        destroyItem, finishUpdate, finishUpdate, getItemPosition, getPageTitle, getPageWidth, instantiateItem, notifyDataSetChanged, registerDataSetObserver, restoreState, saveState, setPrimaryItem, setPrimaryItem, startUpdate, startUpdate, unregisterDataSetObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LandmarkCarouselAdapter

        public LandmarkCarouselAdapter​(android.content.Context context,
                                       java.util.ArrayList<java.lang.String> carouselItems)
        Constructor for the UserCarouselAdapter.
        Parameters:
        context - The context of the activity or fragment using the adapter.
        carouselItems - A list of BasicPlayerProfile objects to display in the carousel.
    • Method Detail

      • getCount

        public int getCount()
        Returns the number of items in the carousel.
        Specified by:
        getCount in class androidx.viewpager.widget.PagerAdapter
        Returns:
        The number of items in the carousel.
      • isViewFromObject

        public boolean isViewFromObject​(android.view.View view,
                                        java.lang.Object object)
        Determines if a page view is associated with a given object.
        Specified by:
        isViewFromObject in class androidx.viewpager.widget.PagerAdapter
        Parameters:
        view - The page view to check for association.
        object - The object to check for association.
        Returns:
        True if the view is associated with the object, false otherwise.
      • instantiateItem

        public java.lang.Object instantiateItem​(android.view.ViewGroup container,
                                                int position)
        Creates the page view for the given position in the carousel.
        Overrides:
        instantiateItem in class androidx.viewpager.widget.PagerAdapter
        Parameters:
        container - The view container for the page view.
        position - The position of the page view in the carousel.
        Returns:
        The created page view.
      • destroyItem

        public void destroyItem​(android.view.ViewGroup container,
                                int position,
                                java.lang.Object object)
        This method is called when the adapter is about to destroy the item previously instantiated by the instantiateItem() method. It is responsible for removing the view of the item from the container.
        Overrides:
        destroyItem in class androidx.viewpager.widget.PagerAdapter
        Parameters:
        container - the parent view of the item
        position - the position of the item in the adapter
        object - the object representing the item