Make placeholder info visible when import GPX file.
This commit is contained in:
parent
4ec09c61d3
commit
542d07ec56
|
|
@ -401,6 +401,11 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
|||
}
|
||||
addMarker(new GeoPoint(loc.getLatitude(), loc.getLongitude(), loc.getAltitude()), isFound);
|
||||
}
|
||||
if (!serviceGps.getListGeoPointTraceur().isEmpty()) {
|
||||
updateDistance(getTextTraceur());
|
||||
} else if (!serviceGps.getListGeoPointDog().isEmpty()) {
|
||||
updateDistance(getTextDog());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -567,30 +572,43 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
|||
private void updateDistance() {
|
||||
String text = null;
|
||||
if (serviceGps.isTraceurActivated()) {
|
||||
text = String.format("Distance: %,dm\t\t\t\t\t\t\t\tObjets: %d", ((int) distance), serviceGps.getListGeoPointObjects().size());
|
||||
text = getTextTraceur();
|
||||
} else if (serviceGps.isDogActivated()) {
|
||||
MyLocation firstLoc = serviceGps.getListGeoPointDog().getFirstLocation();
|
||||
MyLocation lastLoc = serviceGps.getListGeoPointDog().getLastLocation();
|
||||
if (firstLoc != null) {
|
||||
long time = lastLoc.getTime() - firstLoc.getTime();
|
||||
time /= 1_000;
|
||||
long s = (time % 60);
|
||||
time /= 60;
|
||||
long m = (time % 60);
|
||||
time /= 60;
|
||||
long h = (time % 60);
|
||||
text = String.format("Time: %02d:%02d:%02d", h, m, s);
|
||||
|
||||
int nbFoundObject = 0;
|
||||
for (MyLocation loc: serviceGps.getListGeoPointObjects()) {
|
||||
if (loc instanceof WayPointLocation && ((WayPointLocation) loc).isFound()) {
|
||||
nbFoundObject++;
|
||||
}
|
||||
}
|
||||
text += "\t\t\t\t\t\t\t\tObjets: "+nbFoundObject+"/"+serviceGps.getListGeoPointObjects().size();
|
||||
}
|
||||
text = getTextDog();
|
||||
}
|
||||
updateDistance(text);
|
||||
}
|
||||
|
||||
private String getTextTraceur() {
|
||||
return String.format("Distance: %,dm\t\t\t\t\t\t\t\tObjets: %d", ((int) distance), serviceGps.getListGeoPointObjects().size());
|
||||
}
|
||||
|
||||
private String getTextDog() {
|
||||
String text = "";
|
||||
MyLocation firstLoc = serviceGps.getListGeoPointDog().getFirstLocation();
|
||||
MyLocation lastLoc = serviceGps.getListGeoPointDog().getLastLocation();
|
||||
if (firstLoc != null) {
|
||||
long time = lastLoc.getTime() - firstLoc.getTime();
|
||||
time /= 1_000;
|
||||
long s = (time % 60);
|
||||
time /= 60;
|
||||
long m = (time % 60);
|
||||
time /= 60;
|
||||
long h = (time % 60);
|
||||
text = String.format("Time: %02d:%02d:%02d", h, m, s);
|
||||
|
||||
int nbFoundObject = 0;
|
||||
for (MyLocation loc: serviceGps.getListGeoPointObjects()) {
|
||||
if (loc instanceof WayPointLocation && ((WayPointLocation) loc).isFound()) {
|
||||
nbFoundObject++;
|
||||
}
|
||||
}
|
||||
text += "\t\t\t\t\t\t\t\tObjets: "+nbFoundObject+"/"+serviceGps.getListGeoPointObjects().size();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
private void updateDistance(String text) {
|
||||
if (text != null) {
|
||||
this.textViewCurrentLocation.setText(text);
|
||||
this.textViewCurrentLocation.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue