Package fi.moprim.tmd.sdk.data
Class TmdActivityRepository
- java.lang.Object
-
- fi.moprim.tmd.sdk.data.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forceUpload(android.content.Context context)
Force the upload of TMD data to the Moprim Cloud.static TmdActivityRepository
getInstance()
Getting an instance of the repository with default executorsRefreshLiveData<Resource<TmdActivity>>
getLastTmdActivity(android.content.Context context)
RefreshLiveData<Resource<java.util.List<TmdActivity>>>
getTmdActivities(android.content.Context context, int last)
RefreshLiveData<Resource<java.util.List<TmdActivity>>>
getTmdActivities(android.content.Context context, long start, long end)
Loads TmdActivity data from the cloud or the cache between the selected timestampsTmdActivityRepository
setMinimumIntervalBetweenNetworkRequests(long timeMs)
-
-
-
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 requeststart
- 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
-
getTmdActivities
public RefreshLiveData<Resource<java.util.List<TmdActivity>>> getTmdActivities(@NonNull android.content.Context context, int last)
-
getLastTmdActivity
public RefreshLiveData<Resource<TmdActivity>> getLastTmdActivity(@NonNull android.content.Context context)
-
-