Class TmdActivityRepository


  • public class TmdActivityRepository
    extends java.lang.Object
    Repository singleton module for handling TmdActivity data operations. Collecting TmdActivity data is main-safe. This repository moves the query execution off of the main thread. It also supports fetching data from the cloud.
    • Method Detail

      • getInstance

        public static TmdActivityRepository getInstance()
        Getting an instance of the repository with default executors
        Returns:
        a singleton instance of the repository
      • setMinimumIntervalBetweenNetworkRequests

        public TmdActivityRepository setMinimumIntervalBetweenNetworkRequests​(long timeMs)
      • forceUpload

        public void forceUpload​(@NonNull
                                android.content.Context context)
        Force the upload of TMD data to the Moprim Cloud.
        Parameters:
        context - the context triggering the upload
      • getTmdActivities

        public RefreshLiveData<Resource<java.util.List<TmdActivity>>> getTmdActivities​(@NonNull
                                                                                       android.content.Context context,
                                                                                       long start,
                                                                                       long end)
        Loads TmdActivity data from the cloud or the cache between the selected timestamps
        Parameters:
        context - the context running the request
        start - the start timestamp (Epoch time in milliseconds)
        end - the end timestamp (Epoch time in milliseconds)
        Returns:
        the LiveData with the list of TmdActivity embedded in a Resource wrapper to know about the status of the request