Class LocationPhotoAdapter


  • public class LocationPhotoAdapter
    extends com.smarteist.autoimageslider.SliderViewAdapter<com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder>
    Displays a QRCode's location photos inside a slider view.

    Uses and adapts code from Android Image Slider (https://github.com/smarteist/Android-Image-Slider) By: Ali Hosseini (https://github.com/smarteist) License: Apache 2.0

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.smarteist.autoimageslider.SliderViewAdapter

        com.smarteist.autoimageslider.SliderViewAdapter.ViewHolder
    • Field Summary

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

        POSITION_NONE, POSITION_UNCHANGED
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCount()  
      int getPlayerLocationPhoto​(Player player)
      Gets the index of the player's location photo
      void onBindViewHolder​(com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder viewHolder, int position)  
      com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder onCreateViewHolder​(android.view.ViewGroup parent)  
      void renewLocationPhotos​(java.util.function.Consumer<java.util.List<com.google.firebase.storage.StorageReference>> callback)
      Fetchs all location photos for the QRCode and updates the slider view
      • Methods inherited from class com.smarteist.autoimageslider.SliderViewAdapter

        destroyItem, getItemPosition, instantiateItem, isViewFromObject, notifyDataSetChanged
      • Methods inherited from class androidx.viewpager.widget.PagerAdapter

        destroyItem, finishUpdate, finishUpdate, getPageTitle, getPageWidth, instantiateItem, 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

      • LocationPhotoAdapter

        public LocationPhotoAdapter​(android.content.Context ctx,
                                    QRCode qrCode)
    • Method Detail

      • renewLocationPhotos

        public void renewLocationPhotos​(java.util.function.Consumer<java.util.List<com.google.firebase.storage.StorageReference>> callback)
        Fetchs all location photos for the QRCode and updates the slider view
        Parameters:
        callback - A callback function to run after all photos have been fetched
      • getPlayerLocationPhoto

        public int getPlayerLocationPhoto​(Player player)
        Gets the index of the player's location photo
        Parameters:
        player - The player we want to find the location photo of
        Returns:
        The index of the player's location photo
      • onCreateViewHolder

        public com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder onCreateViewHolder​(android.view.ViewGroup parent)
        Specified by:
        onCreateViewHolder in class com.smarteist.autoimageslider.SliderViewAdapter<com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder>
      • onBindViewHolder

        public void onBindViewHolder​(com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder viewHolder,
                                     int position)
        Specified by:
        onBindViewHolder in class com.smarteist.autoimageslider.SliderViewAdapter<com.cmput301w23t09.qrhunter.locationphoto.LocationPhotoAdapter.LocationPhotoHolder>
      • getCount

        public int getCount()
        Specified by:
        getCount in class androidx.viewpager.widget.PagerAdapter