Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion app/src/main/java/net/osmtracker/activity/DisplayTrackMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -187,6 +188,8 @@ public void onCreate(Bundle savedInstanceState) {

selectTileSource();

setTileDpiScaling();

createOverlays();

// Create content observer for trackpoints
Expand Down Expand Up @@ -220,6 +223,14 @@ public void selectTileSource() {
Log.e("TileMapName active", mapTile);
osmView.setTileSource(selectMapTile(mapTile));
}

/**
* Make text on map better readable on high DPI displays
*/
public void setTileDpiScaling () {
osmView.setTilesScaledToDpi(true);
}


/**
* Returns a ITileSource for the map according to the selected mapTile
Expand Down Expand Up @@ -278,6 +289,8 @@ private void resumeActivity(){

selectTileSource();

setTileDpiScaling();

// Refresh way points
wayPointsOverlay.refresh();

Expand Down Expand Up @@ -355,7 +368,12 @@ public boolean onTouchEvent(MotionEvent event) {
* Creates overlays over the OSM view
*/
private void createOverlays() {
pathOverlay = new PathOverlay(Color.BLUE, this);
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);

// set with to hopefully DPI independent 0.5mm
pathOverlay = new PathOverlay(Color.BLUE, (float)(metrics.densityDpi / 25.4 / 2),this);

osmView.getOverlays().add(pathOverlay);

myLocationOverlay = new SimpleLocationOverlay(this);
Expand Down