Comments, logging

master
sh123 2022-08-29 20:20:48 +03:00
rodzic a91a11a999
commit d77f79f89a
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -110,6 +110,7 @@ public class MapActivity extends AppCompatActivity {
_myLocationNewOverlay.setDirectionIcon(myBitmapIcon); _myLocationNewOverlay.setDirectionIcon(myBitmapIcon);
_myLocationNewOverlay.setPersonIcon(myBitmapIcon); _myLocationNewOverlay.setPersonIcon(myBitmapIcon);
// my location overlay
_myLocationNewOverlay.enableMyLocation(); _myLocationNewOverlay.enableMyLocation();
_myLocationNewOverlay.runOnFirstFix(() -> runOnUiThread(() -> { _myLocationNewOverlay.runOnFirstFix(() -> runOnUiThread(() -> {
_mapController.setCenter(_myLocationNewOverlay.getMyLocation()); _mapController.setCenter(_myLocationNewOverlay.getMyLocation());
@ -121,7 +122,9 @@ public class MapActivity extends AppCompatActivity {
_logItemViewModel = new ViewModelProvider(this).get(LogItemViewModel.class); _logItemViewModel = new ViewModelProvider(this).get(LogItemViewModel.class);
_logItemViewModel.getGroups().observe(this, logItemGroups -> { _logItemViewModel.getGroups().observe(this, logItemGroups -> {
for (LogItemGroup group : logItemGroups) { for (LogItemGroup group : logItemGroups) {
addIcon(group); if (!addIcon(group)) {
Log.e(TAG, "Failed to add APRS icon");
}
} }
}); });
} }
@ -152,13 +155,12 @@ public class MapActivity extends AppCompatActivity {
// construct and calculate bounds // construct and calculate bounds
Paint paint = new Paint(); Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL); paint.setStyle(Paint.Style.FILL);
Rect bounds = new Rect(); Rect bounds = new Rect();
paint.getTextBounds(callsign, 0, callsign.length(), bounds); paint.getTextBounds(callsign, 0, callsign.length(), bounds);
int width = Math.max(bitmapIcon.getWidth(), bounds.width()); int width = Math.max(bitmapIcon.getWidth(), bounds.width());
int height = bitmapIcon.getHeight() + bounds.height(); int height = bitmapIcon.getHeight() + bounds.height();
// create overlay bitmap
Bitmap bitmap = Bitmap.createBitmap(width, height, null); Bitmap bitmap = Bitmap.createBitmap(width, height, null);
bitmap.setDensity(DisplayMetrics.DENSITY_DEFAULT); bitmap.setDensity(DisplayMetrics.DENSITY_DEFAULT);