From fd4a9c1f5d1c1b712f326a24bc7f3a527d9a674f Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Mon, 19 Feb 2024 21:42:31 +0100 Subject: [PATCH] WIP Geofavorite infowindow --- .../fragments/GeofavoriteMapFragment.java | 3 + .../views/GeofavMarkerInfoWindow.java | 25 +++++ .../drawable/geofav_infowindow_pointer.xml | 10 ++ .../drawable/infowindow_geofav_background.xml | 6 ++ app/src/main/res/layout/infowindow_geofav.xml | 92 +++++++++++++++++++ app/src/main/res/values/styles.xml | 4 + 6 files changed, 140 insertions(+) create mode 100644 app/src/main/java/it/danieleverducci/nextcloudmaps/views/GeofavMarkerInfoWindow.java create mode 100644 app/src/main/res/drawable/geofav_infowindow_pointer.xml create mode 100644 app/src/main/res/drawable/infowindow_geofav_background.xml create mode 100644 app/src/main/res/layout/infowindow_geofav.xml diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java index 02829db..1770596 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/fragments/GeofavoriteMapFragment.java @@ -15,6 +15,7 @@ import androidx.lifecycle.Observer; import org.osmdroid.util.GeoPoint; import org.osmdroid.views.MapView; import org.osmdroid.views.overlay.Marker; +import org.osmdroid.views.overlay.infowindow.MarkerInfoWindow; import java.util.List; @@ -22,6 +23,7 @@ import it.danieleverducci.nextcloudmaps.R; import it.danieleverducci.nextcloudmaps.activity.main.MainActivity; import it.danieleverducci.nextcloudmaps.model.Geofavorite; import it.danieleverducci.nextcloudmaps.utils.MapUtils; +import it.danieleverducci.nextcloudmaps.views.GeofavMarkerInfoWindow; public class GeofavoriteMapFragment extends GeofavoritesFragment { private MapView map; @@ -86,6 +88,7 @@ public class GeofavoriteMapFragment extends GeofavoritesFragment { m.setTitle(geofavorite.getName()); m.setSnippet(geofavorite.getComment()); m.setSubDescription(geofavorite.getCategory()); + m.setInfoWindow(new GeofavMarkerInfoWindow(map)); map.getOverlays().add(m); } } diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/views/GeofavMarkerInfoWindow.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/views/GeofavMarkerInfoWindow.java new file mode 100644 index 0000000..417f95a --- /dev/null +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/views/GeofavMarkerInfoWindow.java @@ -0,0 +1,25 @@ +package it.danieleverducci.nextcloudmaps.views; + +import org.osmdroid.views.MapView; +import org.osmdroid.views.overlay.infowindow.MarkerInfoWindow; + +import it.danieleverducci.nextcloudmaps.R; + +public class GeofavMarkerInfoWindow extends MarkerInfoWindow { + /** + * @param mapView + */ + public GeofavMarkerInfoWindow(MapView mapView) { + super(R.layout.infowindow_geofav, mapView); + } + + @Override + public void onOpen(Object item) { + super.onOpen(item); + } + + @Override + public void onClose() { + super.onClose(); + } +} diff --git a/app/src/main/res/drawable/geofav_infowindow_pointer.xml b/app/src/main/res/drawable/geofav_infowindow_pointer.xml new file mode 100644 index 0000000..a1fa742 --- /dev/null +++ b/app/src/main/res/drawable/geofav_infowindow_pointer.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/infowindow_geofav_background.xml b/app/src/main/res/drawable/infowindow_geofav_background.xml new file mode 100644 index 0000000..a6a34a4 --- /dev/null +++ b/app/src/main/res/drawable/infowindow_geofav_background.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/layout/infowindow_geofav.xml b/app/src/main/res/layout/infowindow_geofav.xml new file mode 100644 index 0000000..f56062a --- /dev/null +++ b/app/src/main/res/layout/infowindow_geofav.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f77f048..4ca12b7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -48,4 +48,8 @@ @color/white + + \ No newline at end of file