display time of location fix when tapping the location marker (track view) (see #9)

This commit is contained in:
y20k 2017-01-23 12:32:27 +01:00
parent 16224355f3
commit a2091c3687
5 changed files with 14 additions and 6 deletions

View file

@ -6,6 +6,7 @@ Trackbook is designed, developed and maintained by: [y20k](https://github.com/y2
### Translations ### Translations
German version: [y20k](https://github.com/y20k) German version: [y20k](https://github.com/y20k)
Japanese version [naofum](https://github.com/y20k)
### Testing ### Testing
Thanks for finding all those bugs: Thanks for finding all those bugs:

View file

@ -48,6 +48,7 @@ import org.y20k.trackbook.helpers.StorageHelper;
import org.y20k.trackbook.helpers.TrackbookKeys; import org.y20k.trackbook.helpers.TrackbookKeys;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Locale;
/** /**
@ -276,10 +277,10 @@ public class MainActivityTrackFragment extends Fragment implements TrackbookKeys
Location lastLocation = mTrack.getWayPointLocation(mTrack.getSize() -1); Location lastLocation = mTrack.getWayPointLocation(mTrack.getSize() -1);
position = new GeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude()); position = new GeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude());
String recordingStart = DateFormat.getDateInstance(DateFormat.SHORT).format(mTrack.getRecordingStart()) + " " + String recordingStart = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStart()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT).format(mTrack.getRecordingStart()); DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStart());
String recordingStop = DateFormat.getDateInstance(DateFormat.SHORT).format(mTrack.getRecordingStop()) + " " + String recordingStop = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStop()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT).format(mTrack.getRecordingStop()); DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStop());
// populate views // populate views
mDistanceView.setText(mTrack.getTrackDistance()); mDistanceView.setText(mTrack.getTrackDistance());

View file

@ -29,8 +29,10 @@ import org.y20k.trackbook.R;
import org.y20k.trackbook.core.Track; import org.y20k.trackbook.core.Track;
import org.y20k.trackbook.core.WayPoint; import org.y20k.trackbook.core.WayPoint;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
@ -149,7 +151,7 @@ public final class MapHelper {
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() { new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override @Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) { public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
Toast.makeText(context, item.getTitle() + " | " + item.getSnippet(), Toast.LENGTH_LONG).show(); Toast.makeText(context, item.getTitle(), Toast.LENGTH_LONG).show();
LogHelper.v(LOG_TAG, "Tap on waypoint. " + item.getTitle()); LogHelper.v(LOG_TAG, "Tap on waypoint. " + item.getTitle());
return true; return true;
} }
@ -157,6 +159,7 @@ public final class MapHelper {
@Override @Override
public boolean onItemLongPress(final int index, final OverlayItem item) { public boolean onItemLongPress(final int index, final OverlayItem item) {
LogHelper.v(LOG_TAG, "Long press on waypoint. " + item.getSnippet()); LogHelper.v(LOG_TAG, "Long press on waypoint. " + item.getSnippet());
Toast.makeText(context, item.getSnippet(), Toast.LENGTH_LONG).show();
return true; return true;
} }
@ -167,7 +170,8 @@ public final class MapHelper {
/* Creates a marker overlay item */ /* Creates a marker overlay item */
private static OverlayItem createOverlayItem(Context context, Location location) { private static OverlayItem createOverlayItem(Context context, Location location) {
// create content of overlay item // create content of overlay item
final String title = context.getString(R.string.marker_description_source) + ": " + location.getProvider(); String time = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault()).format(location.getTime());
final String title = context.getString(R.string.marker_description_source) + ": " + location.getProvider() + " | " + context.getString(R.string.marker_description_time) + ": " + time;
final String description = context.getString(R.string.marker_description_accuracy) + ": " + location.getAccuracy(); final String description = context.getString(R.string.marker_description_accuracy) + ": " + location.getAccuracy();
final GeoPoint position = new GeoPoint(location.getLatitude(),location.getLongitude()); final GeoPoint position = new GeoPoint(location.getLatitude(),location.getLongitude());

View file

@ -46,6 +46,7 @@
<!-- map markers --> <!-- map markers -->
<string name="marker_description_source">Quelle</string> <string name="marker_description_source">Quelle</string>
<string name="marker_description_time">Uhrzeit</string>
<string name="marker_description_accuracy">Genauigkeit</string> <string name="marker_description_accuracy">Genauigkeit</string>
<!-- statistics sheet --> <!-- statistics sheet -->

View file

@ -47,6 +47,7 @@
<!-- map markers --> <!-- map markers -->
<string name="marker_description_source">Source</string> <string name="marker_description_source">Source</string>
<string name="marker_description_time">Time</string>
<string name="marker_description_accuracy">Accuracy</string> <string name="marker_description_accuracy">Accuracy</string>
<!-- statistics sheet --> <!-- statistics sheet -->