From f1ef2fc31c049ad3ed410d8bd4a41ed0809d9fcb Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 20 Nov 2014 18:10:17 +0100 Subject: [PATCH] Update qt layout --- OsmAnd/src/net/osmand/core/android/GLActivity.java | 2 +- OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java | 1 - .../net/osmand/plus/views/corenative/NativeQtLibrary.java | 8 +++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/core/android/GLActivity.java b/OsmAnd/src/net/osmand/core/android/GLActivity.java index fd588dd5fb..2f1bb121d1 100644 --- a/OsmAnd/src/net/osmand/core/android/GLActivity.java +++ b/OsmAnd/src/net/osmand/core/android/GLActivity.java @@ -158,7 +158,7 @@ public class GLActivity extends Activity { // Get device display density factor DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - _displayDensityFactor = displayMetrics.densityDpi / 160.0f; + _displayDensityFactor = displayMetrics.density; _referenceTileSize = (int)(256 * _displayDensityFactor); _rasterTileSize = Integer.highestOneBit(_referenceTileSize - 1) * 2; Log.i(TAG, "displayDensityFactor = " + _displayDensityFactor); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 615e79dee6..1198067212 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -54,7 +54,6 @@ import android.view.SurfaceView; import android.view.View; import android.view.ViewParent; import android.view.WindowManager; -import android.widget.FrameLayout; import android.widget.Toast; public class OsmandMapTileView implements IMapDownloaderCallback { diff --git a/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java b/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java index 1fbfb61893..384e83d55b 100644 --- a/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java +++ b/OsmAnd/src/net/osmand/plus/views/corenative/NativeQtLibrary.java @@ -117,7 +117,13 @@ public class NativeQtLibrary { // DisplayMetrics displayMetrics = new DisplayMetrics(); // act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics(); - float displayDensityFactor = displayMetrics.densityDpi / 160.0f; + // TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1)) + float scaleCoefficient = displayMetrics.density; + if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) { + // large screen + scaleCoefficient *= 1.5f; + } + float displayDensityFactor = scaleCoefficient; int referenceTileSize = (int)(256 * displayDensityFactor); int rasterTileSize = Integer.highestOneBit(referenceTileSize - 1) * 2; Log.i(NATIVE_TAG, "displayDensityFactor = " + displayDensityFactor +