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

master
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
German version: [y20k](https://github.com/y20k)
Japanese version [naofum](https://github.com/y20k)
### Testing
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 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);
position = new GeoPoint(lastLocation.getLatitude(), lastLocation.getLongitude());
String recordingStart = DateFormat.getDateInstance(DateFormat.SHORT).format(mTrack.getRecordingStart()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT).format(mTrack.getRecordingStart());
String recordingStop = DateFormat.getDateInstance(DateFormat.SHORT).format(mTrack.getRecordingStop()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT).format(mTrack.getRecordingStop());
String recordingStart = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStart()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStart());
String recordingStop = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStop()) + " " +
DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(mTrack.getRecordingStop());
// populate views
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.WayPoint;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
@ -149,7 +151,7 @@ public final class MapHelper {
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
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());
return true;
}
@ -157,6 +159,7 @@ public final class MapHelper {
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
LogHelper.v(LOG_TAG, "Long press on waypoint. " + item.getSnippet());
Toast.makeText(context, item.getSnippet(), Toast.LENGTH_LONG).show();
return true;
}
@ -167,7 +170,8 @@ public final class MapHelper {
/* Creates a marker overlay item */
private static OverlayItem createOverlayItem(Context context, Location location) {
// 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 GeoPoint position = new GeoPoint(location.getLatitude(),location.getLongitude());

View File

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

View File

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