diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 9de343ff3d..71a101ce62 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -372,6 +372,18 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon if (android.os.Build.VERSION.SDK_INT >= 14) { //Scale web view font size with system font size settings.setTextZoom((int) (ctx.getResources().getDisplayMetrics().density * 100f)); + } else { + if (ctx.getResources().getDisplayMetrics().density <= 0.5f) { + settings.setTextSize(settings.TextSize.SMALLEST); + } else if (ctx.getResources().getDisplayMetrics().density <= 0.75f) { + settings.setTextSize(settings.TextSize.SMALLER); + } else if (ctx.getResources().getDisplayMetrics().density <= 1.0f) { + settings.setTextSize(settings.TextSize.NORMAL); + } else if (ctx.getResources().getDisplayMetrics().density <= 1.5f) { + settings.setTextSize(settings.TextSize.LARGER); + } else { + settings.setTextSize(settings.TextSize.LARGEST); + } } wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null); diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/ContextMenuHelper.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/ContextMenuHelper.java index 3aa25201cc..62f7cf1fc1 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/ContextMenuHelper.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/ContextMenuHelper.java @@ -108,6 +108,18 @@ public class ContextMenuHelper { if (android.os.Build.VERSION.SDK_INT >= 14) { //Scale web view font size with system font size settings.setTextZoom((int) (ctx.getResources().getDisplayMetrics().density * 100f)); + } else { + if (ctx.getResources().getDisplayMetrics().density <= 0.5f) { + settings.setTextSize(settings.TextSize.SMALLEST); + } else if (ctx.getResources().getDisplayMetrics().density <= 0.75f) { + settings.setTextSize(settings.TextSize.SMALLER); + } else if (ctx.getResources().getDisplayMetrics().density <= 1.0f) { + settings.setTextSize(settings.TextSize.NORMAL); + } else if (ctx.getResources().getDisplayMetrics().density <= 1.5f) { + settings.setTextSize(settings.TextSize.LARGER); + } else { + settings.setTextSize(settings.TextSize.LARGEST); + } } wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);