import android.os.PowerManager;\r
import android.util.DisplayMetrics;\r
import android.util.Log;\r
+import android.view.Display;\r
import android.view.Menu;\r
import android.view.MenuItem;\r
import android.view.inputmethod.InputMethodManager;\r
Log.e("Navit","**1**A "+startup_intent.getAction());\r
Log.e("Navit","**1**D "+startup_intent.getDataString());\r
\r
+ Display display_ = getWindowManager().getDefaultDisplay(); \r
+ int width_ = display_.getWidth();\r
+ int height_ = display_.getHeight();\r
+ metrics = new DisplayMetrics();\r
+ display_.getMetrics(Navit.metrics);\r
+ Log.e("Navit", "Navit -> pixels x=" + width_ + " pixels y=" + height_);\r
+ Log.e("Navit", "Navit -> dpi="+Navit.metrics.densityDpi);\r
+ Log.e("Navit", "Navit -> density="+Navit.metrics.density);\r
+ Log.e("Navit", "Navit -> scaledDensity="+Navit.metrics.scaledDensity);\r
+ \r
ActivityResults = new NavitActivityResult[16];\r
setVolumeControlStream(AudioManager.STREAM_MUSIC);\r
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);\r
{\r
Log.e("Navit", "Failed to extract language resource " + langc);\r
}\r
- if (!extractRes("navit", "/data/data/org.navitproject.navit/share/navit.xml"))\r
+\r
+ String my_display_density="mdpi";\r
+ // hdpi display\r
+ if (Navit.metrics.densityDpi == 240)\r
{\r
- Log.e("Navit", "Failed to extract navit.xml");\r
+ my_display_density="hdpi";\r
+ if (!extractRes("navithdpi", "/data/data/org.navitproject.navit/share/navit.xml"))\r
+ {\r
+ Log.e("Navit", "Failed to extract navit.xml for hdpi device(s)");\r
+ }\r
+ }\r
+ // mdpi display\r
+ else if (Navit.metrics.densityDpi == 160)\r
+ {\r
+ my_display_density="mdpi";\r
+ if (!extractRes("navitmdpi", "/data/data/org.navitproject.navit/share/navit.xml"))\r
+ {\r
+ Log.e("Navit", "Failed to extract navit.xml for mdpi device(s)");\r
+ }\r
+ }\r
+ // ldpi display\r
+ else if (Navit.metrics.densityDpi == 120)\r
+ {\r
+ my_display_density="ldpi";\r
+ if (!extractRes("navitldpi", "/data/data/org.navitproject.navit/share/navit.xml"))\r
+ {\r
+ Log.e("Navit", "Failed to extract navit.xml for ldpi device(s)");\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* default, meaning we just dont know what display this is */\r
+ if (!extractRes("navit", "/data/data/org.navitproject.navit/share/navit.xml"))\r
+ {\r
+ Log.e("Navit", "Failed to extract navit.xml (default version)");\r
+ }\r
}\r
-\r
// Debug.startMethodTracing("calc");\r
\r
- metrics = new DisplayMetrics();\r
- getWindowManager().getDefaultDisplay().getMetrics(metrics);\r
-\r
// --> dont use!! NavitMain(this, langu, android.os.Build.VERSION.SDK_INT);\r
Log.e("Navit", "android.os.Build.VERSION.SDK_INT="\r
+ Integer.valueOf(android.os.Build.VERSION.SDK));\r
- NavitMain(this, langu, Integer.valueOf(android.os.Build.VERSION.SDK));\r
+ NavitMain(this, langu, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density);\r
// CAUTION: don't use android.os.Build.VERSION.SDK_INT if <uses-sdk android:minSdkVersion="3" />\r
// You will get exception on all devices with Android 1.5 and lower\r
// because Build.VERSION.SDK_INT is since SDK 4 (Donut 1.6)\r
break;\r
case 3 :\r
this.exit();\r
+ // msg = new Message();\r
+ // b = new Bundle();\r
+ // b.putInt("Callback", 5);\r
+ // b.putString("cmd", "quit()");\r
+ // msg.setData(b);\r
+ // N_NavitGraphics.callback_handler.sendMessage(msg);\r
break;\r
}\r
return true;\r
* 'hello-jni' native library, which is packaged\r
* with this application.\r
*/\r
- public native void NavitMain(Navit x, String lang, int version);\r
+ public native void NavitMain(Navit x, String lang, int version, String display_density_string);\r
public native void NavitActivity(int activity);\r
\r
/*\r