Update qt layout

This commit is contained in:
Victor Shcherb 2014-11-20 18:10:17 +01:00
parent 4d8cc703f2
commit f1ef2fc31c
3 changed files with 8 additions and 3 deletions

View file

@ -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);

View file

@ -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 {

View file

@ -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 +