Class KriptonXPagedLiveDataHandlerImpl<T>

java.lang.Object
com.abubusoft.kripton.androidx.livedata.KriptonXPagedLiveDataHandlerImpl<T>
Type Parameters:
T - The type of the live data
All Implemented Interfaces:
LiveDataHandler

public abstract class KriptonXPagedLiveDataHandlerImpl<T>
extends java.lang.Object
implements LiveDataHandler
A PLiveData class that can be invalidated and computed on demand.

This is an internal class for now, might be public if we see the necessity.

  • Constructor Summary

    Constructors 
    Constructor Description
    KriptonXPagedLiveDataHandlerImpl​(Paginator<T> pagedResult)
    Creates a computable live data which is computed when there are active observers.
  • Method Summary

    Modifier and Type Method Description
    protected abstract T compute()
    Compute.
    PagedLiveData<T> getLiveData()
    Returns the LiveData managed by this class.
    void invalidate()
    Invalidates the LiveData.

    Methods inherited from class java.lang.Object

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

    • KriptonXPagedLiveDataHandlerImpl

      public KriptonXPagedLiveDataHandlerImpl​(Paginator<T> pagedResult)
      Creates a computable live data which is computed when there are active observers.

      It can also be invalidated via invalidate() which will result in a call to compute() if there are active observers (or when they start observing)

  • Method Details

    • getLiveData

      @NonNull public PagedLiveData<T> getLiveData()
      Returns the LiveData managed by this class.
      Returns:
      A LiveData that is controlled by ComputableLiveData.
    • invalidate

      public void invalidate()
      Invalidates the LiveData.

      When there are active observers, this will trigger a call to compute().

      Specified by:
      invalidate in interface LiveDataHandler
    • compute

      @WorkerThread protected abstract T compute()
      Compute.
      Returns:
      the t