Class TmdUploadMetadata

  • All Implemented Interfaces:
    android.os.Parcelable

    public class TmdUploadMetadata
    extends java.lang.Object
    implements android.os.Parcelable
    A class that summarizes the results of an upload
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T extends java.lang.Object>, android.os.Parcelable.Creator<T extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static android.os.Parcelable.Creator<TmdUploadMetadata> CREATOR  
      • Fields inherited from interface android.os.Parcelable

        CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
    • Constructor Summary

      Constructors 
      Constructor Description
      TmdUploadMetadata()
      Default constructor when nothing was set
      TmdUploadMetadata​(long uploadTimestamp, int nbTmdActivities, long lastTmdActivityTimestamp, int nbLocations, long lastLocationTimestamp)
      Default constructor
      TmdUploadMetadata​(android.os.Parcel in)
      Parcel constructor
    • Field Detail

      • CREATOR

        public static final android.os.Parcelable.Creator<TmdUploadMetadata> CREATOR
    • Constructor Detail

      • TmdUploadMetadata

        public TmdUploadMetadata​(long uploadTimestamp,
                                 int nbTmdActivities,
                                 long lastTmdActivityTimestamp,
                                 int nbLocations,
                                 long lastLocationTimestamp)
        Default constructor
        Parameters:
        uploadTimestamp - The upload timestamp of the last upload
        nbTmdActivities - The number of tmd activities that were just uploaded
        lastTmdActivityTimestamp - The end timestamp of last activity that was just uploaded
        nbLocations - The number of location data points that were uploaded
        lastLocationTimestamp - The timestamp of the last location point that was just uploaded
      • TmdUploadMetadata

        public TmdUploadMetadata()
        Default constructor when nothing was set
      • TmdUploadMetadata

        public TmdUploadMetadata​(android.os.Parcel in)
        Parcel constructor
        Parameters:
        in - the parcel
    • Method Detail

      • getUploadTimestamp

        public long getUploadTimestamp()
        Get the upload timestamp of the last upload
        Returns:
        the upload timestamp of the last upload (usually the output of System.currentTimeMillis())
      • getNbTmdActivitiesUploaded

        public int getNbTmdActivitiesUploaded()
        Get the number of tmd activities that were just uploaded
        Returns:
        the number of tmd activities that were just uploaded
      • getLastTimestampOfTmdActivityUploaded

        public long getLastTimestampOfTmdActivityUploaded()
        Get the end timestamp of last activity that was just uploaded
        Returns:
        the end timestamp of last activity that was just uploaded
      • getNbLocationsUploaded

        public int getNbLocationsUploaded()
        Get the number of location data points that were uploaded
        Returns:
        the number of location data points that were uploaded
      • getLastTimestampOfLocationUploaded

        public long getLastTimestampOfLocationUploaded()
        Get the timestamp of the last location point that was just uploaded
        Returns:
        the timestamp of the last location point that was just uploaded
      • dataWasUploaded

        public boolean dataWasUploaded()
        Check if some data (TMD or Location) was uploaded
        Returns:
        true if getNbLocationsUploaded() + getNbTmdActivitiesUploaded() > 0
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(android.os.Parcel dest,
                                  int flags)
        Specified by:
        writeToParcel in interface android.os.Parcelable
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasResult

        public static boolean hasResult​(android.content.Intent intent)
        Check from an intent if it includes TMD_UPLOAD_METADATA
        Parameters:
        intent - the intent to check
        Returns:
        true if it embed a TmdUpdateMetadata result
      • extractResult

        public static Result<TmdUploadMetadata> extractResult​(android.content.Intent intent)
        Extract the result embedded in the intent
        Parameters:
        intent - the intent
        Returns:
        the result that was extracted from the intent extras