Merge pull request #1586 from deltachat/map_update_on_marker_deletion

remove pois from map
This commit is contained in:
bjoern
2020-08-19 16:20:00 +02:00
committed by GitHub
2 changed files with 21 additions and 0 deletions
@@ -42,6 +42,7 @@ import static com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_
import static com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED;
import static com.b44t.messenger.DcChat.DC_CHAT_NO_CHAT;
import static com.mapbox.mapboxsdk.constants.MapboxConstants.MINIMUM_ZOOM;
import static org.thoughtcrime.securesms.map.MapDataManager.CONTACT_ID;
import static org.thoughtcrime.securesms.map.MapDataManager.IS_POI;
import static org.thoughtcrime.securesms.map.MapDataManager.MARKER_SELECTED;
import static org.thoughtcrime.securesms.map.MapDataManager.MESSAGE_ID;
@@ -334,6 +335,11 @@ public class MapActivity extends BaseActivity implements Observer, TimeRangeSlid
int[] messages = new int[1];
messages[0] = messageId;
ApplicationContext.getInstance(MapActivity.this).dcContext.deleteMsgs(messages);
int contactId = feature.getNumberProperty(CONTACT_ID).intValue();
if (mapDataManager.isSelected(feature)) {
mapDataManager.unselectMarker();
}
mapDataManager.updateSource(contactId);
})
.setNegativeButton(R.string.no, null)
.show();
@@ -243,6 +243,10 @@ public class MapDataManager implements DcEventCenter.DcEventDelegate, GenerateIn
new GenerateInfoWindowTask(this).execute(selectedFeature);
}
public boolean isSelected(@NonNull Feature feature) {
return selectedFeature != null && selectedFeature.id().equals(feature.id());
}
/**
* Invoked when the bitmaps have been generated from a view.
*/
@@ -509,6 +513,17 @@ public class MapDataManager implements DcEventCenter.DcEventDelegate, GenerateIn
this).execute();
}
public void updateSource(int contactId) {
new DataCollectionTask(dcContext,
chatId,
new int[]{contactId},
contactMapSources,
featureCollections,
lastPositions,
boundingBuilder,
this).execute();
}
private void replaceSelectedMarker(String featureId) {
Feature feature = getFeatureWithId(featureId);
feature.addBooleanProperty(MARKER_SELECTED, true);