Package 

Class ListPreloader

  • All Implemented Interfaces:
    android.widget.AbsListView.OnScrollListener

    
    public class ListPreloader<T>
     implements AbsListView.OnScrollListener
                        

    Loads a few resources ahead in the direction of scrolling in any AbsListView so that images are in the memory cache just before the corresponding view in created in the list. Gives the appearance of an infinitely large image cache, depending on scrolling speed, cpu speed, and cache size.

    Must be put using , or have its corresponding methods called from another AbsListView.OnScrollListener to function.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface ListPreloader.PreloadModelProvider

      An implementation of PreloadModelProvider should provide all the models that should bepreloaded.

      public interface ListPreloader.PreloadSizeProvider

      An implementation of PreloadSizeProvider should provide the size of the view in the list wherethe resources will be displayed.

    • Method Summary

      Modifier and Type Method Description
      void onScrollStateChanged(AbsListView absListView, int scrollState)
      void onScroll(AbsListView absListView, int firstVisible, int visibleCount, int totalCount)
      • Methods inherited from class android.widget.AbsListView.OnScrollListener

        onScroll, onScrollStateChanged
      • Methods inherited from class java.lang.Object

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

      • ListPreloader

        ListPreloader(RequestManager requestManager, ListPreloader.PreloadModelProvider<T> preloadModelProvider, ListPreloader.PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload)
        Constructor for ListPreloader that accepts interfaces for providingthe dimensions of images to preload, the list of models to preload for a given position, andthe request to use to load images.
        Parameters:
        preloadModelProvider - Provides models to load and requests capable of loading them.
        preloadDimensionProvider - Provides the dimensions of images to load.
        maxPreload - Maximum number of items to preload.