From 2a62da3cf27114264b10fdf9e2c9701d2b0a63e4 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 14 Sep 2021 19:07:44 +0200 Subject: [PATCH] Added pin in geofavorite detail map --- .idea/compiler.xml | 2 +- .idea/deploymentTargetDropDown.xml | 17 +++++++++++++++++ .idea/misc.xml | 3 ++- .../detail/GeofavoriteDetailActivity.java | 13 +++++++------ app/src/main/res/drawable/ic_map_pin.xml | 5 +++++ 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 app/src/main/res/drawable/ic_map_pin.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130..fb7f4a8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..a42f681 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ed4a1e2..80d7605 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,7 @@ - + \ No newline at end of file diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java index d255bf0..ad864b5 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java @@ -34,6 +34,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.content.res.AppCompatResources; import androidx.core.app.ActivityCompat; import androidx.preference.PreferenceManager; @@ -42,6 +43,7 @@ import org.osmdroid.config.Configuration; import org.osmdroid.util.GeoPoint; import org.osmdroid.views.CustomZoomButtonsController; import org.osmdroid.views.overlay.IconOverlay; +import org.osmdroid.views.overlay.Marker; import org.osmdroid.views.overlay.Overlay; import org.osmdroid.views.overlay.OverlayItem; @@ -283,12 +285,11 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca mapController.setCenter(position); // Set pin - /* - ArrayList pins = new ArrayList(); - pins.add(new OverlayItem(item.getName(), item.getComment(), position)); - Overlay overlay = new IconOverlay(pins); - binding.map.getOverlays().add(pins); - */ + Marker startMarker = new Marker(binding.map); + startMarker.setPosition(position); + startMarker.setIcon(AppCompatResources.getDrawable(GeofavoriteDetailActivity.this, R.drawable.ic_map_pin)); + startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM); + binding.map.getOverlays().add(startMarker); } public void updateViewCoords(String coords) { diff --git a/app/src/main/res/drawable/ic_map_pin.xml b/app/src/main/res/drawable/ic_map_pin.xml new file mode 100644 index 0000000..a827eab --- /dev/null +++ b/app/src/main/res/drawable/ic_map_pin.xml @@ -0,0 +1,5 @@ + + +