Add delete action to history menu

This commit is contained in:
PavelRatushny 2017-09-11 10:31:01 +03:00
parent 1810e5fcbf
commit aa64fcd47a
2 changed files with 13 additions and 1 deletions

View file

@ -252,6 +252,14 @@ public class MapMarkersHelper {
} }
} }
public void removeMarkerFromHistory(MapMarker marker) {
if (marker != null) {
markersDbHelper.removeMarkerFromHistory(marker);
loadMarkers();
refresh();
}
}
public List<MapMarker> getMapMarkers() { public List<MapMarker> getMapMarkers() {
return mapMarkers; return mapMarkers;
} }

View file

@ -82,7 +82,11 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
@Override @Override
public void onDeleteMarker(int pos) { public void onDeleteMarker(int pos) {
Object item = adapter.getItem(pos);
if (item instanceof MapMarker) {
app.getMapMarkersHelper().removeMarkerFromHistory((MapMarker) item);
adapter.notifyItemRemoved(pos);
}
} }
}; };
} }