From f77ed0f0f8c7bfaedd8ebba45b6fae9bc6bddd98 Mon Sep 17 00:00:00 2001 From: rikky Date: Sat, 20 Aug 2011 22:47:03 +0000 Subject: [PATCH] Fix:android:Fix building for android 1.5 git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4688 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/android/AndroidManifest.xml.cmake | 2 +- navit/navit/android/src/org/navitproject/navit/Navit.java | 9 +++++---- .../navit/android/src/org/navitproject/navit/NavitGraphics.java | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/navit/navit/android/AndroidManifest.xml.cmake b/navit/navit/android/AndroidManifest.xml.cmake index 6e23ac8..e7784f0 100644 --- a/navit/navit/android/AndroidManifest.xml.cmake +++ b/navit/navit/android/AndroidManifest.xml.cmake @@ -25,7 +25,7 @@ - + @ANDROID_PERMISSIONS@ diff --git a/navit/navit/android/src/org/navitproject/navit/Navit.java b/navit/navit/android/src/org/navitproject/navit/Navit.java index cb1decc..b2c3b72 100644 --- a/navit/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/navit/android/src/org/navitproject/navit/Navit.java @@ -394,8 +394,9 @@ public class Navit extends Activity implements Handler.Callback int height_ = display_.getHeight(); metrics = new DisplayMetrics(); display_.getMetrics(Navit.metrics); + int densityDpi = (int)(( Navit.metrics.density*160)+.5f); Log.e("Navit", "Navit -> pixels x=" + width_ + " pixels y=" + height_); - Log.e("Navit", "Navit -> dpi=" + Navit.metrics.densityDpi); + Log.e("Navit", "Navit -> dpi=" + densityDpi); Log.e("Navit", "Navit -> density=" + Navit.metrics.density); Log.e("Navit", "Navit -> scaledDensity=" + Navit.metrics.scaledDensity); @@ -410,15 +411,15 @@ public class Navit extends Activity implements Handler.Callback Log.e("Navit", "Failed to extract language resource " + langc); } - if (Navit.metrics.densityDpi <= 120) + if (densityDpi <= 120) { my_display_density = "ldpi"; } - else if (Navit.metrics.densityDpi <= 160) + else if (densityDpi <= 160) { my_display_density = "mdpi"; } - else if (Navit.metrics.densityDpi < 320) + else if (densityDpi < 320) { my_display_density = "hdpi"; } diff --git a/navit/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/navit/android/src/org/navitproject/navit/NavitGraphics.java index be52360..544e184 100644 --- a/navit/navit/android/src/org/navitproject/navit/NavitGraphics.java +++ b/navit/navit/android/src/org/navitproject/navit/NavitGraphics.java @@ -241,7 +241,6 @@ public class NavitGraphics protected void onSizeChanged(int w, int h, int oldw, int oldh) { Log.e("Navit", "NavitGraphics -> onSizeChanged pixels x=" + w + " pixels y=" + h); - Log.e("Navit", "NavitGraphics -> onSizeChanged dpi=" + Navit.metrics.densityDpi); Log.e("Navit", "NavitGraphics -> onSizeChanged density=" + Navit.metrics.density); Log.e("Navit", "NavitGraphics -> onSizeChanged scaledDensity=" + Navit.metrics.scaledDensity); -- 2.7.4