WIP Geofavorite infowindow

This commit is contained in:
Daniele Verducci 2024-02-19 21:42:31 +01:00
parent d762ffe40a
commit fd4a9c1f5d
6 changed files with 140 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.01dp"
android:height="10.67dp"
android:viewportWidth="960.34"
android:viewportHeight="426.7">
<path
android:fillColor="#FF000000"
android:pathData="M480.17,426.7C319.11,344.14 198.82,267.45 119.29,196.64 39.76,125.83 0,60.3 0,0.03c959.78,-0.23 -1.28,0.85 960.34,0 0,60.26 -39.76,125.8 -119.29,196.61 -79.53,70.81 -199.82,147.5 -360.88,230.06z"
android:strokeWidth="1.16465"/>
</vector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<stroke android:width="7dp" android:color="@color/defaultBrand" />
<corners android:radius="20dp"/>
</shape>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="250dp"
android:background="@drawable/infowindow_geofav_background"
android:padding="7dp"
android:orientation="vertical">
<TextView
android:id="@+id/bubble_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/defaultBrand"
android:padding="10dp"
android:lines="1"
android:ellipsize="end"
style="@style/TextAppearance.GeofavoriteInfowindow"
android:text="Lorem"/>
<TextView
android:id="@+id/bubble_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Lorem ipsum"/>
<TextView
android:id="@+id/bubble_subdescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="Lorem ipsum"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/action_icon_share"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:src="@drawable/ic_share"
app:tint="@color/defaultBrand"/>
<ImageView
android:id="@+id/action_icon_nav"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:src="@drawable/ic_nav"
app:tint="@color/defaultBrand"/>
<ImageView
android:id="@+id/action_icon_delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:src="@drawable/ic_delete_grey"
app:tint="@color/defaultBrand"/>
</LinearLayout>
<ImageView
android:id="@+id/bubble_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/geofav_infowindow_pointer"
app:tint="@color/defaultBrand" />
</LinearLayout>

View File

@ -48,4 +48,8 @@
<item name="android:textColor">@color/white</item>
</style>
<style name="TextAppearance.GeofavoriteInfowindow" parent="TextAppearance.AppCompat.Title">
<item name="android:textColor">@color/white</item>
</style>
</resources>