Package fi.moprim.tmd.sdk.trips.data
Class TripRepository
- java.lang.Object
-
- fi.moprim.tmd.sdk.trips.data.TripRepository
-
public class TripRepository extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforceUpload(android.content.Context context)Force the upload of TMD data to the Moprim Cloud.static TripRepositorygetInstance()RefreshLiveData<Resource<Trip>>getLastTrip(android.content.Context context)Loads the last Trip data from the cloudRefreshLiveData<Resource<java.util.List<Trip>>>getLastTrips(android.content.Context context, int last)Loads the last Trip data from the cloud or the cacheRefreshLiveData<Resource<java.util.List<Trip>>>getLastTrips(android.content.Context context, int last, boolean reversed)Loads the last Trip data from the cloud or the cacheRefreshLiveData<Resource<java.util.List<Trip>>>getTrips(android.content.Context context, long start, long end)Loads Trip data from the cloud or the cache between the selected timestampsvoidsetMinimumIntervalBetweenNetworkRequests(long timeMs)
-
-
-
Method Detail
-
getInstance
public static TripRepository getInstance()
-
setMinimumIntervalBetweenNetworkRequests
public void 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
-
getTrips
public RefreshLiveData<Resource<java.util.List<Trip>>> getTrips(@NonNull android.content.Context context, long start, long end)
Loads Trip 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 Trip embedded in a Resource wrapper to know about the status of the request
-
getLastTrips
public RefreshLiveData<Resource<java.util.List<Trip>>> getLastTrips(@NonNull android.content.Context context, int last)
Loads the last Trip data from the cloud or the cache- Parameters:
context- the context running the requestlast- the number of trips we wish to receive- Returns:
- the LiveData with the list of Trip embedded in a Resource wrapper to know about the status of the request
-
getLastTrips
public RefreshLiveData<Resource<java.util.List<Trip>>> getLastTrips(@NonNull android.content.Context context, int last, boolean reversed)
Loads the last Trip data from the cloud or the cache- Parameters:
context- the context running the requestlast- the number of trips we wish to receivereversed- put true if the trips must be from the newest to the oldest- Returns:
- the LiveData with the list of Trip embedded in a Resource wrapper to know about the status of the request
-
getLastTrip
public RefreshLiveData<Resource<Trip>> getLastTrip(@NonNull android.content.Context context)
Loads the last Trip data from the cloud- Parameters:
context- the context running the request- Returns:
- the LiveData with the list of Trip embedded in a Resource wrapper to know about the status of the request
-
-