Styled category label in infowindow
This commit is contained in:
@ -159,7 +159,7 @@ public class GeofavoriteMapFragment extends GeofavoritesFragment implements Main
|
||||
|
||||
// Set icon and color
|
||||
Drawable icon = DrawableCompat.wrap(AppCompatResources.getDrawable(requireContext(), R.drawable.ic_list_pin));
|
||||
DrawableCompat.setTint(icon, geofavorite.categoryColor());
|
||||
DrawableCompat.setTint(icon, geofavorite.categoryColor() == 0 ? requireContext().getColor(R.color.defaultBrand) : geofavorite.categoryColor());
|
||||
|
||||
// Set infowindow (popup opened on marker click) and its listeners
|
||||
GeofavMarkerInfoWindow iw = new GeofavMarkerInfoWindow(map, geofavorite);
|
||||
|
@ -1,7 +1,12 @@
|
||||
package it.danieleverducci.nextcloudmaps.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
import org.osmdroid.views.MapView;
|
||||
import org.osmdroid.views.overlay.infowindow.InfoWindow;
|
||||
import org.osmdroid.views.overlay.infowindow.MarkerInfoWindow;
|
||||
@ -14,7 +19,14 @@ public class GeofavMarkerInfoWindow extends MarkerInfoWindow implements View.OnC
|
||||
|
||||
public GeofavMarkerInfoWindow(MapView mapView, Geofavorite geofavorite) {
|
||||
super(R.layout.infowindow_geofav, mapView);
|
||||
Context context = getView().getContext();
|
||||
|
||||
// Set category color
|
||||
View category = getView().findViewById(R.id.bubble_subdescription);
|
||||
Drawable backgroundDrawable = category.getBackground();
|
||||
DrawableCompat.setTint(backgroundDrawable, geofavorite.categoryColor() == 0 ? context.getColor(R.color.defaultBrand) : geofavorite.categoryColor());
|
||||
|
||||
// Set listeners
|
||||
getView().findViewById(R.id.action_icon_share).setOnClickListener(this);
|
||||
getView().findViewById(R.id.action_icon_nav).setOnClickListener(this);
|
||||
getView().findViewById(R.id.action_icon_delete).setOnClickListener(this);
|
||||
|
Reference in New Issue
Block a user