diff --git a/app/src/main/java/com/grigowashere/loratester/ui/MapFragment.java b/app/src/main/java/com/grigowashere/loratester/ui/MapFragment.java
index 520f552..671e900 100644
--- a/app/src/main/java/com/grigowashere/loratester/ui/MapFragment.java
+++ b/app/src/main/java/com/grigowashere/loratester/ui/MapFragment.java
@@ -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) {
diff --git a/server/fastapi_app.py b/server/fastapi_app.py
index 596226c..ff731fb 100644
--- a/server/fastapi_app.py
+++ b/server/fastapi_app.py
@@ -7,6 +7,7 @@ from typing import Any, Optional
from fastapi import FastAPI, Header, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse
+from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel, Field
from core.auth import ANDROID_CLIENT_HEADER, ANDROID_CLIENT_VALUE
@@ -370,6 +371,9 @@ def health():
}
+app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
+
+
if __name__ == "__main__":
import uvicorn
diff --git a/server/static/index.html b/server/static/index.html
index fc5fb31..775d9cd 100644
--- a/server/static/index.html
+++ b/server/static/index.html
@@ -321,6 +321,18 @@
+