Class TripRepository


  • public class TripRepository
    extends java.lang.Object
    • Method Detail

      • 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 request
        start - 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 request
        last - 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 request
        last - the number of trips we wish to receive
        reversed - 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