From aefa85db918cd8026814ad12802fc319dea18699 Mon Sep 17 00:00:00 2001 From: jandegr Date: Tue, 29 Oct 2019 16:54:35 +0100 Subject: Fix:Android:fixes (#919) --- .circleci/config.yml | 3 - navit/android.c | 39 +- navit/android/AndroidManifest.xml | 11 +- navit/android/build.gradle | 9 +- navit/android/res/xml/navit_backup_rules.xml | 4 + .../android/src/org/navitproject/navit/Navit.java | 230 ++---- .../navit/NavitAddressSearchActivity.java | 8 +- .../org/navitproject/navit/NavitBackupTask.java | 10 +- .../navitproject/navit/NavitCallbackHandler.java | 84 ++ .../src/org/navitproject/navit/NavitDialogs.java | 8 +- .../navit/NavitDownloadSelectMapActivity.java | 11 +- .../src/org/navitproject/navit/NavitGraphics.java | 105 +-- .../org/navitproject/navit/NavitMapDownloader.java | 899 +++++++++++---------- .../org/navitproject/navit/NavitRestoreTask.java | 12 +- .../src/org/navitproject/navit/NavitUtils.java | 6 + .../src/org/navitproject/navit/NavitVehicle.java | 1 + 16 files changed, 693 insertions(+), 747 deletions(-) create mode 100644 navit/android/res/xml/navit_backup_rules.xml create mode 100644 navit/android/src/org/navitproject/navit/NavitCallbackHandler.java diff --git a/.circleci/config.yml b/.circleci/config.yml index de3a79e1e..d1a085d23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,9 +82,6 @@ jobs: command: | sudo apt-get update sudo apt-get install -y ant cmake gettext libsaxonb-java librsvg2-bin pkg-config rename - - run: - name: Install Android SDK components - command: sdkmanager "cmake;3.6.4111459" - run: name: Install ndk command: | diff --git a/navit/android.c b/navit/android.c index 4b73b3f5e..214e3171c 100644 --- a/navit/android.c +++ b/navit/android.c @@ -356,15 +356,16 @@ JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_getCoordForP return return_string; } -JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_callbackMessageChannel( JNIEnv* env, jclass thiz, - jint channel, jstring str) { + +JNIEXPORT jobject JNICALL Java_org_navitproject_navit_NavitCallbackHandler_callbackCmdChannel( JNIEnv* env, + jclass thiz, jint command) { + struct attr attr; const char *s; - jint ret = 0; - dbg(lvl_debug,"enter %d %p",channel,str); + dbg(lvl_debug,"enter %d\n",command); config_get_attr(config_get(), attr_navit, &attr, NULL); - switch(channel) { + switch(command) { case 1: // zoom in navit_zoom_in_cursor(attr.u.navit, 2); @@ -375,6 +376,34 @@ JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_callbackMessage navit_zoom_out_cursor(attr.u.navit, 2); navit_draw(attr.u.navit); break; + case 3: + // block + navit_block(attr.u.navit, 1); + break; + case 4: + // unblock + navit_block(attr.u.navit, 0); + break; + case 5: + // cancel route + navit_set_destination(attr.u.navit, NULL, NULL, 0); + navit_draw(attr.u.navit); + break; + default: + dbg(lvl_error, "Unknown command: %d", command); + break; + } +} + +JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitCallbackHandler_callbackMessageChannel( JNIEnv* env, + jclass thiz, jint channel, jstring str) { + struct attr attr; + const char *s; + jint ret = 0; + dbg(lvl_debug,"enter %d %p",channel,str); + config_get_attr(config_get(), attr_navit, &attr, NULL); + + switch(channel) { case 6: {// add a map to the current mapset, return 1 on success struct mapset *ms = navit_get_mapset(attr.u.navit); struct attr type, name, data, *attrs[4]; diff --git a/navit/android/AndroidManifest.xml b/navit/android/AndroidManifest.xml index 2bcdb4e19..5978512ed 100644 --- a/navit/android/AndroidManifest.xml +++ b/navit/android/AndroidManifest.xml @@ -10,14 +10,17 @@ - + android:name=".NavitAppConfig"> diff --git a/navit/android/build.gradle b/navit/android/build.gradle index 87eeb63cc..55455958a 100644 --- a/navit/android/build.gradle +++ b/navit/android/build.gradle @@ -3,12 +3,12 @@ apply from: "$project.rootDir/gradle/scripts/git-scm-version.gradle" apply plugin: 'checkstyle' android { - compileSdkVersion 28 + compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "org.navitproject.navit" minSdkVersion 10 - targetSdkVersion 28 + targetSdkVersion 29 versionCode gitVersionCode versionName gitVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -17,7 +17,7 @@ android { } externalNativeBuild { cmake { - arguments '-DUSE_PLUGINS=n', '-DBUILD_MAPTOOL=n', '-DXSL_PROCESSING=y', '-DXSLTS=android', '-DANDROID=y', '-DSAMPLE_MAP=n' + arguments '-DUSE_PLUGINS=n', '-DBUILD_MAPTOOL=n', '-DXSL_PROCESSING=n', '-DSAMPLE_MAP=n' } } } @@ -74,9 +74,10 @@ android { applicationVariants.all { variant -> // create tasks to generate Javadocs task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + source = android.sourceSets.main.java.srcDirs destinationDir = file("build/outputs/docs/javadoc/") title = rootProject.name + options.memberLevel = JavadocMemberLevel.PACKAGE verbose = true failOnError false } diff --git a/navit/android/res/xml/navit_backup_rules.xml b/navit/android/res/xml/navit_backup_rules.xml new file mode 100644 index 000000000..1343fe2bc --- /dev/null +++ b/navit/android/res/xml/navit_backup_rules.xml @@ -0,0 +1,4 @@ + + + + diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java index 2fa2f312d..bacc15213 100644 --- a/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/android/src/org/navitproject/navit/Navit.java @@ -73,84 +73,8 @@ import java.util.regex.Pattern; public class Navit extends Activity { - /** - * Nested class storing the intent that was sent to the main navit activity at startup. - **/ - private class StartupIntent { - /** - * Constructor. - * - * @param intent The intent to store in this object - **/ - public StartupIntent(Intent intent) { - mStartupIntent = intent; - mStartupIntentTimestamp = System.currentTimeMillis(); - } - - /** - * Check if the encapsulated intent still valid or too old. - * - * @return true if the encapsulated intent is recent enough - **/ - public boolean isRecentEnough() { - if (mStartupIntent == null) { - return false; - } - /* We consider the intent is valid for 4s */ - return (System.currentTimeMillis() <= getExpirationTimeMillis()); - } - - /** - * Compute the system time when the stored intent will become invalid. - * - * @return The system time for invalidation (in ms) - **/ - private long getExpirationTimeMillis() { - if (mStartupIntent == null) { - return 0; - } - /* We give 4s to navit to process the intent */ - return mStartupIntentTimestamp + 4000L; - } - /** - * Getter for the encapsulated intent. - * - * @return The encapsulated intent - **/ - public Intent getIntent() { - return mStartupIntent; - } - - /** - * Represent this object as a string. - * - * @return A string containing the summary of the data we store here - **/ - public String toString() { - if (mStartupIntent == null) { - return "{null}"; - } else { - String validForStr; - long remainingValidity = getExpirationTimeMillis() - System.currentTimeMillis(); - if (remainingValidity < 0) { - validForStr = "(expired since " + -remainingValidity + "ms)"; - } else { - validForStr = "(valid for " + remainingValidity + "ms)"; - } - return "{ act=" + mStartupIntent.getAction() + " data=" + mStartupIntent.getDataString() - + " " + validForStr + " }"; - } - } - - private Intent mStartupIntent; /*!< The intent we store */ - private long mStartupIntentTimestamp; /*!< A timestamp (in ms) for when mStartupIntent was recorded */ - } - - - public static DisplayMetrics sMetrics; public static boolean sShowSoftKeyboardShowing; - private static StartupIntent sStartupIntent; private static final int MY_PERMISSIONS_REQ_FINE_LOC = 103; private static final int NavitDownloaderSelectMap_id = 967; private static final int NavitAddressSearch_id = 70; @@ -158,7 +82,6 @@ public class Navit extends Activity { private static final String NAVIT_PACKAGE_NAME = "org.navitproject.navit"; private static final String TAG = "Navit"; static String sMapFilenamePath; - static String sNavitDataDir; boolean mIsFullscreen; private NavitDialogs mDialogs; private PowerManager.WakeLock mWakeLock; @@ -287,7 +210,7 @@ public class Navit extends Activity { } /** - * Show the first start infoxbox (presentation of navit and link website for more info). + * Show the first start infobox (presentation of navit and link website for more info). **/ private void showInfos() { SharedPreferences settings = getSharedPreferences(NavitAppConfig.NAVIT_PREFS, MODE_PRIVATE); @@ -335,17 +258,12 @@ public class Navit extends Activity { @Override public void onCreate(Bundle savedInstanceState) { - Log.d(TAG, "OnCreate"); + Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); windowSetup(); mDialogs = new NavitDialogs(this); - /* Only store the startup intent, onResume() gets called all the time (e.g. when screenblanks, etc.) and - will process this intent later on if needed */ - sStartupIntent = new StartupIntent(this.getIntent()); - Log.d(TAG, "Recording intent " + sStartupIntent.toString()); - createNotificationChannel(); buildNotification(); verifyPermissions(); @@ -369,34 +287,34 @@ public class Navit extends Activity { Log.d(TAG, "Language " + lang); SharedPreferences prefs = getSharedPreferences(NavitAppConfig.NAVIT_PREFS,MODE_PRIVATE); - sNavitDataDir = getApplicationContext().getFilesDir().getPath(); + String navitDataDir = getApplicationContext().getFilesDir().getPath(); String candidateFileNamePath = getApplicationContext().getExternalFilesDir(null).toString(); sMapFilenamePath = prefs.getString("filenamePath", candidateFileNamePath + '/'); - Log.i(TAG,"NavitDataDir = " + sNavitDataDir); + Log.i(TAG,"NavitDataDir = " + navitDataDir); Log.i(TAG,"mapFilenamePath = " + sMapFilenamePath); // make sure the new path for the navitmap.bin file(s) exist!! File navitMapsDir = new File(sMapFilenamePath); navitMapsDir.mkdirs(); // make sure the share dir exists - File navitDataShareDir = new File(sNavitDataDir + "/share"); + File navitDataShareDir = new File(navitDataDir + "/share"); navitDataShareDir.mkdirs(); Display display = getWindowManager().getDefaultDisplay(); - sMetrics = new DisplayMetrics(); - display.getMetrics(sMetrics); - int densityDpi = (int)((sMetrics.density * 160) - .5f); + DisplayMetrics metrics = new DisplayMetrics(); + display.getMetrics(metrics); + int densityDpi = (int)((metrics.density * 160) - .5f); Log.d(TAG, "-> pixels x=" + display.getWidth() + " pixels y=" + display.getHeight()); Log.d(TAG, "-> dpi=" + densityDpi); - Log.d(TAG, "-> density=" + sMetrics.density); - Log.d(TAG, "-> scaledDensity=" + sMetrics.scaledDensity); + Log.d(TAG, "-> density=" + metrics.density); + Log.d(TAG, "-> scaledDensity=" + metrics.scaledDensity); mActivityResults = new NavitActivityResult[16]; setVolumeControlStream(AudioManager.STREAM_MUSIC); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"navit:DoNotDimScreen"); - if (!extractRes(langc, sNavitDataDir + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) { + if (!extractRes(langc, navitDataDir + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) { Log.e(TAG, "Failed to extract language resource " + langc); } @@ -425,7 +343,7 @@ public class Navit extends Activity { String[] children = assetMgr.list("config/" + myDisplayDensity); for (String child : children) { Log.d(TAG, "Processing config file '" + child + "' from assets"); - if (!extractAsset("config/" + myDisplayDensity + "/" + child, sNavitDataDir + "/share/" + child)) { + if (!extractAsset("config/" + myDisplayDensity + "/" + child, navitDataDir + "/share/" + child)) { Log.e(TAG, "Failed to extract asset config/" + myDisplayDensity + "/" + child); } } @@ -433,8 +351,26 @@ public class Navit extends Activity { Log.e(TAG, "Failed to access assets using AssetManager"); } Log.d(TAG, "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(Build.VERSION.SDK)); - navitMain(navitLanguage, sNavitDataDir + "/bin/navit", sMapFilenamePath); + navitMain(navitLanguage, navitDataDir + "/bin/navit", sMapFilenamePath); showInfos(); + + Intent startupIntent = new Intent(this.getIntent()); + Log.d(TAG, "onCreate intent " + startupIntent.toString()); + handleIntent(startupIntent); + } + + private void handleIntent(Intent intent) { + String naviScheme = intent.getScheme(); + if (naviScheme != null) { + Log.d(TAG, "Using intent " + intent.toString()); + if (naviScheme.equals("google.navigation")) { + parseNavigationURI(intent.getData().getSchemeSpecificPart()); + } else if (naviScheme.equals("geo") + && intent.getAction().equals("android.intent.action.VIEW")) { + invokeCallbackOnGeo(intent.getData().getSchemeSpecificPart(), + NavitCallbackHandler.MsgType.CLB_SET_DESTINATION, ""); + } + } } private void windowSetup() { @@ -491,58 +427,32 @@ public class Navit extends Activity { public void onRestart() { super.onRestart(); - Log.d(TAG, "OnRestart"); + Log.d(TAG, "onRestart"); } public void onStart() { super.onStart(); - Log.d(TAG, "OnStart"); + Log.d(TAG, "onStart"); } @Override public void onNewIntent(Intent intent) { - Log.d(TAG, "OnNewIntent"); - sStartupIntent = new StartupIntent(intent); - Log.d(TAG, "Recording intent " + sStartupIntent.toString()); + Log.d(TAG, "onNewIntent"); + handleIntent(intent); } @Override public void onResume() { super.onResume(); - Log.d(TAG, "OnResume"); - //InputMethodManager sInputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - // DEBUG - // intent_data = "google.navigation:q=Wien Burggasse 27"; - // intent_data = "google.navigation:q=48.25676,16.643"; - // intent_data = "google.navigation:ll=48.25676,16.643&q=blabla-strasse"; - // intent_data = "google.navigation:ll=48.25676,16.643"; - // intent_data = "geo:48.25676,16.643"; - if (sStartupIntent != null) { - Log.d(TAG, "Using stored startup intent " + sStartupIntent.toString()); - if (sStartupIntent.isRecentEnough()) { - Intent startupIntent = sStartupIntent.getIntent(); - String naviScheme = startupIntent.getScheme(); - if (naviScheme != null) { - if (naviScheme.equals("google.navigation")) { - parseNavigationURI(startupIntent.getData().getSchemeSpecificPart()); - } else if (naviScheme.equals("geo") - && startupIntent.getAction().equals("android.intent.action.VIEW")) { - invokeCallbackOnGeo(startupIntent.getData().getSchemeSpecificPart(), - NavitGraphics.MsgType.CLB_SET_DESTINATION, - ""); - } - } - } else { - Log.e(TAG, "timestamp for startup intent expired! not using data"); - } - sStartupIntent = null; - } + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_UNBLOCK); + Log.d(TAG, "onResume"); } @Override public void onPause() { super.onPause(); - Log.d(TAG, "OnPause"); + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_BLOCK); + Log.d(TAG, "onPause"); } @Override @@ -567,30 +477,30 @@ public class Navit extends Activity { } /** - * Invoke NavitGraphics.sCallbackHandler on a geographical position + * Invoke CallbackHandler on a geographical position. * * @param geoString A string containing the target geographical position with a format like "48.25676,16.643" - * @param msgType The type of message to send to the callback (see NavitGraphics.MsgType for possible values) + * @param msgType The type of message to send * @param name The name/label to associate to the geographical position **/ - private void invokeCallbackOnGeo(String geoString, NavitGraphics.MsgType msgType, String name) { + private void invokeCallbackOnGeo(String geoString, NavitCallbackHandler.MsgType msgType, String name) { String[] geo = geoString.split(","); if (geo.length == 2) { try { Bundle b = new Bundle(); - Float lat = Float.valueOf(geo[0]); - Float lon = Float.valueOf(geo[1]); + float lat = Float.parseFloat(geo[0]); + float lon = Float.parseFloat(geo[1]); b.putFloat("lat", lat); b.putFloat("lon", lon); b.putString("q", name); - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, msgType.ordinal()); msg.setData(b); msg.sendToTarget(); Log.d(TAG, "target found (b): " + geoString); } catch (NumberFormatException e) { - e.printStackTrace(); + Log.e(TAG,"numberFormatException"); } } else { Log.w(TAG, "Ignoring invalid geo string: " + geoString); @@ -598,7 +508,7 @@ public class Navit extends Activity { } /** - * Parse google navigation URIs (usually starting with "google.navigation:") and take the appropriate actions + * Parse google navigation URIs (usually starting with "google.navigation:") and take the appropriate actions. * * @param schemeSpecificPart A string containing the URI scheme, for example "ll=48.25676,16.643&q=blabla-strasse" **/ @@ -628,7 +538,7 @@ public class Navit extends Activity { if (geoString != null) { if (geoString.matches("^[+-]{0,1}\\d+(|\\.\\d*),[+-]{0,1}\\d+(|\\.\\d*)$")) { - invokeCallbackOnGeo(geoString, NavitGraphics.MsgType.CLB_SET_DESTINATION, address); + invokeCallbackOnGeo(geoString, NavitCallbackHandler.MsgType.CLB_SET_DESTINATION, address); } else { start_targetsearch_from_intent(geoString); } @@ -683,15 +593,13 @@ public class Navit extends Activity { switch (id) { case 1 : // zoom in - Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_ZOOM_IN.ordinal()).sendToTarget(); + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_ZOOM_IN); // if we zoom, hide the bubble Log.d(TAG, "onOptionsItemSelected -> zoom in"); break; case 2 : // zoom out - Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_ZOOM_OUT.ordinal()).sendToTarget(); + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_ZOOM_OUT); // if we zoom, hide the bubble Log.d(TAG, "onOptionsItemSelected -> zoom out"); break; @@ -702,21 +610,22 @@ public class Navit extends Activity { break; case 5 : // toggle the normal POI layers and labels (to avoid double POIs) - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_CALL_CMD.ordinal()); + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_CALL_CMD.ordinal()); Bundle b = new Bundle(); b.putString("cmd", "toggle_layer(\"POI Symbols\");"); msg.setData(b); msg.sendToTarget(); - - msg = Message.obtain(NavitGraphics.sCallbackHandler, NavitGraphics.MsgType.CLB_CALL_CMD.ordinal()); + msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_CALL_CMD.ordinal()); b = new Bundle(); b.putString("cmd", "toggle_layer(\"POI Labels\");"); msg.setData(b); msg.sendToTarget(); // toggle full POI icons on/off - msg = Message.obtain(NavitGraphics.sCallbackHandler, NavitGraphics.MsgType.CLB_CALL_CMD.ordinal()); + msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_CALL_CMD.ordinal()); b = new Bundle(); b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");"); msg.setData(b); @@ -768,7 +677,8 @@ public class Navit extends Activity { Log.d(TAG, "showNativeKeyboard"); Configuration config = getResources().getConfiguration(); if ((config.keyboard == Configuration.KEYBOARD_QWERTY) - && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)) { + && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) + && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P)) { /* physical keyboard present */ return 0; } @@ -777,7 +687,6 @@ public class Navit extends Activity { ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED); sShowSoftKeyboardShowing = true; - return 1; } @@ -793,20 +702,6 @@ public class Navit extends Activity { } - void setDestination(float latitude, float longitude, String address) { - Toast.makeText(getApplicationContext(), getTstring(R.string.address_search_set_destination) + "\n" - + address, Toast.LENGTH_LONG).show(); //TRANS - - Bundle b = new Bundle(); - b.putFloat("lat", latitude); - b.putFloat("lon", longitude); - b.putString("q", address); - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_SET_DESTINATION.ordinal()); - msg.setData(b); - msg.sendToTarget(); - } - protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case Navit.NavitDownloaderSelectMap_id : @@ -823,8 +718,8 @@ public class Navit extends Activity { getTstring(R.string.address_search_set_destination) + "\n" + destination.getString(("q")), Toast.LENGTH_LONG).show(); //TRANS - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_SET_DESTINATION.ordinal()); + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_SET_DESTINATION.ordinal()); msg.setData(destination); msg.sendToTarget(); } @@ -887,7 +782,7 @@ public class Navit extends Activity { @Override public void onDestroy() { super.onDestroy(); - Log.d(TAG, "OnDestroy"); + Log.d(TAG, "onDestroy"); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.cancelAll(); NavitVehicle.removeListeners(this); @@ -897,7 +792,7 @@ public class Navit extends Activity { public void onStop() { super.onStop(); - Log.d(TAG, "OnStop"); + Log.d(TAG, "onStop"); } @@ -916,6 +811,7 @@ public class Navit extends Activity { } + @SuppressWarnings("unused") void disableSuspend() { mWakeLock.acquire(); mWakeLock.release(); diff --git a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java index 3c0c489d1..9e851f2b1 100644 --- a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java +++ b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java @@ -85,8 +85,6 @@ public class NavitAddressSearchActivity extends Activity { private int mSearchResultsStreets = 0; private int mSearchResultsStreetsHn = 0; private long mSearchHandle = 0; - - // TODO remember settings private static String sLastAddressSearchString = ""; private static Boolean sLastAddressPartialMatch = false; private static String sLastCountry = ""; @@ -107,10 +105,9 @@ public class NavitAddressSearchActivity extends Activity { // We have all images stored as drawable_nodpi resources which allows native code to manipulate them // without interference with android builtin choosing and scaling system. But that makes us to // reinvent the wheel here to show an image in android native interface. - int[] flagIconSizes = {24,32,48,64,96}; - int exactSize; + int[] flagIconSizes = {24, 32, 64, 96}; int nearestSize; - exactSize = (int)(Navit.sMetrics.density * 24.0 - .5); + int exactSize = (int)(getResources().getDisplayMetrics().density * 24 - 0.5); nearestSize = flagIconSizes[0]; for (int size: flagIconSizes) { nearestSize = size; @@ -158,7 +155,6 @@ public class NavitAddressSearchActivity extends Activity { } mCountryButton = new ImageButton(this); - setCountryButtonImage(); mCountryButton.setOnClickListener(new OnClickListener() { diff --git a/navit/android/src/org/navitproject/navit/NavitBackupTask.java b/navit/android/src/org/navitproject/navit/NavitBackupTask.java index 567acb137..cc81072d9 100644 --- a/navit/android/src/org/navitproject/navit/NavitBackupTask.java +++ b/navit/android/src/org/navitproject/navit/NavitBackupTask.java @@ -16,11 +16,11 @@ import java.io.ObjectOutputStream; public class NavitBackupTask extends AsyncTask { - private Navit mActivity; + private final Navit mActivity; private ProgressDialog mDialog; - public NavitBackupTask(Navit context) { + NavitBackupTask(Navit context) { mActivity = context; } @@ -80,11 +80,11 @@ public class NavitBackupTask extends AsyncTask { ObjectOutputStream preferencesOOs = null; try { /* Backup Files in home */ - NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/bookmark.txt", + NavitUtils.copyFileIfExists(Navit.sMapFilenamePath + "/home/bookmark.txt", backupDir.getPath() + "/bookmark.txt"); - NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/destination.txt", + NavitUtils.copyFileIfExists(Navit.sMapFilenamePath + "/home/destination.txt", backupDir.getPath() + "/destination.txt"); - NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/gui_internal.txt", + NavitUtils.copyFileIfExists(Navit.sMapFilenamePath + "/home/gui_internal.txt", backupDir.getPath() + "/gui_internal.txt"); /* Backup Shared Preferences */ diff --git a/navit/android/src/org/navitproject/navit/NavitCallbackHandler.java b/navit/android/src/org/navitproject/navit/NavitCallbackHandler.java new file mode 100644 index 000000000..c3a3b3230 --- /dev/null +++ b/navit/android/src/org/navitproject/navit/NavitCallbackHandler.java @@ -0,0 +1,84 @@ +package org.navitproject.navit; + +import android.os.Handler; +import android.os.Message; +import android.util.Log; + +class NavitCallbackHandler { + + + private static final String TAG = "CallbackHandler"; + private static final MsgType[] msg_values = MsgType.values(); + + static final Handler sCallbackHandler = new CallBackHandler(); + + private static native int callbackMessageChannel(int channel, String s); + + private static native int callbackCmdChannel(int commandd); + + enum CmdType { CMD_ZOOM_IN, CMD_ZOOM_OUT, CMD_BLOCK, CMD_UNBLOCK, CMD_CANCEL_ROUTE } + + static void sendCommand(CmdType command) { + switch (command) { + case CMD_ZOOM_IN: + callbackCmdChannel(1); + break; + case CMD_ZOOM_OUT: + callbackCmdChannel(2); + break; + case CMD_BLOCK: + callbackCmdChannel(3); + break; + case CMD_UNBLOCK: + callbackCmdChannel(4); + break; + case CMD_CANCEL_ROUTE: + callbackCmdChannel(5); + break; + default: + Log.e(TAG, "Unhandled command : " + command); + } + } + + + enum MsgType { + CLB_SET_DESTINATION, CLB_SET_DISPLAY_DESTINATION, CLB_CALL_CMD, CLB_LOAD_MAP, CLB_UNLOAD_MAP, + CLB_DELETE_MAP + } + + + static class CallBackHandler extends Handler { + public void handleMessage(Message msg) { + switch (msg_values[msg.what]) { + case CLB_SET_DESTINATION: + String lat = Float.toString(msg.getData().getFloat("lat")); + String lon = Float.toString(msg.getData().getFloat("lon")); + String q = msg.getData().getString(("q")); + callbackMessageChannel(3, lat + "#" + lon + "#" + q); + break; + case CLB_SET_DISPLAY_DESTINATION: + int x = msg.arg1; + int y = msg.arg2; + callbackMessageChannel(4, "" + x + "#" + y); + break; + case CLB_CALL_CMD: + String cmd = msg.getData().getString(("cmd")); + callbackMessageChannel(5, cmd); + break; + case CLB_LOAD_MAP: + callbackMessageChannel(6, msg.getData().getString(("title"))); + break; + case CLB_DELETE_MAP: + //unload map before deleting it !!! + callbackMessageChannel(7, msg.getData().getString(("title"))); + NavitUtils.removeFileIfExists(msg.getData().getString(("title"))); + break; + case CLB_UNLOAD_MAP: + callbackMessageChannel(7, msg.getData().getString(("title"))); + break; + default: + Log.d(TAG, "Unhandled callback : " + msg_values[msg.what]); + } + } + } +} diff --git a/navit/android/src/org/navitproject/navit/NavitDialogs.java b/navit/android/src/org/navitproject/navit/NavitDialogs.java index 8a9d6de65..4c506d70c 100644 --- a/navit/android/src/org/navitproject/navit/NavitDialogs.java +++ b/navit/android/src/org/navitproject/navit/NavitDialogs.java @@ -64,14 +64,14 @@ public class NavitDialogs extends Handler { mActivity.dismissDialog(DIALOG_MAPDOWNLOAD); mActivity.removeDialog(DIALOG_MAPDOWNLOAD); if (msg.getData().getInt("value1") == 1) { - Message msgOut = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_LOAD_MAP.ordinal()); + Message msgOut = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_LOAD_MAP.ordinal()); msgOut.setData(msg.getData()); msgOut.sendToTarget(); msgOut = Message - .obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_CALL_CMD.ordinal()); + .obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_CALL_CMD.ordinal()); Bundle b = new Bundle(); int mi = msg.getData().getInt("value2"); double lon = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].mLon1) + Double diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java index 8f816df60..4ee521c8c 100644 --- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java +++ b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java @@ -29,7 +29,6 @@ import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.os.Message; -import android.os.StatFs; import android.support.v4.app.ActivityCompat; import android.util.Log; import android.view.View; @@ -60,7 +59,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity { updateMapsForLocation(); setListAdapter(sAdapter); try { - setTitle(getFreeSpace() / 1024 / 1024 + "MB available"); + setTitle(NavitUtils.getFreeSpace(Navit.sMapFilenamePath) / 1024 / 1024 + "MB available"); } catch (Exception e) { Log.e(TAG, "Exception " + e.getClass().getName() + " during getFreeSpace, reporting 'no sdcard present'"); @@ -73,10 +72,6 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity { } } - private long getFreeSpace() { - StatFs fsInfo = new StatFs(Navit.sMapFilenamePath); - return (long) fsInfo.getAvailableBlocks() * fsInfo.getBlockSize(); - } private void updateDownloadedMaps() { sDownloadedMapsChilds.clear(); @@ -234,8 +229,8 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity { new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { Log.d(TAG, "Delete Map"); - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_DELETE_MAP.ordinal()); + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_DELETE_MAP.ordinal()); Bundle b = new Bundle(); b.putString("title", mapLocation); msg.setData(b); diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java index cd6ce6944..37ac92ace 100644 --- a/navit/android/src/org/navitproject/navit/NavitGraphics.java +++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java @@ -19,14 +19,11 @@ package org.navitproject.navit; -import static org.navitproject.navit.NavitAppConfig.getTstring; - import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; @@ -39,9 +36,7 @@ import android.graphics.PointF; import android.graphics.Rect; import android.net.Uri; import android.os.Build; -import android.os.Handler; import android.os.Message; -import android.os.Parcelable; import android.support.annotation.RequiresApi; import android.support.v4.view.ViewConfigurationCompat; import android.util.Log; @@ -66,6 +61,7 @@ import java.util.List; class NavitGraphics { private static final String TAG = "NavitGraphics"; private static final long TIME_FOR_LONG_PRESS = 300L; + private static boolean sInMap; private final NavitGraphics mParentGraphics; private final ArrayList mOverlays; private int mBitmapWidth; @@ -81,7 +77,6 @@ class NavitGraphics { private int mPaddingTop; private int mPaddingBottom; private NavitView mView; - static final Handler sCallbackHandler = new CallBackHandler(); private SystemBarTintView mLeftTintView; private SystemBarTintView mRightTintView; private SystemBarTintView mTopTintView; @@ -90,7 +85,6 @@ class NavitGraphics { private RelativeLayout mRelativeLayout; private NavitCamera mCamera; private Navit mActivity; - private static boolean sInMap; private boolean mTinting; @@ -210,7 +204,7 @@ class NavitGraphics { * @return An intent to start to view the specified point on a third-party app on Android (can be null if a * view action is not possible) **/ - protected Intent getViewIntentForDisplayPoint(int x, int y) { + Intent getViewIntentForDisplayPoint(int x, int y) { Intent result = null; /* Check if there is at least one application that can process a geo intent... */ @@ -218,11 +212,11 @@ class NavitGraphics { Uri intentUri = Uri.parse("geo:" + selectedPointCoord); Intent defaultShareIntent = new Intent(Intent.ACTION_VIEW, intentUri); - List customShareIntentList = new ArrayList(); + List customShareIntentList = new ArrayList<>(); List intentTargetAppList; intentTargetAppList = this.getContext().getPackageManager().queryIntentActivities(defaultShareIntent, 0); - String selfPackageName = this.getContext().getPackageName(); /* aka: "org.navitproject.navit" */ + String selfPackageName = this.getContext().getPackageName(); if (!intentTargetAppList.isEmpty()) { for (ResolveInfo resolveInfo : intentTargetAppList) { @@ -243,7 +237,7 @@ class NavitGraphics { result = Intent.createChooser(customShareIntentList.remove(customShareIntentList.size() - 1), NavitAppConfig.getTstring(R.string.use_position_with)); result.putExtra(Intent.EXTRA_INITIAL_INTENTS, - customShareIntentList.toArray(new Parcelable[customShareIntentList.size()])); + customShareIntentList.toArray(new Intent[0])); Log.d(TAG, "Preparing action intent (" + customShareIntentList.size() + 1 + " candidate apps) to view selected coord: " + selectedPointCoord); } @@ -276,27 +270,20 @@ class NavitGraphics { @Override public boolean onMenuItemClick(MenuItem item) { int itemId = item.getItemId(); - if (itemId != MENU_VIEW) { - /* Destroy any previous map view intent if the user didn't select the MENU_VIEW action */ - mContextMenuMapViewIntent = null; - } if (itemId == MENU_DRIVE_HERE) { - Message msg = Message.obtain(sCallbackHandler, MsgType.CLB_SET_DISPLAY_DESTINATION.ordinal(), + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_SET_DISPLAY_DESTINATION.ordinal(), (int) mPressedPosition.x, (int) mPressedPosition.y); msg.sendToTarget(); } else if (itemId == MENU_VIEW) { - if (mContextMenuMapViewIntent != null) { - mContextMenuMapViewIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - if (mContextMenuMapViewIntent.resolveActivity(this.getContext().getPackageManager()) != null) { - this.getContext().startActivity(mContextMenuMapViewIntent); - } else { - Log.w(TAG, "View menu selected but intent is not handled by any application. Ignoring..."); - } - mContextMenuMapViewIntent = null; /* Destoy the intent once it has been used */ + mContextMenuMapViewIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + if (mContextMenuMapViewIntent.resolveActivity(this.getContext().getPackageManager()) != null) { + this.getContext().startActivity(mContextMenuMapViewIntent); } else { - Log.e(TAG, "User clicked on view on menu but intent was null. Discarding..."); + Log.w(TAG, "View menu selected but intent is not handled by any application. Ignoring..."); } } + mContextMenuMapViewIntent = null; return true; } @@ -320,8 +307,6 @@ class NavitGraphics { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { Log.d(TAG, "onSizeChanged pixels x=" + w + " pixels y=" + h); - Log.v(TAG, "onSizeChanged density=" + Navit.sMetrics.density); - Log.v(TAG, "onSizeChanged scaledDensity=" + Navit.sMetrics.scaledDensity); super.onSizeChanged(w, h, oldw, oldh); mDrawBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); mDrawCanvas = new Canvas(mDrawBitmap); @@ -414,12 +399,12 @@ class NavitGraphics { Log.v(TAG, "New scale = " + scale); if (scale > 1.2) { // zoom in - callbackMessageChannel(1, ""); + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_ZOOM_IN); mOldDist = newDist; } else if (scale < 0.8) { mOldDist = newDist; // zoom out - callbackMessageChannel(2, ""); + NavitCallbackHandler.sendCommand(NavitCallbackHandler.CmdType.CMD_ZOOM_OUT); } } } @@ -650,66 +635,6 @@ class NavitGraphics { mView.requestFocus(); } - enum MsgType { - CLB_ZOOM_IN, CLB_ZOOM_OUT, CLB_REDRAW, CLB_MOVE, CLB_BUTTON_UP, CLB_BUTTON_DOWN, CLB_SET_DESTINATION, - CLB_SET_DISPLAY_DESTINATION, CLB_CALL_CMD, CLB_COUNTRY_CHOOSER, CLB_LOAD_MAP, CLB_UNLOAD_MAP, CLB_DELETE_MAP - } - - private static final MsgType[] msg_values = MsgType.values(); - - private static class CallBackHandler extends Handler { - public void handleMessage(Message msg) { - switch (msg_values[msg.what]) { - case CLB_ZOOM_IN: - callbackMessageChannel(1, ""); - break; - case CLB_ZOOM_OUT: - callbackMessageChannel(2, ""); - break; - case CLB_MOVE: - //motionCallback(mMotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y")); - break; - case CLB_SET_DESTINATION: - String lat = Float.toString(msg.getData().getFloat("lat")); - String lon = Float.toString(msg.getData().getFloat("lon")); - String q = msg.getData().getString(("q")); - callbackMessageChannel(3, lat + "#" + lon + "#" + q); - break; - case CLB_SET_DISPLAY_DESTINATION: - int x = msg.arg1; - int y = msg.arg2; - callbackMessageChannel(4, "" + x + "#" + y); - break; - case CLB_CALL_CMD: - String cmd = msg.getData().getString(("cmd")); - callbackMessageChannel(5, cmd); - break; - case CLB_BUTTON_UP: - //buttonCallback(mButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); - break; - case CLB_BUTTON_DOWN: - //buttonCallback(mButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); - break; - case CLB_COUNTRY_CHOOSER: - break; - case CLB_LOAD_MAP: - callbackMessageChannel(6, msg.getData().getString(("title"))); - break; - case CLB_DELETE_MAP: - //unload map before deleting it !!! - callbackMessageChannel(7, msg.getData().getString(("title"))); - NavitUtils.removeFileIfExists(msg.getData().getString(("title"))); - break; - case CLB_UNLOAD_MAP: - callbackMessageChannel(7, msg.getData().getString(("title"))); - break; - case CLB_REDRAW: - default: - Log.d(TAG, "Unhandled callback : " + msg_values[msg.what]); - } - } - } - private native void sizeChangedCallback(long id, int x, int y); @@ -717,8 +642,6 @@ class NavitGraphics { private native void keypressCallback(long id, String s); - private static native int callbackMessageChannel(int i, String s); - private native void buttonCallback(long id, int pressed, int button, int x, int y); private native void motionCallback(long id, int x, int y); diff --git a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java index 51c362407..e66840073 100644 --- a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java +++ b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java @@ -20,7 +20,6 @@ import static org.navitproject.navit.NavitAppConfig.getTstring; import android.location.Location; import android.os.Bundle; import android.os.Message; -import android.os.StatFs; import android.util.Log; import java.io.BufferedInputStream; @@ -47,422 +46,424 @@ import java.net.URLConnection; */ public class NavitMapDownloader extends Thread { - // - // define the maps here - // size estimations updated 2017-06-22 - // static final OsmMapValues[] osm_maps = { - new OsmMapValues(getTstring(R.string.whole_planet), "-180", "-90", "180", "90", - 23992258630L, 0), - new OsmMapValues(getTstring(R.string.africa), "-30.89", "-36.17", "61.68", - "38.40", 2070076339L, 0), - new OsmMapValues(getTstring(R.string.angola), "11.4", "-18.1", "24.2", "-5.3", - 127557789L, 1), - new OsmMapValues(getTstring(R.string.burundi), "28.9", "-4.5", "30.9", "-2.2", - 124049667L, 1), - new OsmMapValues(getTstring(R.string.canary_islands), "-18.69", "26.52", "-12.79", - "29.99", 133565815L, 1), - new OsmMapValues(getTstring(R.string.congo), "11.7", - "-13.6", "31.5", "5.7", 244228485L, 1), - new OsmMapValues(getTstring(R.string.ethiopia), "32.89", "3.33", "48.07", "14.97", - 153067406L, 1), - new OsmMapValues(getTstring(R.string.guinea), "-15.47", "7.12", "-7.58", "12.74", - 188047126L, 1), - new OsmMapValues(getTstring(R.string.cotedivoire), "-8.72", "4.09", "-2.43", - "10.80", 132187496L, 1), - new OsmMapValues(getTstring(R.string.kenya), "33.8", "-5.2", "42.4", "4.9", - 190073089L, 1), - new OsmMapValues(getTstring(R.string.lesotho), "26.9", "-30.7", "29.6", "-28.4", - 196189429L, 1), - new OsmMapValues(getTstring(R.string.liberia), "-15.00", "-0.73", "-7.20", "8.65", - 156257253L, 1), - new OsmMapValues(getTstring(R.string.libya), "9.32", "19.40", "25.54", "33.63", - 126046917L, 1), - new OsmMapValues(getTstring(R.string.madagascar), "42.25", "-26.63", "51.20", - "-11.31", 145210721L, 1), - new OsmMapValues(getTstring(R.string.namibia) + "+" + getTstring(R.string.botswana), - "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1), - new OsmMapValues(getTstring(R.string.reunion), "55.2", "-21.4", "55.9", "-20.9", - 126008774L, 1), - new OsmMapValues(getTstring(R.string.rwanda), "28.8", "-2.9", "30.9", "-1.0", - 128267595L, 1), - new OsmMapValues(getTstring(R.string.south_africa) + "+" + getTstring(R.string.lesotho), - "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1), - new OsmMapValues(getTstring(R.string.tanzania), "29.19", - "-11.87", "40.74", "-0.88", 253621029L, 1), - new OsmMapValues(getTstring(R.string.uganda), "29.3", "-1.6", "35.1", "4.3", - 179134521L, 1), - new OsmMapValues(getTstring(R.string.asia), "23.8", "0.1", "195.0", "82.4", - 5113673780L, 0), - new OsmMapValues(getTstring(R.string.azerbaijan), "44.74", "38.34", "51.69", - "42.37", 138346406L, 1), - new OsmMapValues(getTstring(R.string.china), "67.3", "5.3", "135.0", "54.5", - 1718108758L, 1), - new OsmMapValues(getTstring(R.string.cyprus), "32.0", "34.5", "34.9", "35.8", - 118472448L, 1), - new OsmMapValues(getTstring(R.string.india) + "+" + getTstring(R.string.nepal), "67.9", - "5.5", "89.6", "36.0", 601877877L, 1), - new OsmMapValues(getTstring(R.string.indonesia), "93.7", "-17.3", "155.5", "7.6", - 420741405L, 1), - new OsmMapValues(getTstring(R.string.iran), "43.5", "24.4", - "63.6", "40.4", 242016066L, 1), - new OsmMapValues(getTstring(R.string.iraq), "38.7", "28.5", "49.2", "37.4", - 160751805L, 1), - new OsmMapValues(getTstring(R.string.israel), "33.99", "29.8", "35.95", "33.4", - 155685778L, 1), - new OsmMapValues(getTstring(R.string.japan) + "+" + getTstring(R.string.korea), "123.6", - "25.2", "151.3", "47.1", 1029080156L, 1), - new OsmMapValues(getTstring(R.string.kazakhstan), "46.44", "40.89", "87.36", - "55.45", 407633007L, 1), - new OsmMapValues(getTstring(R.string.kyrgyzsyan), "69.23", "39.13", "80.33", - "43.29", 147997835L, 1), - new OsmMapValues(getTstring(R.string.malaysia) + "+" + getTstring(R.string.singapore), - "94.3", "-5.9", "108.6", "6.8", 168816435L, 1), - new OsmMapValues(getTstring(R.string.mongolia), "87.5", "41.4", "120.3", "52.7", - 153534851L, 1), - new OsmMapValues(getTstring(R.string.pakistan), "60.83", "23.28", "77.89", - "37.15", 217644321L, 1), - new OsmMapValues(getTstring(R.string.philippines), "115.58", "4.47", "127.85", - "21.60", 281428307L, 1), - new OsmMapValues(getTstring(R.string.saudi_arabia), "33.2", "16.1", "55.9", - "33.5", 242648303L, 1), - new OsmMapValues(getTstring(R.string.taiwan), "119.1", "21.5", "122.5", "25.2", - 1029080156L, 1), - new OsmMapValues(getTstring(R.string.thailand), "97.5", "5.7", "105.2", "19.7", - 185135492L, 1), - new OsmMapValues(getTstring(R.string.turkey), "25.1", "35.8", "46.4", "42.8", - 331087441L, 1), - new OsmMapValues(getTstring(R.string.turkmenistan), "51.78", "35.07", "66.76", - "42.91", 131045087L, 1), - new OsmMapValues(getTstring(R.string.uae_other), "51.5", "22.6", "56.7", "26.5", - 128934674L, 1), - new OsmMapValues(getTstring(R.string.australia) + "+" + getTstring(R.string.oceania), - "89.84", "-57.39", "179.79", "7.26", 782722650L, 0), - new OsmMapValues(getTstring(R.string.australia), "110.5", "-44.2", "154.9", - "-9.2", 348652900L, 0), - new OsmMapValues(getTstring(R.string.tasmania), "144.0", "-45.1", "155.3", - "-24.8", 253231890L, 1), - new OsmMapValues(getTstring(R.string.victoria) + " + " + getTstring(R.string.new_south_wales), - "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1), - new OsmMapValues(getTstring(R.string.new_caledonia), "157.85", "-25.05", "174.15", - "-16.85", 115512336L, 1), - new OsmMapValues(getTstring(R.string.newzealand), "165.2", "-47.6", "179.1", - "-33.7", 239264192L, 1), - new OsmMapValues(getTstring(R.string.europe), "-12.97", "33.59", "34.15", "72.10", - 11984126789L, 0), - new OsmMapValues(getTstring(R.string.western_europe), "-17.6", "34.5", "42.9", - "70.9", 12648810717L, 1), - new OsmMapValues(getTstring(R.string.austria), "9.4", "46.32", "17.21", "49.1", - 898273634L, 1), - new OsmMapValues(getTstring(R.string.azores), "-31.62", "36.63", "-24.67", - "40.13", 112687225L, 1), - new OsmMapValues(getTstring(R.string.belgium), "2.3", "49.5", "6.5", "51.6", - 733035524L, 1), - new OsmMapValues(getTstring(R.string.benelux), "2.08", "48.87", "7.78", "54.52", - 1771971595L, 1), - new OsmMapValues(getTstring(R.string.netherlands), "3.07", "50.75", "7.23", - "53.73", 1191828033L, 1), - new OsmMapValues(getTstring(R.string.denmark), "7.65", "54.32", "15.58", "58.07", - 365606979L, 1), - new OsmMapValues(getTstring(R.string.faroe_islands), "-7.8", "61.3", "-6.1", - "62.5", 109377568L, 1), - new OsmMapValues(getTstring(R.string.france), "-5.45", "42.00", "8.44", "51.68", - 3907969744L, 1), - new OsmMapValues(getTstring(R.string.alsace), "6.79", "47.27", "8.48", "49.17", - 354249349L, 2), - new OsmMapValues(getTstring(R.string.aquitaine), "-2.27", "42.44", "1.50", - "45.76", 443715019L, 2), - new OsmMapValues(getTstring(R.string.auvergne), "2.01", "44.57", "4.54", "46.85", - 287663213L, 2), - new OsmMapValues(getTstring(R.string.basse_normandie), "-2.09", "48.13", "1.03", - "49.98", 262352354L, 2), - new OsmMapValues(getTstring(R.string.bourgogne), "2.80", "46.11", "5.58", "48.45", - 298868796L, 2), - new OsmMapValues(getTstring(R.string.bretagne), "-5.58", "46.95", "-0.96", - "48.99", 382770794L, 2), - new OsmMapValues(getTstring(R.string.centre), "0.01", "46.29", "3.18", "48.99", - 474224721L, 2), - new OsmMapValues(getTstring(R.string.champagne_ardenne), "3.34", "47.53", "5.94", - "50.28", 269947824L, 2), - new OsmMapValues(getTstring(R.string.corse), "8.12", "41.32", "9.95", "43.28", - 129902146L, 2), - new OsmMapValues(getTstring(R.string.franche_comte), "5.20", "46.21", "7.83", - "48.07", 324476070L, 2), - new OsmMapValues(getTstring(R.string.haute_normandie), "-0.15", "48.62", "1.85", - "50.18", 202782876L, 2), - new OsmMapValues(getTstring(R.string.ile_de_france), "1.40", "48.07", "3.61", - "49.29", 311052699L, 2), - new OsmMapValues(getTstring(R.string.languedoc_roussillon), "1.53", "42.25", - "4.89", "45.02", 380145667L, 2), - new OsmMapValues(getTstring(R.string.limousin), "0.58", "44.87", "2.66", "46.50", - 206696539L, 2), - new OsmMapValues(getTstring(R.string.lorraine), "4.84", "47.77", "7.72", "49.73", - 330777318L, 2), - new OsmMapValues(getTstring(R.string.midi_pyrenees), "-0.37", "42.18", "3.50", - "45.10", 462618363L, 2), - new OsmMapValues(getTstring(R.string.nord_pas_de_calais), "1.42", "49.92", "4.49", - "51.31", 368467511L, 2), - new OsmMapValues(getTstring(R.string.pays_de_la_loire), "-2.88", "46.20", "0.97", - "48.62", 499471143L, 2), - new OsmMapValues(getTstring(R.string.picardie), "1.25", "48.79", "4.31", "50.43", - 374308041L, 2), - new OsmMapValues(getTstring(R.string.poitou_charentes), "-1.69", "45.04", "1.26", - "47.23", 342125526L, 2), - new OsmMapValues(getTstring(R.string.provence_alpes_cote_d_azur), "4.21", "42.91", - "7.99", "45.18", 390306134L, 2), - new OsmMapValues(getTstring(R.string.rhone_alpes), "3.65", "44.07", "7.88", - "46.64", 510797942L, 2), - new OsmMapValues(getTstring(R.string.luxembourg), "5.7", "49.4", "6.5", "50.2", - 1771971595L, 1), - new OsmMapValues(getTstring(R.string.germany), "5.18", "46.84", "15.47", "55.64", - 3521359466L, 1), - new OsmMapValues(getTstring(R.string.baden_wuerttemberg), "7.32", "47.14", - "10.57", "49.85", 674361124L, 2), - new OsmMapValues(getTstring(R.string.bayern), "8.92", "47.22", "13.90", "50.62", - 860161150L, 2), - new OsmMapValues(getTstring(R.string.mittelfranken), "9.86", "48.78", "11.65", - "49.84", 203055195L, 2), - new OsmMapValues(getTstring(R.string.niederbayern), "11.55", "47.75", "14.12", - "49.42", 312924770L, 2), - new OsmMapValues(getTstring(R.string.oberbayern), "10.67", "47.05", "13.57", - "49.14", 382734883L, 2), - new OsmMapValues(getTstring(R.string.oberfranken), "10.31", "49.54", "12.49", - "50.95", 235258691L, 2), - new OsmMapValues(getTstring(R.string.oberpfalz), "11.14", "48.71", "13.47", - "50.43", 264536012L, 2), - new OsmMapValues(getTstring(R.string.schwaben), "9.27", "47.10", "11.36", "49.09", - 321141607L, 2), - new OsmMapValues(getTstring(R.string.unterfranken), "8.59", "49.16", "10.93", - "50.67", 303720890L, 2), - new OsmMapValues(getTstring(R.string.berlin), "13.03", "52.28", "13.81", "52.73", - 169019946L, 2), - new OsmMapValues(getTstring(R.string.brandenburg), "11.17", "51.30", "14.83", - "53.63", 323497599L, 2), - new OsmMapValues(getTstring(R.string.bremen), "8.43", "52.96", "9.04", "53.66", - 150963608L, 2), - new OsmMapValues(getTstring(R.string.hamburg), "9.56", "53.34", "10.39", "53.80", - 156284421L, 2), - new OsmMapValues(getTstring(R.string.hessen), "7.72", "49.34", "10.29", "51.71", - 432279328L, 2), - new OsmMapValues(getTstring(R.string.mecklenburg_vorpommern), "10.54", "53.05", - "14.48", "55.05", 213183908L, 2), - new OsmMapValues(getTstring(R.string.niedersachsen), "6.40", "51.24", "11.69", - "54.22", 819766939L, 2), - new OsmMapValues(getTstring(R.string.nordrhein_westfalen), "5.46", "50.26", - "9.52", "52.59", 967053517L, 2), - new OsmMapValues(getTstring(R.string.rheinland_pfalz), "6.06", "48.91", "8.56", - "51.00", 442868899L, 2), - new OsmMapValues(getTstring(R.string.saarland), "6.30", "49.06", "7.46", "49.69", - 157721162L, 2), - new OsmMapValues(getTstring(R.string.sachsen_anhalt), "10.50", "50.88", "13.26", - "53.11", 287785088L, 2), - new OsmMapValues(getTstring(R.string.sachsen), "11.82", "50.11", "15.10", "51.73", - 342620834L, 2), - new OsmMapValues(getTstring(R.string.schleswig_holstein), "7.41", "53.30", - "11.98", "55.20", 280293910L, 2), - new OsmMapValues(getTstring(R.string.thueringen), "9.81", "50.15", "12.72", - "51.70", 269428239L, 2), - new OsmMapValues(getTstring(R.string.iceland), "-25.3", "62.8", "-11.4", "67.5", - 124837162L, 1), - new OsmMapValues(getTstring(R.string.ireland), "-11.17", "51.25", "-5.23", "55.9", - 234750271L, 1), - new OsmMapValues(getTstring(R.string.italy), "6.52", "36.38", "18.96", "47.19", - 1610171395L, 1), - new OsmMapValues(getTstring(R.string.spain) + "+" + getTstring(R.string.portugal), - "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1), - new OsmMapValues(getTstring(R.string.mallorca), "2.2", "38.8", "4.7", "40.2", - 137200636L, 2), - new OsmMapValues(getTstring(R.string.galicia), "-10.0", "41.7", "-6.3", "44.1", - 174549553L, 2), - new OsmMapValues(getTstring(R.string.scandinavia), "4.0", "54.4", "32.1", "71.5", - 1398661090L, 1), - new OsmMapValues(getTstring(R.string.finland), "18.6", "59.2", "32.3", "70.3", - 460997178L, 1), - new OsmMapValues(getTstring(R.string.denmark), "7.49", "54.33", "13.05", "57.88", - 321870414L, 1), - new OsmMapValues(getTstring(R.string.switzerland), "5.79", "45.74", "10.59", - "47.84", 552565332L, 1), - new OsmMapValues(getTstring(R.string.united_kingdom), "-9.7", "49.6", "2.2", - "61.2", 901724648L, 1), - new OsmMapValues(getTstring(R.string.england), "-7.80", "48.93", "2.41", "56.14", - 937728414L, 1), - new OsmMapValues(getTstring(R.string.buckinghamshire), "-1.19", "51.44", "-0.43", - "52.25", 142256978L, 2), - new OsmMapValues(getTstring(R.string.cambridgeshire), "-0.55", "51.96", "0.56", - "52.79", 142334001L, 2), - new OsmMapValues(getTstring(R.string.cumbria), "-3.96", "53.85", "-2.11", "55.24", - 144422460L, 2), - new OsmMapValues(getTstring(R.string.east_yorkshire_with_hull), "-1.16", "53.50", - "0.54", "54.26", 141518744L, 2), - new OsmMapValues(getTstring(R.string.essex), "-0.07", "51.40", "1.36", "52.14", - 162542730L, 2), - new OsmMapValues(getTstring(R.string.herefordshire), "-3.19", "51.78", "-2.29", - "52.45", 129368660L, 2), - new OsmMapValues(getTstring(R.string.kent), "-0.02", "50.81", "1.65", "51.53", - 145482562L, 2), - new OsmMapValues(getTstring(R.string.lancashire), "-3.20", "53.43", "-2.00", - "54.29", 148964975L, 2), - new OsmMapValues(getTstring(R.string.leicestershire), "-1.65", "52.34", "-0.61", - "53.03", 154199956L, 2), - new OsmMapValues(getTstring(R.string.norfolk), "0.10", "52.30", "2.04", "53.41", - 146017009L, 2), - new OsmMapValues(getTstring(R.string.nottinghamshire), "-1.39", "52.73", "-0.62", - "53.55", 147986548L, 2), - new OsmMapValues(getTstring(R.string.oxfordshire), "-1.77", "51.41", "-0.82", - "52.22", 142240992L, 2), - new OsmMapValues(getTstring(R.string.shropshire), "-3.29", "52.26", "-2.18", - "53.05", 136909363L, 2), - new OsmMapValues(getTstring(R.string.somerset), "-3.89", "50.77", "-2.20", - "51.40", 145186096L, 2), - new OsmMapValues(getTstring(R.string.south_yorkshire), "-1.88", "53.25", "-0.80", - "53.71", 145902650L, 2), - new OsmMapValues(getTstring(R.string.suffolk), "0.29", "51.88", "1.81", "52.60", - 143799697L, 2), - new OsmMapValues(getTstring(R.string.surrey), "-0.90", "51.02", "0.10", "51.52", - 157987139L, 2), - new OsmMapValues(getTstring(R.string.wiltshire), "-2.41", "50.90", "-1.44", - "51.76", 138652346L, 2), - new OsmMapValues(getTstring(R.string.scotland), "-8.13", "54.49", "-0.15", - "61.40", 258853845L, 2), - new OsmMapValues(getTstring(R.string.wales), "-5.56", "51.28", "-2.60", "53.60", - 193593409L, 2), - new OsmMapValues(getTstring(R.string.albania), "19.09", "39.55", "21.12", "42.72", - 146199817L, 1), - new OsmMapValues(getTstring(R.string.belarus), "23.12", "51.21", "32.87", "56.23", - 324470696L, 1), - new OsmMapValues(getTstring(R.string.russian_federation), "27.9", "41.5", "190.4", - "77.6", 2148314279L, 1), - new OsmMapValues(getTstring(R.string.bulgaria), "24.7", "42.1", "24.8", "42.1", - 109869373L, 1), - new OsmMapValues(getTstring(R.string.bosnia_and_herzegovina), "15.69", "42.52", - "19.67", "45.32", 187122485L, 1), - new OsmMapValues(getTstring(R.string.czech_republic), "11.91", "48.48", "19.02", - "51.17", 904838442L, 1), - new OsmMapValues(getTstring(R.string.croatia), "13.4", "42.1", "19.4", "46.9", - 460854751L, 1), - new OsmMapValues(getTstring(R.string.estonia), "21.5", "57.5", "28.2", "59.6", - 173378927L, 1), - new OsmMapValues(getTstring(R.string.greece), "28.9", "37.8", "29.0", "37.8", - 109435051L, 1), - new OsmMapValues(getTstring(R.string.crete), "23.3", "34.5", "26.8", "36.0", - 115985063L, 1), - new OsmMapValues(getTstring(R.string.hungary), "16.08", "45.57", "23.03", "48.39", - 350318541L, 1), - new OsmMapValues(getTstring(R.string.latvia), "20.7", "55.6", "28.3", "58.1", - 188188140L, 1), - new OsmMapValues(getTstring(R.string.lithuania), "20.9", "53.8", "26.9", "56.5", - 217852597L, 1), - new OsmMapValues(getTstring(R.string.poland), "13.6", "48.8", "24.5", "55.0", - 1464968657L, 1), - new OsmMapValues(getTstring(R.string.romania), "20.3", "43.5", "29.9", "48.4", - 347931565L, 1), - new OsmMapValues(getTstring(R.string.slovakia), "16.8", "47.7", "22.6", "49.7", - 420533039L, 1), - new OsmMapValues(getTstring(R.string.ukraine), "22.0", "44.3", "40.4", "52.4", - 793611912L, 1), - new OsmMapValues(getTstring(R.string.north_america), "-178.1", "6.5", "-10.4", - "84.0", 5601866516L, 0), - new OsmMapValues(getTstring(R.string.alaska), "-179.5", "49.5", "-129", "71.6", - 207746039L, 1), - new OsmMapValues(getTstring(R.string.canada), "-141.3", "41.5", "-52.2", "70.2", - 2635719651L, 1), - new OsmMapValues(getTstring(R.string.hawaii), "-161.07", "18.49", "-154.45", - "22.85", 115016656L, 1), - new OsmMapValues(getTstring(R.string.usa) + getTstring(R.string.except_alaska_and_hawaii), - "-125.4", "24.3", "-66.5", "49.3", 4060487198L, 1), - new OsmMapValues(getTstring(R.string.midwest), "-104.11", "35.92", "-80.46", - "49.46", 1145596450L, 2), - new OsmMapValues(getTstring(R.string.michigan), "-90.47", "41.64", "-79.00", - "49.37", 538247019L, 2), - new OsmMapValues(getTstring(R.string.ohio), "-84.87", "38.05", "-79.85", "43.53", - 277022336L, 2), - new OsmMapValues(getTstring(R.string.northeast), "-80.58", "38.72", "-66.83", - "47.53", 1017160709L, 2), - new OsmMapValues(getTstring(R.string.massachusetts), "-73.56", "40.78", "-68.67", - "42.94", 340055487L, 2), - new OsmMapValues(getTstring(R.string.vermont), "-73.49", "42.68", "-71.41", - "45.07", 139626067L, 2), - new OsmMapValues(getTstring(R.string.pacific), "-180.05", "15.87", "-129.75", - "73.04", 207090640L, 2), - new OsmMapValues(getTstring(R.string.south), "-106.70", "23.98", "-71.46", - "40.70", 1747935356L, 2), - new OsmMapValues(getTstring(R.string.arkansas), "-94.67", "32.95", "-89.59", - "36.60", 155658661L, 2), - new OsmMapValues(getTstring(R.string.district_of_columbia), "-77.17", "38.74", - "-76.86", "39.05", 129235755L, 2), - new OsmMapValues(getTstring(R.string.florida), "-88.75", "23.63", "-77.67", - "31.05", 224022108L, 2), - new OsmMapValues(getTstring(R.string.louisiana), "-94.09", "28.09", "-88.62", - "33.07", 210120605L, 2), - new OsmMapValues(getTstring(R.string.maryland), "-79.54", "37.83", "-74.99", - "40.22", 276462622L, 2), - new OsmMapValues(getTstring(R.string.mississippi), "-91.71", "29.99", "-88.04", - "35.05", 177858031L, 2), - new OsmMapValues(getTstring(R.string.oklahoma), "-103.41", "33.56", "-94.38", - "37.38", 200061473L, 2), - new OsmMapValues(getTstring(R.string.texas), "-106.96", "25.62", "-92.97", - "36.58", 430089141L, 2), - new OsmMapValues(getTstring(R.string.virginia), "-83.73", "36.49", "-74.25", - "39.52", 384187569L, 2), - new OsmMapValues(getTstring(R.string.west_virginia), "-82.70", "37.15", "-77.66", - "40.97", 220552071L, 2), - new OsmMapValues(getTstring(R.string.west), "-133.11", "31.28", "-101.99", - "49.51", 1152909162L, 2), - new OsmMapValues(getTstring(R.string.arizona), "-114.88", "30.01", "-108.99", - "37.06", 182826833L, 2), - new OsmMapValues(getTstring(R.string.california), "-125.94", "32.43", "-114.08", - "42.07", 586923326L, 2), - new OsmMapValues(getTstring(R.string.colorado), "-109.11", "36.52", "-100.41", - "41.05", 228623724L, 2), - new OsmMapValues(getTstring(R.string.idaho), "-117.30", "41.93", "-110.99", - "49.18", 170684507L, 2), - new OsmMapValues(getTstring(R.string.montana), "-116.10", "44.31", "-102.64", - "49.74", 176229800L, 2), - new OsmMapValues(getTstring(R.string.new_mexico), "-109.10", "26.98", "-96.07", - "37.05", 361793070L, 2), - new OsmMapValues(getTstring(R.string.nevada), "-120.2", "35.0", "-113.8", "42.1", - 200614482L, 2), - new OsmMapValues(getTstring(R.string.oregon), "-124.8", "41.8", "-116.3", "46.3", - 211462685L, 2), - new OsmMapValues(getTstring(R.string.utah), "-114.11", "36.95", "-108.99", - "42.05", 151590197L, 2), - new OsmMapValues(getTstring(R.string.washington_state), "-125.0", "45.5", - "-116.9", "49.0", 222553768L, 2), - new OsmMapValues(getTstring(R.string.south_middle_america), "-83.5", "-56.3", - "-30.8", "13.7", 958895383L, 0), - new OsmMapValues(getTstring(R.string.argentina), "-73.9", "-57.3", "-51.6", - "-21.0", 376857648L, 1), - new OsmMapValues(getTstring(R.string.argentina) + "+" + getTstring(R.string.chile), - "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1), - new OsmMapValues(getTstring(R.string.bolivia), "-70.5", "-23.1", "-57.3", "-9.3", - 175937824L, 1), - new OsmMapValues(getTstring(R.string.brazil), "-71.4", "-34.7", "-32.8", "5.4", - 664872975L, 1), - new OsmMapValues(getTstring(R.string.chile), "-81.77", "-58.50", "-65.46", - "-17.41", 241657330L, 1), - new OsmMapValues(getTstring(R.string.cuba), "-85.3", "19.6", "-74.0", "23.6", - 129043575L, 1), - new OsmMapValues(getTstring(R.string.colombia), "-79.1", "-4.0", "-66.7", "12.6", - 212016580L, 1), - new OsmMapValues(getTstring(R.string.ecuador), "-82.6", "-5.4", "-74.4", "2.3", - 158857591L, 1), - new OsmMapValues(getTstring(R.string.guyana) + "+" + getTstring(R.string.suriname) + "+" - + getTstring(R.string.guyane_francaise), "-62.0", "1.0", "-51.2", - "8.9", 123000072L, 1), - new OsmMapValues(getTstring(R.string.haiti) + "+" + getTstring(R.string.dominican_republic), - "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1), - new OsmMapValues(getTstring(R.string.jamaica), "-78.6", "17.4", "-75.9", "18.9", - 113961998L, 1), - new OsmMapValues(getTstring(R.string.mexico), "-117.6", "14.1", "-86.4", "32.8", - 551307973L, 1), - new OsmMapValues(getTstring(R.string.paraguay), "-63.8", "-28.1", "-53.6", - "-18.8", 159498397L, 1), - new OsmMapValues(getTstring(R.string.peru), "-82.4", "-18.1", "-67.5", "0.4", - 212490557L, 1), - new OsmMapValues(getTstring(R.string.uruguay), "-59.2", "-36.5", "-51.7", "-29.7", - 157482719L, 1), - new OsmMapValues(getTstring(R.string.venezuela), "-73.6", "0.4", "-59.7", "12.8", - 167295729L, 1) + + // size estimations updated 2019-10-28 + new OsmMapValues(R.string.whole_planet, "-180", "-90", "180", "90", + 35471336933L, 0), + new OsmMapValues(R.string.africa, "-30.89", "-36.17", "61.68", "38.40", + 3941558472L, 0), + new OsmMapValues(R.string.angola, "11.4", "-18.1", "24.2", "-5.3", + 224809554L, 1), + new OsmMapValues(R.string.burundi, "28.9", "-4.5", "30.9", "-2.2", + 201346208L, 1), + new OsmMapValues(R.string.canary_islands, "-18.69", "26.52", "-12.79", "29.99", + 191823973L, 1), + new OsmMapValues(R.string.congo, "11.7", "-13.6", "31.5", "5.7", + 558204116L, 1), + new OsmMapValues(R.string.ethiopia, "32.89", "3.33", "48.07", "14.97", + 249153700L, 1), + new OsmMapValues(R.string.guinea, "-15.47", "7.12", "-7.58", "12.74", + 290456408L, 1), + new OsmMapValues(R.string.cotedivoire, "-8.72", "4.09", "-2.43", "10.80", + 220210996L, 1), + new OsmMapValues(R.string.kenya, "33.8", "-5.2", "42.4", "4.9", + 402046406L, 1), + new OsmMapValues(R.string.lesotho, "26.9", "-30.7", "29.6", "-28.4", + 250430629L, 1), + new OsmMapValues(R.string.liberia, "-15.00", "-0.73", "-7.20", "8.65", + 220130148L, 1), + new OsmMapValues(R.string.libya, "9.32", "19.40", "25.54", "33.63", + 202766153L, 1), + new OsmMapValues(R.string.madagascar, "42.25", "-26.63", "51.20", "-11.31", + 231793632L, 1), + new OsmMapValues(R.string.namibia, R.string.botswana, "11.4", "-29.1", "29.5", "-16.9", + 355183133L, 1), + new OsmMapValues(R.string.reunion, "55.2", "-21.4", "55.9", "-20.9", + 170953086L, 1), + new OsmMapValues(R.string.rwanda, "28.8", "-2.9", "30.9", "-1.0", + 213213966L, 1), + new OsmMapValues(R.string.south_africa, R.string.lesotho, "15.93", "-36.36", "33.65", "-22.08", + 412557227L, 1), + new OsmMapValues(R.string.tanzania, "29.19", "-11.87", "40.74", "-0.88", + 659878114L, 1), + new OsmMapValues(R.string.uganda, "29.3", "-1.6", "35.1", "4.3", + 424948047L, 1), + new OsmMapValues(R.string.asia, "23.8", "0.1", "195.0", "82.4", + 8633755849L, 0), + new OsmMapValues(R.string.azerbaijan, "44.74", "38.34", "51.69", "42.37", + 208193716L, 1), + new OsmMapValues(R.string.china, "67.3", "5.3", "135.0", "54.5", + 3071225422L, 1), + new OsmMapValues(R.string.cyprus, "32.0", "34.5", "34.9", "35.8", + 178895753L, 1), + new OsmMapValues(R.string.india, R.string.nepal, "67.9", "5.5", "89.6", "36.0", + 1046746656L, 1), + new OsmMapValues(R.string.indonesia, "93.7", "-17.3", "155.5", "7.6", + 1182281967L, 1), + new OsmMapValues(R.string.iran, "43.5", "24.4", "63.6", "40.4", + 391459887L, 1), + new OsmMapValues(R.string.iraq, "38.7", "28.5", "49.2", "37.4", + 244896621L, 1), + new OsmMapValues(R.string.israel, "33.99", "29.8", "35.95", "33.4", + 236037295L, 1), + new OsmMapValues(R.string.japan, R.string.korea, "123.6", "25.2", "151.3", "47.1", + 1337474060L, 1), + new OsmMapValues(R.string.kazakhstan, "46.44", "40.89", "87.36", "55.45", + 661252271L, 1), + new OsmMapValues(R.string.kyrgyzsyan, "69.23", "39.13", "80.33", "43.29", + 215786962L, 1), + new OsmMapValues(R.string.malaysia, R.string.singapore, "94.3", "-5.9", "108.6", "6.8", + 339511849L, 1), + new OsmMapValues(R.string.mongolia, "87.5", "41.4", "120.3", "52.7", + 231652214L, 1), + new OsmMapValues(R.string.pakistan, "60.83", "23.28", "77.89", "37.15", + 316649335L, 1), + new OsmMapValues(R.string.philippines, "115.58", "4.47", "127.85", "21.60", + 417733117L, 1), + new OsmMapValues(R.string.saudi_arabia, "33.2", "16.1", "55.9", "33.5", + 374101149L, 1), + new OsmMapValues(R.string.taiwan, "119.1", "21.5", "122.5", "25.2", + 213310839L, 1), + new OsmMapValues(R.string.thailand, "97.5", "5.7", "105.2", "19.7", + 345327944L, 1), + new OsmMapValues(R.string.turkey, "25.1", "35.8", "46.4", "42.8", + 547969022L, 1), + new OsmMapValues(R.string.turkmenistan, "51.78", "35.07", "66.76", "42.91", + 197833565L, 1), + new OsmMapValues(R.string.uae_other, "51.5", "22.6", "56.7", "26.5", + 188885191L, 1), + new OsmMapValues(R.string.australia, R.string.oceania, "89.84", "-57.39", "179.79", "7.26", + 1767156679L, 0), + new OsmMapValues(R.string.australia, "110.5", "-44.2", "154.9", "-9.2", + 550526915L, 0), + new OsmMapValues(R.string.tasmania, "144.0", "-45.1", "155.3", "-24.8", + 377084650L, 1), + new OsmMapValues(R.string.victoria, R.string.new_south_wales, "140.7", "-39.4", "153.7", "-26.9", + 364316999L, 1), + new OsmMapValues(R.string.new_caledonia, "157.85", "-25.05", "174.15", "-16.85", + 164225513L, 1), + new OsmMapValues(R.string.newzealand, "165.2", "-47.6", "179.1", "-33.7", + 350750954L, 1), + new OsmMapValues(R.string.europe, "-12.97", "33.59", "34.15", "72.10", + 15902268761L, 0), + // Is more than 'Europe' from above where 'western europe' should be smaller than europe + //new OsmMapValues(R.string.western_europe, "-17.6", "34.5", "42.9", "70.9", + // 16879410713L, 1), + new OsmMapValues(R.string.austria, "9.4", "46.32", "17.21", "49.1", + 1184302570L, 1), + new OsmMapValues(R.string.azores, "-31.62", "36.63", "-24.67", "40.13", + 171415530L, 1), + new OsmMapValues(R.string.belgium, "2.3", "49.5", "6.5", "51.6", + 866194492L, 1), + new OsmMapValues(R.string.benelux, "2.08", "48.87", "7.78", "54.52", + 2075973265L, 1), + new OsmMapValues(R.string.netherlands, "3.07", "50.75", "7.23", "53.73", + 1388530557L, 1), + new OsmMapValues(R.string.denmark, "7.65", "54.32", "15.58", "58.07", + 552080821L, 1), + new OsmMapValues(R.string.faroe_islands, "-7.8", "61.3", "-6.1", "62.5", + 162933852L, 1), + new OsmMapValues(R.string.france, R.string.belgium, R.string.luxembourg, + "-5.20", "42.20", "8.20", "51.68", + 4575442134L, 1), + new OsmMapValues(R.string.france, R.string.luxembourg,"-5.20", "42.20", "8.20", "51.10", + 3984216361L, 1), + new OsmMapValues(R.string.alsace, "6.79", "47.27", "8.48", "49.17", + 457980795L, 2), + new OsmMapValues(R.string.aquitaine, "-2.27", "42.44", "1.50", "45.76", + 590247901L, 2), + new OsmMapValues(R.string.auvergne, "2.01", "44.57", "4.54", "46.85", + 404857899L, 2), + new OsmMapValues(R.string.basse_normandie, "-2.09", "48.13", "1.03", "49.98", + 350392952L, 2), + new OsmMapValues(R.string.bourgogne, "2.80", "46.11", "5.58", "48.45", + 429259997L, 2), + new OsmMapValues(R.string.bretagne, "-5.58", "46.95", "-0.96", "48.99", + 506377685L, 2), + new OsmMapValues(R.string.centre, "0.01", "46.29", "3.18", "48.99", + 620373774L, 2), + new OsmMapValues(R.string.champagne_ardenne, "3.34", "47.53", "5.94", "50.28", + 404110051L, 2), + new OsmMapValues(R.string.corse, "8.12", "41.32", "9.95", "43.28", + 196000318L, 2), + new OsmMapValues(R.string.franche_comte, "5.20", "46.21", "7.83", "48.07", + 448854594L, 2), + new OsmMapValues(R.string.haute_normandie, "-0.15", "48.62", "1.85", "50.18", + 291794192L, 2), + new OsmMapValues(R.string.ile_de_france, "1.40", "48.07", "3.61", "49.29", + 404250888L, 2), + new OsmMapValues(R.string.languedoc_roussillon, "1.53", "42.25", "4.89", "45.02", + 509739604L, 2), + new OsmMapValues(R.string.limousin, "0.58", "44.87", "2.66", "46.50", + 315805128L, 2), + new OsmMapValues(R.string.lorraine, "4.84", "47.77", "7.72", "49.73", + 433828147L, 2), + new OsmMapValues(R.string.midi_pyrenees, "-0.37", "42.18", "3.50", "45.10", + 609387039L, 2), + new OsmMapValues(R.string.nord_pas_de_calais, "1.42", "49.92", "4.49", "51.31", + 480042491L, 2), + new OsmMapValues(R.string.pays_de_la_loire, "-2.88", "46.20", "0.97", "48.62", + 638031978L, 2), + new OsmMapValues(R.string.picardie, "1.25", "48.79", "4.31", "50.43", + 480802771L, 2), + new OsmMapValues(R.string.poitou_charentes, "-1.69", "45.04", "1.26", "47.23", + 459723694L, 2), + new OsmMapValues(R.string.provence_alpes_cote_d_azur, "4.21", "42.91", "7.99", "45.18", + 491232080L, 2), + new OsmMapValues(R.string.rhone_alpes, "3.65", "44.07", "7.88", "46.64", + 656454467L, 2), + new OsmMapValues(R.string.luxembourg, "5.7", "49.4", "6.5", "50.2", + 207870816L, 1), + new OsmMapValues(R.string.germany, "5.18", "46.84", "15.47", "55.64", + 4258366162L, 1), + new OsmMapValues(R.string.baden_wuerttemberg, "7.32", "47.14", "10.57", "49.85", + 859363389L, 2), + new OsmMapValues(R.string.bayern, "8.92", "47.22", "13.90", "50.62", + 1089590692L, 2), + new OsmMapValues(R.string.mittelfranken, "9.86", "48.78", "11.65", "49.84", + 278839689L, 2), + new OsmMapValues(R.string.niederbayern, "11.55", "47.75", "14.12", "49.42", + 409234523L, 2), + new OsmMapValues(R.string.oberbayern, "10.67", "47.05", "13.57", "49.14", + 494705080L, 2), + new OsmMapValues(R.string.oberfranken, "10.31", "49.54", "12.49", "50.95", + 320127656L, 2), + new OsmMapValues(R.string.oberpfalz, "11.14", "48.71", "13.47", "50.43", + 345835711L, 2), + new OsmMapValues(R.string.schwaben, "9.27", "47.10", "11.36", "49.09", + 425231381L, 2), + new OsmMapValues(R.string.unterfranken, "8.59", "49.16", "10.93", "50.67", + 407153157L, 2), + new OsmMapValues(R.string.berlin, "13.03", "52.28", "13.81", "52.73", + 232299113L, 2), + new OsmMapValues(R.string.brandenburg, "11.17", "51.30", "14.83", "53.63", + 429938728L, 2), + new OsmMapValues(R.string.bremen, "8.43", "52.96", "9.04", "53.66", + 210480663L, 2), + new OsmMapValues(R.string.hamburg, "9.56", "53.34", "10.39", "53.80", + 215777707L, 2), + new OsmMapValues(R.string.hessen, "7.72", "49.34", "10.29", "51.71", + 549304606L, 2), + new OsmMapValues(R.string.mecklenburg_vorpommern, "10.54", "53.05", "14.48", "55.05", + 298273965L, 2), + new OsmMapValues(R.string.niedersachsen, "6.40", "51.24", "11.69", "54.22", + 973888436L, 2), + new OsmMapValues(R.string.nordrhein_westfalen, "5.46", "50.26", "9.52", "52.59", + 1121091906L, 2), + new OsmMapValues(R.string.rheinland_pfalz, "6.06", "48.91", "8.56", "51.00", + 562406978L, 2), + new OsmMapValues(R.string.saarland, "6.30", "49.06", "7.46", "49.69", + 223614951L, 2), + new OsmMapValues(R.string.sachsen_anhalt, "10.50", "50.88", "13.26", "53.11", + 380652800L, 2), + new OsmMapValues(R.string.sachsen, "11.82", "50.11", "15.10", "51.73", + 452296960L, 2), + new OsmMapValues(R.string.schleswig_holstein, "7.41", "53.30", "11.98", "55.20", + 375552150L, 2), + new OsmMapValues(R.string.thueringen, "9.81", "50.15", "12.72", "51.70", + 362501525L, 2), + new OsmMapValues(R.string.iceland, "-25.3", "62.8", "-11.4", "67.5", + 198263647L, 1), + new OsmMapValues(R.string.ireland, "-11.17", "51.25", "-5.23", "55.9", + 326472032L, 1), + new OsmMapValues(R.string.italy, "6.52", "36.38", "18.96", "47.19", + 2199756999L, 1), + new OsmMapValues(R.string.spain, R.string.portugal, "-11.04", "34.87", "4.62", "44.41", + 1442482175L, 1), + new OsmMapValues(R.string.mallorca, "2.2", "38.8", "4.7", "40.2", + 246286923L, 2), + new OsmMapValues(R.string.galicia, "-10.0", "41.7", "-6.3", "44.1", + 269729717L, 2), + new OsmMapValues(R.string.scandinavia, "4.0", "54.4", "32.1", "71.5", + 2545082361L, 1), + new OsmMapValues(R.string.finland, "18.6", "59.2", "32.3", "70.3", + 919020354L, 1), + new OsmMapValues(R.string.denmark, "7.49", "54.33", "13.05", "57.88", + 488352770L, 1), + new OsmMapValues(R.string.switzerland, "5.79", "45.74", "10.59", "47.84", + 731538216L, 1), + new OsmMapValues(R.string.united_kingdom, "-9.7", "49.6", "2.2", "61.2", + 1205714793L, 1), + new OsmMapValues(R.string.england, "-7.80", "48.93", "2.41", "56.14", + 1234829532L, 1), + new OsmMapValues(R.string.buckinghamshire, "-1.19", "51.44", "-0.43", "52.25", + 216717402L, 2), + new OsmMapValues(R.string.cambridgeshire, "-0.55", "51.96", "0.56", "52.79", + 216306889L, 2), + new OsmMapValues(R.string.cumbria, "-3.96", "53.85", "-2.11", "55.24", + 227066588L, 2), + new OsmMapValues(R.string.east_yorkshire_with_hull, "-1.16", "53.50", "0.54", "54.26", + 214532411L, 2), + new OsmMapValues(R.string.essex, "-0.07", "51.40", "1.36", "52.14", + 242803228L, 2), + new OsmMapValues(R.string.herefordshire, "-3.19", "51.78", "-2.29", "52.45", + 201746914L, 2), + new OsmMapValues(R.string.kent, "-0.02", "50.81", "1.65", "51.53", + 222224232L, 2), + new OsmMapValues(R.string.lancashire, "-3.20", "53.43", "-2.00", "54.29", + 231719236L, 2), + new OsmMapValues(R.string.leicestershire, "-1.65", "52.34", "-0.61", "53.03", + 231608922L, 2), + new OsmMapValues(R.string.norfolk, "0.10", "52.30", "2.04", "53.41", + 220583805L, 2), + new OsmMapValues(R.string.nottinghamshire, "-1.39", "52.73", "-0.62", "53.55", + 222001309L, 2), + new OsmMapValues(R.string.oxfordshire, "-1.77", "51.41", "-0.82", "52.22", + 215858382L, 2), + new OsmMapValues(R.string.shropshire, "-3.29", "52.26", "-2.18", "53.05", + 210489688L, 2), + new OsmMapValues(R.string.somerset, "-3.89", "50.77", "-2.20", "51.40", + 221498821L, 2), + new OsmMapValues(R.string.south_yorkshire, "-1.88", "53.25", "-0.80", "53.71", + 217566765L, 2), + new OsmMapValues(R.string.suffolk, "0.29", "51.88", "1.81", "52.60", + 218109848L, 2), + new OsmMapValues(R.string.surrey, "-0.90", "51.02", "0.10", "51.52", + 238058353L, 2), + new OsmMapValues(R.string.wiltshire, "-2.41", "50.90", "-1.44", "51.76", + 212963156L, 2), + new OsmMapValues(R.string.scotland, "-8.13", "54.49", "-0.15", "61.40", + 372486133L, 2), + new OsmMapValues(R.string.wales, "-5.56", "51.28", "-2.60", "53.60", + 281554024L, 2), + new OsmMapValues(R.string.albania, "19.09", "39.55", "21.12", "42.72", + 227718134L, 1), + new OsmMapValues(R.string.belarus, "23.12", "51.21", "32.87", "56.23", + 475885189L, 1), + new OsmMapValues(R.string.russian_federation, "27.9", "41.5", "190.4", "77.6", + 3368130201L, 1), + new OsmMapValues(R.string.bulgaria, "24.7", "42.1", "24.8", "42.1", + 162974147L, 1), + new OsmMapValues(R.string.bosnia_and_herzegovina, "15.69", "42.52", "19.67", "45.32", + 272871917L, 1), + new OsmMapValues(R.string.czech_republic, "11.91", "48.48", "19.02", "51.17", + 1100792845L, 1), + new OsmMapValues(R.string.croatia, "13.4", "42.1", "19.4", "46.9", + 718506859L, 1), + new OsmMapValues(R.string.estonia, "21.5", "57.5", "28.2", "59.6", + 239147853L, 1), + new OsmMapValues(R.string.greece, "28.9", "37.8", "29.0", "37.8", + 165328625L, 1), + new OsmMapValues(R.string.crete, "23.3", "34.5", "26.8", "36.0", + 174905198L, 1), + new OsmMapValues(R.string.hungary, "16.08", "45.57", "23.03", "48.39", + 499823508L, 1), + new OsmMapValues(R.string.latvia, "20.7", "55.6", "28.3", "58.1", + 272931650L, 1), + new OsmMapValues(R.string.lithuania, "20.9", "53.8", "26.9", "56.5", + 332328437L, 1), + new OsmMapValues(R.string.poland, "13.6", "48.8", "24.5", "55.0", + 1849496038L, 1), + new OsmMapValues(R.string.romania, "20.3", "43.5", "29.9", "48.4", + 497623904L, 1), + new OsmMapValues(R.string.slovakia, "16.8", "47.7", "22.6", "49.7", + 518251489L, 1), + new OsmMapValues(R.string.ukraine, "22.0", "44.3", "40.4", "52.4", + 1105659895L, 1), + new OsmMapValues(R.string.north_america, "-178.1", "6.5", "-10.4", "84.0", + 7727821782L, 0), + new OsmMapValues(R.string.alaska, "-179.5", "49.5", "-129", "71.6", + 309103093L, 1), + new OsmMapValues(R.string.canada, "-141.3", "41.5", "-52.2", "70.2", + 3564630901L, 1), + new OsmMapValues(R.string.hawaii, "-161.07", "18.49", "-154.45", "22.85", + 170132156L, 1), + new OsmMapValues(R.string.usa, R.string.except_alaska_and_hawaii, "-125.4", "24.3", "-66.5", "49.3", + 5533181627L, 1), + new OsmMapValues(R.string.midwest, "-104.11", "35.92", "-80.46", "49.46", + 1565753619L, 2), + new OsmMapValues(R.string.michigan, "-90.47", "41.64", "-79.00", "49.37", + 794434442L, 2), + new OsmMapValues(R.string.ohio, "-84.87", "38.05", "-79.85", "43.53", + 428282496L, 2), + new OsmMapValues(R.string.northeast, "-80.58", "38.72", "-66.83", "47.53", + 1391521085L, 2), + new OsmMapValues(R.string.massachusetts, "-73.56", "40.78", "-68.67", "42.94", + 438012615L, 2), + new OsmMapValues(R.string.vermont, "-73.49", "42.68", "-71.41", "45.07", + 206957907L, 2), + new OsmMapValues(R.string.pacific, "-180.05", "15.87", "-129.75", "73.04", + 309809468L, 2), + new OsmMapValues(R.string.south, "-106.70", "23.98", "-71.46", "40.70", + 2466350986L, 2), + new OsmMapValues(R.string.arkansas, "-94.67", "32.95", "-89.59", "36.60", + 223752575L, 2), + new OsmMapValues(R.string.district_of_columbia, "-77.17", "38.74", "-76.86", "39.05", + 201055647L, 2), + new OsmMapValues(R.string.florida, "-88.75", "23.63", "-77.67", "31.05", + 372359367L, 2), + new OsmMapValues(R.string.louisiana, "-94.09", "28.09", "-88.62", "33.07", + 290673534L, 2), + new OsmMapValues(R.string.maryland, "-79.54", "37.83", "-74.99", "40.22", + 409820479L, 2), + new OsmMapValues(R.string.mississippi, "-91.71", "29.99", "-88.04", "35.05", + 246036091L, 2), + new OsmMapValues(R.string.oklahoma, "-103.41", "33.56", "-94.38", "37.38", + 265042769L, 2), + new OsmMapValues(R.string.texas, "-106.96", "25.62", "-92.97", "36.58", + 625570538L, 2), + new OsmMapValues(R.string.virginia, "-83.73", "36.49", "-74.25", "39.52", + 546119530L, 2), + new OsmMapValues(R.string.west_virginia, "-82.70", "37.15", "-77.66", "40.97", + 319698480L, 2), + new OsmMapValues(R.string.west, "-133.11", "31.28", "-101.99", "49.51", + 1501540635L, 2), + new OsmMapValues(R.string.arizona, "-114.88", "30.01", "-108.99", "37.06", + 276838815L, 2), + new OsmMapValues(R.string.california, "-125.94", "32.43", "-114.08", "42.07", + 725286705L, 2), + new OsmMapValues(R.string.colorado, "-109.11", "36.52", "-100.41", "41.05", + 328730867L, 2), + new OsmMapValues(R.string.idaho, "-117.30", "41.93", "-110.99", "49.18", + 241725898L, 2), + new OsmMapValues(R.string.montana, "-116.10", "44.31", "-102.64", "49.74", + 246850772L, 2), + new OsmMapValues(R.string.new_mexico, "-109.10", "26.98", "-96.07", "37.05", + 542205524L, 2), + new OsmMapValues(R.string.nevada, "-120.2", "35.0", "-113.8", "42.1", + 269630259L, 2), + new OsmMapValues(R.string.oregon, "-124.8", "41.8", "-116.3", "46.3", + 290552225L, 2), + new OsmMapValues(R.string.utah, "-114.11", "36.95", "-108.99", "42.05", + 222549404L, 2), + new OsmMapValues(R.string.washington_state, "-125.0", "45.5", "-116.9", "49.0", + 323577562L, 2), + new OsmMapValues(R.string.south_middle_america, "-83.5", "-56.3", "-30.8", "13.7", + 1803470489L, 0), + new OsmMapValues(R.string.argentina, "-73.9", "-57.3", "-51.6", "-21.0", + 640249385L, 1), + new OsmMapValues(R.string.argentina, R.string.chile, "-77.2", "-56.3", "-52.7", "-16.1", + 713424629L, 1), + new OsmMapValues(R.string.bolivia, "-70.5", "-23.1", "-57.3", "-9.3", + 257531768L, 1), + new OsmMapValues(R.string.brazil, "-71.4", "-34.7", "-32.8", "5.4", + 1275564517L, 1), + new OsmMapValues(R.string.chile, "-81.77", "-58.50", "-65.46", "-17.41", + 400742681L, 1), + new OsmMapValues(R.string.cuba, "-85.3", "19.6", "-74.0", "23.6", + 190849399L, 1), + new OsmMapValues(R.string.colombia, "-79.1", "-4.0", "-66.7", "12.6", + 337606776L, 1), + new OsmMapValues(R.string.ecuador, "-82.6", "-5.4", "-74.4", "2.3", + 231183832L, 1), + new OsmMapValues(R.string.guyana, R.string.suriname, R.string.guyane_francaise, + "-62.0", "1.0", "-51.2", "8.9", + 123000072L, 1), + new OsmMapValues(R.string.haiti, R.string.dominican_republic, "-74.8", "17.3", "-68.2", "20.1", + 213013324L, 1), + new OsmMapValues(R.string.jamaica, "-78.6", "17.4", "-75.9", "18.9", + 168748968L, 1), + new OsmMapValues(R.string.mexico, "-117.6", "14.1", "-86.4", "32.8", + 829539696L, 1), + new OsmMapValues(R.string.paraguay, "-63.8", "-28.1", "-53.6", "-18.8", + 262841159L, 1), + new OsmMapValues(R.string.peru, "-82.4", "-18.1", "-67.5", "0.4", + 328138464L, 1), + new OsmMapValues(R.string.uruguay, "-59.2", "-36.5", "-51.7", "-29.7", + 227796557L, 1), + new OsmMapValues(R.string.venezuela, "-73.6", "0.4", "-59.7", "12.8", + 262760703L, 1) }; //we should try to resume private static final int SOCKET_CONNECT_TIMEOUT = 60000; // 60 secs. @@ -473,7 +474,6 @@ public class NavitMapDownloader extends Thread { private static final int UPDATE_PROGRESS_TIME_NS = 1000 * 1000000; // 1ns=1E-9s private static final int MAX_RETRIES = 5; private static final String TAG = "NavitMapDownLoader"; - private final String mMapFilenamePath; private final OsmMapValues mMapValues; private final int mMapId; private Boolean mStopMe = false; @@ -484,7 +484,6 @@ public class NavitMapDownloader extends Thread { NavitMapDownloader(int mapId) { this.mMapValues = osm_maps[mapId]; this.mMapId = mapId; - this.mMapFilenamePath = Navit.sMapFilenamePath; } static NavitMap[] getAvailableMaps() { @@ -539,7 +538,7 @@ public class NavitMapDownloader extends Thread { if (success || mStopMe) { NavitDialogs.sendDialogMessage(NavitDialogs.MSG_MAP_DOWNLOAD_FINISHED, - mMapFilenamePath + mMapValues.mMapName + ".bin", null, -1, success ? 1 : 0, mMapId); + Navit.sMapFilenamePath + mMapValues.mMapName + ".bin", null, -1, success ? 1 : 0, mMapId); } } @@ -549,7 +548,7 @@ public class NavitMapDownloader extends Thread { } private boolean checkFreeSpace(long neededBytes) { - long freeSpace = getFreeSpace(); + long freeSpace = NavitUtils.getFreeSpace(Navit.sMapFilenamePath); if (neededBytes <= 0) { neededBytes = MAP_WRITE_FILE_BUFFER; @@ -575,8 +574,8 @@ public class NavitMapDownloader extends Thread { File finalOutputFile = getMapFile(); if (finalOutputFile.exists()) { - Message msg = Message.obtain(NavitGraphics.sCallbackHandler, - NavitGraphics.MsgType.CLB_DELETE_MAP.ordinal()); + Message msg = Message.obtain(NavitCallbackHandler.sCallbackHandler, + NavitCallbackHandler.MsgType.CLB_DELETE_MAP.ordinal()); Bundle b = new Bundle(); b.putString("title", finalOutputFile.getAbsolutePath()); msg.setData(b); @@ -649,7 +648,7 @@ public class NavitMapDownloader extends Thread { } private File getDestinationFile() { - File outputFile = new File(mMapFilenamePath, mMapValues.mMapName + ".tmp"); + File outputFile = new File(Navit.sMapFilenamePath, mMapValues.mMapName + ".tmp"); outputFile.getParentFile().mkdir(); return outputFile; } @@ -691,14 +690,6 @@ public class NavitMapDownloader extends Thread { return url; } - private long getFreeSpace() { - try { - StatFs fsInfo = new StatFs(mMapFilenamePath); - return (long) fsInfo.getAvailableBlocks() * fsInfo.getBlockSize(); - } catch (Exception e) { - return -1; - } - } private BufferedInputStream getInputStream(URLConnection c) { BufferedInputStream bif; @@ -720,11 +711,11 @@ public class NavitMapDownloader extends Thread { } private File getMapFile() { - return new File(mMapFilenamePath, mMapValues.mMapName + ".bin"); + return new File(Navit.sMapFilenamePath, mMapValues.mMapName + ".bin"); } private File getMapInfoFile() { - return new File(mMapFilenamePath, mMapValues.mMapName + ".tmp.info"); + return new File(Navit.sMapFilenamePath, mMapValues.mMapName + ".tmp.info"); } private BufferedOutputStream getOutputStream(File outputFile, boolean resume) { @@ -888,21 +879,18 @@ public class NavitMapDownloader extends Thread { mRetryCounter++; } + static class OsmMapValues { - final String mLon1; - final String mLat1; - final String mLon2; - final String mLat2; + String mLon1; + String mLat1; + String mLon2; + String mLat2; final String mMapName; - final long mEstSizeBytes; - final int mLevel; + long mEstSizeBytes; + int mLevel; - - private OsmMapValues(String mapName, String lon1, String lat1, String lon2, - String lat2, - long bytesEst, int level) { - this.mMapName = mapName; + private void setMapValues(String lon1, String lat1, String lon2, String lat2, long bytesEst, int level) { this.mLon1 = lon1; this.mLat1 = lat1; this.mLon2 = lon2; @@ -911,6 +899,29 @@ public class NavitMapDownloader extends Thread { this.mLevel = level; } + private OsmMapValues(int id1, String lon1, String lat1, String lon2, String lat2, + long bytesEst, int level) { + + this.mMapName = getTstring(id1); + setMapValues(lon1, lat1, lon2, lat2, bytesEst, level); + } + + private OsmMapValues(int id1, int id2, String lon1, String lat1, String lon2, String lat2, + long bytesEst, int level) { + + this.mMapName = getTstring(id1) + " + " + getTstring(id2); + setMapValues(lon1, lat1, lon2, lat2, bytesEst, level); + } + + + private OsmMapValues(int id1, int id2, int id3, String lon1, String lat1, String lon2, String lat2, + long bytesEst, int level) { + + mMapName = getTstring(id1) + " + " + getTstring(id2) + " + " + getTstring(id3); + setMapValues(lon1, lat1, lon2, lat2, bytesEst, level); + } + + boolean isInMap(Location location) { if (location.getLongitude() < Double.valueOf(this.mLon1)) { diff --git a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java index 2e10e896e..d5fe43afd 100644 --- a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java +++ b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java @@ -58,18 +58,18 @@ public class NavitRestoreTask extends AsyncTask { ObjectInputStream preferenceOis = null; try { /* Delete all old Files in Home */ - NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/bookmark.txt"); - NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/destination.txt"); - NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/gui_internal.txt"); + NavitUtils.removeFileIfExists(Navit.sMapFilenamePath + "/home/bookmark.txt"); + NavitUtils.removeFileIfExists(Navit.sMapFilenamePath + "/home/destination.txt"); + NavitUtils.removeFileIfExists(Navit.sMapFilenamePath + "/home/gui_internal.txt"); /* Restore Files in home */ NavitUtils.copyFileIfExists(backupDir.getPath() + "/bookmark.txt", - Navit.sNavitDataDir + "/home/bookmark.txt"); + Navit.sMapFilenamePath + "/home/bookmark.txt"); NavitUtils.copyFileIfExists(backupDir.getPath() + "/destination.txt", - Navit.sNavitDataDir + "/home/destination.txt"); + Navit.sMapFilenamePath + "/home/destination.txt"); NavitUtils.copyFileIfExists(backupDir.getPath() + "/gui_internal.txt", - Navit.sNavitDataDir + "/home/gui_internal.txt"); + Navit.sMapFilenamePath + "/home/gui_internal.txt"); /* Restore Shared Preferences */ preferenceOis = new ObjectInputStream( diff --git a/navit/android/src/org/navitproject/navit/NavitUtils.java b/navit/android/src/org/navitproject/navit/NavitUtils.java index bbdf6539e..e163c5576 100644 --- a/navit/android/src/org/navitproject/navit/NavitUtils.java +++ b/navit/android/src/org/navitproject/navit/NavitUtils.java @@ -8,6 +8,12 @@ import java.io.IOException; class NavitUtils { + static long getFreeSpace(String path) { + + File file = new File(path); + return file.getUsableSpace(); + } + static void removeFileIfExists(String source) { File file = new File(source); diff --git a/navit/android/src/org/navitproject/navit/NavitVehicle.java b/navit/android/src/org/navitproject/navit/NavitVehicle.java index e8c43e474..e72679c3e 100644 --- a/navit/android/src/org/navitproject/navit/NavitVehicle.java +++ b/navit/android/src/org/navitproject/navit/NavitVehicle.java @@ -67,6 +67,7 @@ public class NavitVehicle { sLocationManager.removeUpdates(sFastLocationListener); mFastProvider = null; } + sLastLocation = location; vehicleCallback(mVehiclePcbid, location); vehicleCallback(mVehicleFcbid, 1); } -- cgit v1.2.1