diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java index dea76c4..bdc8a39 100644 --- a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java +++ b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java @@ -96,7 +96,7 @@ private static NetworkInfo activeNetwork; private static int networkStrength; private static final int MAX_WIFI_LEVELS = 5; - public static final long VIB_LENGTH = 100; + public static final long VIB_LENGTH = 50; private static SimpleDateFormat df_hm; private static SimpleDateFormat df_full; @@ -141,6 +141,8 @@ private Location mLocation; private LocationManager locationManager; + private List foundLocations; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -176,6 +178,8 @@ poiMarkers[i] = new ArrayList<>(); } + foundLocations = new ArrayList<>(); + relativeLayout.addView(mapView); mTitle = mDrawerTitle = getTitle(); @@ -498,6 +502,7 @@ public void onLocationChanged(Location location) { mLocation = location; if(mLocation == null) return; + foundLocations.add(location); double lat = location.getLatitude(); double lon = location.getLongitude(); @@ -801,18 +806,14 @@ popupMapView.setMultiTouchControls(true); IMapController popupMapController = popupMapView.getController(); popupMapController.setZoom(ZOOM_LEVEL); - popupMapController.setCenter(new GeoPoint(48.52, 9.055)); + popupMapController.setCenter(new GeoPoint(mLocation.getLatitude(), mLocation.getLongitude())); List overlayItemList = new ArrayList<>(); - //TODO fill with correct items - OverlayItem olItem = new OverlayItem("Test Item", "Description...", new GeoPoint(48.47, 9.055)); - OverlayItem olItem2 = new OverlayItem("Test Item 2", "Description...", new GeoPoint(48.57, 9.055)); - OverlayItem olItem3 = new OverlayItem("Test Item 3", "Description...", new GeoPoint(48.52, 9.155)); - OverlayItem olItem4 = new OverlayItem("Test Item 4", "Description...", new GeoPoint(48.52, 8.955)); - overlayItemList.add(olItem); - overlayItemList.add(olItem2); - overlayItemList.add(olItem3); - overlayItemList.add(olItem4); + for(Location l : foundLocations){ + OverlayItem oI = new OverlayItem(null, null, new GeoPoint(l.getLatitude(), l.getLongitude())); + oI.setMarker(res.getDrawable(R.mipmap.ic_poi_red)); + overlayItemList.add(oI); + } AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setView(popupMapView)