// Path: app/src/main/java/eu/basicairdata/graziano/gpslogger/GPSApplication.java
// public static final int NOT_AVAILABLE = -100000;
// 
// Path: app/src/main/java/eu/basicairdata/graziano/gpslogger/GPSApplication.java
// public static GPSApplication getInstance(){
//     return singleton;
// }


import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.ArrayBlockingQueue;
import static eu.basicairdata.graziano.gpslogger.GPSApplication.NOT_AVAILABLE;
import static eu.basicairdata.graziano.gpslogger.GPSApplication.getInstance;
import androidx.documentfile.provider.DocumentFile;
import android.net.Uri;
import android.util.Log;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
                    PhysicalDataFormatter phdformatter = new PhysicalDataFormatter();
                    PhysicalData phdDuration;
                    PhysicalData phdDurationMoving;
                    PhysicalData phdSpeedMax;
                    PhysicalData phdSpeedAvg;
                    PhysicalData phdSpeedAvgMoving;
                    PhysicalData phdDistance;
                    PhysicalData phdAltitudeGap;
                    PhysicalData phdOverallDirection;
                    phdDuration = phdformatter.format(track.getDuration(), PhysicalDataFormatter.FORMAT_DURATION);
                    phdDurationMoving = phdformatter.format(track.getDurationMoving(), PhysicalDataFormatter.FORMAT_DURATION);
                    phdSpeedMax = phdformatter.format(track.getSpeedMax(), PhysicalDataFormatter.FORMAT_SPEED);
                    phdSpeedAvg = phdformatter.format(track.getSpeedAverage(), PhysicalDataFormatter.FORMAT_SPEED_AVG);
                    phdSpeedAvgMoving = phdformatter.format(track.getSpeedAverageMoving(), PhysicalDataFormatter.FORMAT_SPEED_AVG);
                    phdDistance = phdformatter.format(track.getEstimatedDistance(), PhysicalDataFormatter.FORMAT_DISTANCE);
                    phdAltitudeGap = phdformatter.format(track.getEstimatedAltitudeGap(gpsApp.getPrefEGM96AltitudeCorrection()), PhysicalDataFormatter.FORMAT_ALTITUDE);
                    phdOverallDirection = phdformatter.format(track.getBearing(), PhysicalDataFormatter.FORMAT_BEARING);

                    if (!phdDistance.value.isEmpty())
                        gpxBW.write("<!--  Distance = " + phdDistance.value + " " + phdDistance.um + " -->" + newLine);
                    if (!phdDuration.value.isEmpty())
                        gpxBW.write("<!--  Duration = " + phdDuration.value + " | " + phdDurationMoving.value + " -->" + newLine);
                    if (!phdAltitudeGap.value.isEmpty())
                        gpxBW.write("<!--  Altitude Gap = " + phdAltitudeGap.value + " " + phdAltitudeGap.um + " -->" + newLine);
                    if (!phdSpeedMax.value.isEmpty())
                        gpxBW.write("<!--  Max Speed = " + phdSpeedMax.value + " " + phdSpeedMax.um + " -->" + newLine);
                    if (!phdSpeedAvg.value.isEmpty())
                        gpxBW.write("<!--  Avg Speed = " + phdSpeedAvg.value + " | " + phdSpeedAvgMoving.value + " " + phdSpeedAvg.um + " -->" + newLine);
                    if (!phdOverallDirection.value.isEmpty())
                        gpxBW.write("<!--  Direction = " + phdOverallDirection.value + phdOverallDirection.um + " -->" + newLine);
// Path: app/src/main/java/eu/basicairdata/graziano/gpslogger/GPSApplication.java
// public static final int NOT_AVAILABLE = -100000;
// 
// Path: app/src/main/java/eu/basicairdata/graziano/gpslogger/GPSApplication.java
// public static GPSApplication getInstance(){
//     return singleton;
// }


// Path: app/src/main/java/eu/basicairdata/graziano/gpslogger/Exporter.java
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.ArrayBlockingQueue;
import static eu.basicairdata.graziano.gpslogger.GPSApplication.NOT_AVAILABLE;
import static eu.basicairdata.graziano.gpslogger.GPSApplication.getInstance;
import androidx.documentfile.provider.DocumentFile;
import android.net.Uri;
import android.util.Log;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;

                    PhysicalDataFormatter phdformatter = new PhysicalDataFormatter();
                    PhysicalData phdDuration;
                    PhysicalData phdDurationMoving;
                    PhysicalData phdSpeedMax;
                    PhysicalData phdSpeedAvg;
                    PhysicalData phdSpeedAvgMoving;
                    PhysicalData phdDistance;
                    PhysicalData phdAltitudeGap;
                    PhysicalData phdOverallDirection;
                    phdDuration = phdformatter.format(track.getDuration(), PhysicalDataFormatter.FORMAT_DURATION);
                    phdDurationMoving = phdformatter.format(track.getDurationMoving(), PhysicalDataFormatter.FORMAT_DURATION);
                    phdSpeedMax = phdformatter.format(track.getSpeedMax(), PhysicalDataFormatter.FORMAT_SPEED);
                    phdSpeedAvg = phdformatter.format(track.getSpeedAverage(), PhysicalDataFormatter.FORMAT_SPEED_AVG);
                    phdSpeedAvgMoving = phdformatter.format(track.getSpeedAverageMoving(), PhysicalDataFormatter.FORMAT_SPEED_AVG);
                    phdDistance = phdformatter.format(track.getEstimatedDistance(), PhysicalDataFormatter.FORMAT_DISTANCE);
                    phdAltitudeGap = phdformatter.format(track.getEstimatedAltitudeGap(gpsApp.getPrefEGM96AltitudeCorrection()), PhysicalDataFormatter.FORMAT_ALTITUDE);
                    phdOverallDirection = phdformatter.format(track.getBearing(), PhysicalDataFormatter.FORMAT_BEARING);

                    if (!phdDistance.value.isEmpty())
                        gpxBW.write("<!--  Distance = " + phdDistance.value + " " + phdDistance.um + " -->" + newLine);
                    if (!phdDuration.value.isEmpty())
                        gpxBW.write("<!--  Duration = " + phdDuration.value + " | " + phdDurationMoving.value + " -->" + newLine);
                    if (!phdAltitudeGap.value.isEmpty())
                        gpxBW.write("<!--  Altitude Gap = " + phdAltitudeGap.value + " " + phdAltitudeGap.um + " -->" + newLine);
                    if (!phdSpeedMax.value.isEmpty())
                        gpxBW.write("<!--  Max Speed = " + phdSpeedMax.value + " " + phdSpeedMax.um + " -->" + newLine);
                    if (!phdSpeedAvg.value.isEmpty())
                        gpxBW.write("<!--  Avg Speed = " + phdSpeedAvg.value + " | " + phdSpeedAvgMoving.value + " " + phdSpeedAvg.um + " -->" + newLine);
                    if (!phdOverallDirection.value.isEmpty())
                        gpxBW.write("<!--  Direction = " + phdOverallDirection.value + phdOverallDirection.um + " -->" + newLine);
                    if (track.getEstimatedTrackType() != NOT_AVAILABLE)