Package 

Class ViewPreloadSizeProvider

    • Constructor Summary

      Constructors 
      Constructor Description
      ViewPreloadSizeProvider() Constructor that does nothing by default and requires users to call when a View is available to registerComponents the dimensionsreturned by this class.
      ViewPreloadSizeProvider(View view) Constructor that will extract the preload size from a given View.
    • Method Summary

      Modifier and Type Method Description
      Array<int> getPreloadSize(@NonNull() T item, int adapterPosition, int itemPosition) Returns the size of the view in the list where the resources will be displayed in pixels inthe format [x, y], or {@code null} if no size is currently available.
      void onSizeReady(int width, int height) A callback called on the main thread.
      void setView(@NonNull() View view) Sets the View the size will be extracted.
      • Methods inherited from class com.mobwith.imgmodule.ListPreloader.PreloadSizeProvider

        getPreloadSize
      • Methods inherited from class java.lang.Object

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

      • ViewPreloadSizeProvider

        ViewPreloadSizeProvider()
        Constructor that does nothing by default and requires users to call when a View is available to registerComponents the dimensionsreturned by this class.
      • ViewPreloadSizeProvider

        ViewPreloadSizeProvider(View view)
        Constructor that will extract the preload size from a given View.
        Parameters:
        view - A not null View the size will be extracted from async using an .
    • Method Detail

      • getPreloadSize

        @Nullable() Array<int> getPreloadSize(@NonNull() T item, int adapterPosition, int itemPosition)

        Returns the size of the view in the list where the resources will be displayed in pixels inthe format [x, y], or {@code null} if no size is currently available.

        Note - The dimensions returned here must precisely match those of the view in the list.

        If this method returns {@code null}, then no request will be started for the given item.

        Parameters:
        item - A model
      • onSizeReady

         void onSizeReady(int width, int height)

        A callback called on the main thread.

        Parameters:
        width - The width in pixels of the target, or SIZE_ORIGINAL to indicatethat we want the resource at its original width.
        height - The height in pixels of the target, or SIZE_ORIGINAL to indicatethat we want the resource at its original height.
      • setView

         void setView(@NonNull() View view)

        Sets the View the size will be extracted.

        Note - only the first call to this method will be obeyed, subsequent requests will beignored.

        Parameters:
        view - A not null View the size will be extracted async with an .