fixed modal

This commit is contained in:
2026-06-15 11:04:34 +03:00
parent 2f303134c1
commit e20b81c817
3 changed files with 47 additions and 10 deletions
@@ -143,6 +143,7 @@ public class MapFragment extends Fragment {
private Bitmap bitmapHill;
private Marker hillMarker;
private Polyline hillPathLine;
private boolean hillActive;
private ElevationHeatmapLayer heatmapLayer;
private boolean heatmapActive;
private int heatmapRadiusM = 100;
@@ -204,7 +205,7 @@ public class MapFragment extends Fragment {
setupCenterModeToggle();
if (btnFindHill != null) {
btnFindHill.setOnClickListener(v -> findNearestHill());
btnFindHill.setOnClickListener(v -> toggleHill());
}
setupHeatmapUi();
@@ -879,6 +880,27 @@ public class MapFragment extends Fragment {
return null;
}
private void toggleHill() {
if (hillActive) {
deactivateHill();
return;
}
findNearestHill();
}
private void deactivateHill() {
hillActive = false;
if (btnFindHill != null) {
btnFindHill.setActivated(false);
btnFindHill.setEnabled(true);
}
clearHillLayers();
if (mapHillStatus != null) {
mapHillStatus.setVisibility(View.GONE);
}
requestMapInvalidate();
}
private void findNearestHill() {
if (uploader == null || !isAdded()) {
return;
@@ -918,6 +940,10 @@ public class MapFragment extends Fragment {
}
return;
}
hillActive = true;
if (btnFindHill != null) {
btnFindHill.setActivated(true);
}
showHillOnMap(lat, lon, result);
});
} catch (Exception e) {
@@ -1293,17 +1319,12 @@ public class MapFragment extends Fragment {
}
private boolean centerOnSelf() {
if (uploader == null) {
LatLong self = resolveSelfPosition();
if (self == null) {
return false;
}
String myId = uploader.getDeviceId();
for (DeviceInfo d : lastDevices) {
if (myId.equals(d.device_id) && GeoUtils.isValidCoordinate(d.lat, d.lon)) {
centerOnPoint(new LatLong(d.lat, d.lon), (byte) 14);
return true;
}
}
return false;
centerOnPoint(self, (byte) 14);
return true;
}
private boolean centerOnRole(String role) {