added an incremental version number to prevent issues in case the Track format evolves in the future
This commit is contained in:
		
							parent
							
								
									d38adb62d9
								
							
						
					
					
						commit
						0e94bdb9dd
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		|  | @ -42,6 +42,7 @@ public class Track implements TrackbookKeys, Parcelable { | |||
| 
 | ||||
| 
 | ||||
|     /* Main class variables */ | ||||
|     private final int mTrackFormatVersion; | ||||
|     private final List<WayPoint> mWayPoints; | ||||
|     private float mTrackLength; | ||||
|     private long mDuration; | ||||
|  | @ -52,6 +53,7 @@ public class Track implements TrackbookKeys, Parcelable { | |||
| 
 | ||||
|     /* Constructor */ | ||||
|     public Track() { | ||||
|         mTrackFormatVersion = CURRENT_TRACK_FORMAT_VERSION; | ||||
|         mWayPoints = new ArrayList<WayPoint>(); | ||||
|         mTrackLength = 0f; | ||||
|         mDuration = 0; | ||||
|  | @ -63,6 +65,7 @@ public class Track implements TrackbookKeys, Parcelable { | |||
| 
 | ||||
|     /* Constructor used by CREATOR */ | ||||
|     protected Track(Parcel in) { | ||||
|         mTrackFormatVersion = in.readInt(); | ||||
|         mWayPoints = in.createTypedArrayList(WayPoint.CREATOR); | ||||
|         mTrackLength = in.readFloat(); | ||||
|         mDuration = in.readLong(); | ||||
|  | @ -216,6 +219,7 @@ public class Track implements TrackbookKeys, Parcelable { | |||
| 
 | ||||
|     @Override | ||||
|     public void writeToParcel(Parcel parcel, int flags) { | ||||
|         parcel.writeInt(mTrackFormatVersion); | ||||
|         parcel.writeTypedList(mWayPoints); | ||||
|         parcel.writeFloat(mTrackLength); | ||||
|         parcel.writeLong(mDuration); | ||||
|  |  | |||
|  | @ -93,6 +93,7 @@ public interface TrackbookKeys { | |||
|     int MAXIMUM_TRACK_FILES = 25; | ||||
| 
 | ||||
|     /* MISC */ | ||||
|     int CURRENT_TRACK_FORMAT_VERSION = 1; // incremental version number to prevent issues in case the Track format evolves | ||||
|     int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124; | ||||
|     int TRACKER_SERVICE_NOTIFICATION_ID = 1; | ||||
|     int INFOSHEET_CONTENT_ABOUT = 1; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 y20k
						y20k