diff --git a/app/src/main/java/net/osmtracker/activity/DisplayTrackMap.java b/app/src/main/java/net/osmtracker/activity/DisplayTrackMap.java index c0e0bc52..707fefbc 100644 --- a/app/src/main/java/net/osmtracker/activity/DisplayTrackMap.java +++ b/app/src/main/java/net/osmtracker/activity/DisplayTrackMap.java @@ -86,6 +86,16 @@ public class DisplayTrackMap extends Activity { */ private static final int DEFAULT_ZOOM = 16; + /** + * Default zoom level for center with zoom + */ + private static final double CENTER_DEFAULT_ZOOM_LEVEL = 18; + + /** + * Animation duration in milliseconds for center with zoom + */ + private static final long ANIMATION_DURATION_MS = 1000; + /** * Main OSM view */ @@ -207,6 +217,12 @@ public void onChange(boolean selfChange) { // Register listeners for zoom buttons findViewById(R.id.displaytrackmap_imgZoomIn).setOnClickListener(v -> osmViewController.zoomIn()); findViewById(R.id.displaytrackmap_imgZoomOut).setOnClickListener(v -> osmViewController.zoomOut()); + findViewById(R.id.displaytrackmap_imgZoomCenter).setOnClickListener(view -> { + centerToGpsPos = true; + if (currentPosition != null) { + osmViewController.animateTo(currentPosition,CENTER_DEFAULT_ZOOM_LEVEL, ANIMATION_DURATION_MS); + } + }); } /** diff --git a/app/src/main/res/drawable-mdpi/gps_center.png b/app/src/main/res/drawable-mdpi/gps_center.png new file mode 100644 index 00000000..38f81f17 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/gps_center.png differ diff --git a/app/src/main/res/drawable-mdpi/zoom_in.png b/app/src/main/res/drawable-mdpi/zoom_in.png index 3e63eae2..8aaa8fa9 100644 Binary files a/app/src/main/res/drawable-mdpi/zoom_in.png and b/app/src/main/res/drawable-mdpi/zoom_in.png differ diff --git a/app/src/main/res/drawable-mdpi/zoom_out.png b/app/src/main/res/drawable-mdpi/zoom_out.png index f3079fd6..2a56507c 100644 Binary files a/app/src/main/res/drawable-mdpi/zoom_out.png and b/app/src/main/res/drawable-mdpi/zoom_out.png differ diff --git a/app/src/main/res/drawable/button_background.xml b/app/src/main/res/drawable/map_btn_style.xml similarity index 100% rename from app/src/main/res/drawable/button_background.xml rename to app/src/main/res/drawable/map_btn_style.xml diff --git a/app/src/main/res/layout/displaytrackmap.xml b/app/src/main/res/layout/displaytrackmap.xml index fc516381..a996a383 100644 --- a/app/src/main/res/layout/displaytrackmap.xml +++ b/app/src/main/res/layout/displaytrackmap.xml @@ -1,28 +1,62 @@ + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto"> - + - - + - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/accessibility.xml b/app/src/main/res/values/accessibility.xml index 43048970..8b6f1e6c 100644 --- a/app/src/main/res/values/accessibility.xml +++ b/app/src/main/res/values/accessibility.xml @@ -7,6 +7,7 @@ Zoom in Zoom out + Zoom center Satellite signal strength indicator