Class VehicleProfileRepository


  • public class VehicleProfileRepository
    extends java.lang.Object
    Repository singleton module for handling vehicle profile data operations. Collecting VehicleProfile 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 VehicleProfileRepository getInstance()
        Getting an instance of the repository with default executors
        Returns:
        a singleton instance of the repository
      • setMinimumIntervalBetweenNetworkRequests

        public VehicleProfileRepository 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
      • getVehicleProfiles

        public RefreshLiveData<Resource<java.util.List<VehicleProfile>>> getVehicleProfiles​(@NonNull
                                                                                            android.content.Context context)
        Loads vehicle profiles from the cloud or the cache
        Parameters:
        context - the context running the request
        Returns:
        the LiveData with the list of vehicle profiles embedded in a Resource wrapper to know about the status of the request
      • addVehicleProfile

        public androidx.lifecycle.LiveData<Resource<VehicleProfile>> addVehicleProfile​(@NonNull
                                                                                       android.content.Context context,
                                                                                       @NonNull
                                                                                       java.lang.String name,
                                                                                       @NonNull
                                                                                       Mode mode,
                                                                                       @NonNull
                                                                                       Energy energy,
                                                                                       java.lang.String make,
                                                                                       java.lang.String makeAlt,
                                                                                       java.lang.String model,
                                                                                       java.lang.String modelAlt,
                                                                                       java.lang.String year,
                                                                                       java.lang.Boolean owner,
                                                                                       boolean defaultVehicle)
      • updateVehicleProfile

        public androidx.lifecycle.LiveData<Resource<VehicleProfile>> updateVehicleProfile​(@NonNull
                                                                                          android.content.Context context,
                                                                                          @NonNull
                                                                                          java.lang.String id,
                                                                                          @NonNull
                                                                                          java.lang.String name,
                                                                                          @NonNull
                                                                                          Mode mode,
                                                                                          @NonNull
                                                                                          Energy energy,
                                                                                          java.lang.String make,
                                                                                          java.lang.String makeAlt,
                                                                                          java.lang.String model,
                                                                                          java.lang.String modelAlt,
                                                                                          java.lang.String year,
                                                                                          java.lang.Boolean owner,
                                                                                          boolean defaultVehicle)
      • deleteVehicleProfile

        public androidx.lifecycle.LiveData<Resource<VehicleProfile>> deleteVehicleProfile​(@NonNull
                                                                                          android.content.Context context,
                                                                                          @NonNull
                                                                                          java.lang.String id)
      • getVehicleProfile

        public androidx.lifecycle.LiveData<VehicleProfile> getVehicleProfile​(@NonNull
                                                                             android.content.Context context,
                                                                             @NonNull
                                                                             java.lang.String id)