summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjandegr <jandegr@users.noreply.github.com>2018-05-04 09:04:01 +0200
committerGitHub <noreply@github.com>2018-05-04 09:04:01 +0200
commit12608248d6fce792590846cef1fe4bde9929cdf2 (patch)
treee377fd2f6c31c6b60c170fee72ea7be8fe38704e
parenta66d4b920d34591855f8219f65522e49e5d0b867 (diff)
downloadnavit-12608248d6fce792590846cef1fe4bde9929cdf2.tar.gz
refactor:Android (#572)
* Delete NavitTextTranslations.java * Add files via upload * Add files via upload
-rw-r--r--navit/android/res/values/strings.xml1
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java141
-rw-r--r--navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java32
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDialogs.java14
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java55
-rw-r--r--navit/android/src/org/navitproject/navit/NavitGraphics.java544
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMapDownloader.java478
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java11
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTextTranslations.java204
9 files changed, 584 insertions, 896 deletions
diff --git a/navit/android/res/values/strings.xml b/navit/android/res/values/strings.xml
index 3a730e807..7506c21e8 100644
--- a/navit/android/res/values/strings.xml
+++ b/navit/android/res/values/strings.xml
@@ -40,6 +40,7 @@
<string name="map_download_not_enough_free_space">Not enough free space</string>
<string name="map_no_fix">No location. Reopen after location fix.</string>
<string name="maps_for_current_location">Maps containing current location</string>
+ <string name="maps_installed">Installed maps</string>
<!-- ADDRESS SEARCH -->
<string name="address_search_title">Address search</string>
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
index e2d122de2..cf0096453 100644
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ b/navit/android/src/org/navitproject/navit/Navit.java
@@ -70,38 +70,38 @@ import android.support.v4.content.ContextCompat;
public class Navit extends Activity
{
- public NavitDialogs dialogs;
- private PowerManager.WakeLock wl;
- private NavitActivityResult ActivityResults[];
- public static InputMethodManager mgr = null;
- public static DisplayMetrics metrics = null;
- public static int status_bar_height = 0;
- public static int action_bar_default_height = 0;
- public static int navigation_bar_height = 0;
- public static int navigation_bar_height_landscape= 0;
- public static int navigation_bar_width = 0;
- public static Boolean show_soft_keyboard = false;
- public static Boolean show_soft_keyboard_now_showing = false;
- public static long last_pressed_menu_key = 0L;
- public static long time_pressed_menu_key = 0L;
- private static Intent startup_intent = null;
- private static long startup_intent_timestamp = 0L;
- public static String my_display_density = "mdpi";
- public static final int NavitDownloaderSelectMap_id = 967;
- public static final int NavitAddressSearch_id = 70;
- public static final int NavitSelectStorage_id = 43;
- public static String NavitLanguage;
- public static Resources NavitResources = null;
- static final String NAVIT_PACKAGE_NAME = "org.navitproject.navit";
- static final String TAG = "Navit";
- static String map_filename_path = null;
- static final String NAVIT_DATA_DIR = "/data/data/" + NAVIT_PACKAGE_NAME;
- static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
- public static final String NAVIT_PREFS = "NavitPrefs";
- Boolean isFullscreen = false;
- private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
- public static NotificationManager nm;
- private static Navit navit;
+ private NavitDialogs dialogs;
+ private PowerManager.WakeLock wl;
+ private NavitActivityResult ActivityResults[];
+ public static InputMethodManager mgr = null;
+ public static DisplayMetrics metrics = null;
+ public static int status_bar_height = 0;
+ private static int action_bar_default_height = 0;
+ public static int navigation_bar_height = 0;
+ public static int navigation_bar_height_landscape = 0;
+ public static int navigation_bar_width = 0;
+ public static Boolean show_soft_keyboard = false;
+ public static Boolean show_soft_keyboard_now_showing = false;
+ public static long last_pressed_menu_key = 0L;
+ public static long time_pressed_menu_key = 0L;
+ private static Intent startup_intent = null;
+ private static long startup_intent_timestamp = 0L;
+ private static String my_display_density = "mdpi";
+ private static final int NavitDownloaderSelectMap_id = 967;
+ private static final int NavitAddressSearch_id = 70;
+ private static final int NavitSelectStorage_id = 43;
+ private static String NavitLanguage;
+ public static Resources NavitResources = null;
+ private static final String NAVIT_PACKAGE_NAME = "org.navitproject.navit";
+ private static final String TAG = "Navit";
+ static String map_filename_path = null;
+ static final String NAVIT_DATA_DIR = "/data/data/" + NAVIT_PACKAGE_NAME;
+ private static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
+ public static final String NAVIT_PREFS = "NavitPrefs";
+ Boolean isFullscreen = false;
+ private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
+ private static NotificationManager nm;
+ private static Navit navit;
public static Navit getInstance() {
return navit;
@@ -119,14 +119,14 @@ public class Navit extends Activity
Navit.this.showNativeKeyboard();
}
}
-
-
+
+
public void removeFileIfExists(String source) {
File file = new File(source);
if (!file.exists())
return;
-
+
file.delete();
}
@@ -159,10 +159,9 @@ public class Navit extends Activity
}
}
-
- public static String T(String in)
+ public String T(String in)
{
- return NavitTextTranslations.get_text(in);
+ return getLocalizedString(in);
}
private boolean extractRes(String resname, String result) {
@@ -226,7 +225,7 @@ public class Navit extends Activity
infobox.setCancelable(false);
infobox.setMessage(R.string.initial_info_box_message);
-
+
// TRANS
infobox.setPositiveButton(getString(R.string.initial_info_box_OK), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
@@ -273,15 +272,12 @@ public class Navit extends Activity
Log.d(TAG, "**1**A " + startup_intent.getAction());
Log.d(TAG, "**1**D " + startup_intent.getDataString());
- // init translated text
- NavitTextTranslations.init();
-
// NOTIFICATION
// Setup the status bar notification
// This notification is removed in the exit() function
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
-
+
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setContentIntent(appIntent);
builder.setAutoCancel(false).setOngoing(true);
@@ -290,7 +286,7 @@ public class Navit extends Activity
builder.setSmallIcon(R.drawable.ic_notify);
Notification NavitNotification = builder.build();
nm.notify(R.string.app_name, NavitNotification);// Show the notification
-
+
// Status and navigation bar sizes
// These are platform defaults and do not change with rotation, but we have to figure out which ones apply
// (is the navigation bar visible? on the side or at the bottom?)
@@ -324,9 +320,6 @@ public class Navit extends Activity
langc = lang.substring(0, pos);
NavitLanguage = langc + lang.substring(pos).toUpperCase(locale);
Log.d(TAG, "substring lang " + NavitLanguage.substring(pos).toUpperCase(locale));
- // set lang. for translation
- NavitTextTranslations.main_language = langc;
- NavitTextTranslations.sub_language = NavitLanguage.substring(pos).toUpperCase(locale);
}
else
{
@@ -334,9 +327,6 @@ public class Navit extends Activity
Log.d(TAG, "Country1 " + country);
Log.d(TAG, "Country2 " + country.toUpperCase(locale));
NavitLanguage = langc + "_" + country.toUpperCase(locale);
- // set lang. for translation
- NavitTextTranslations.main_language = langc;
- NavitTextTranslations.sub_language = country.toUpperCase(locale);
}
Log.d(TAG, "Language " + lang);
@@ -458,7 +448,7 @@ public class Navit extends Activity
cf.getHandler().post(new SoftInputRestorer());
}
}
-
+
@Override
public void onPause() {
super.onPause();
@@ -469,7 +459,7 @@ public class Navit extends Activity
show_soft_keyboard_now_showing = true;
}
}
-
+
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
@@ -492,28 +482,28 @@ public class Navit extends Activity
}
}
}
-
+
private void parseNavigationURI(String schemeSpecificPart) {
String naviData[]= schemeSpecificPart.split("&");
Pattern p = Pattern.compile("(.*)=(.*)");
Map<String,String> params = new HashMap<String,String>();
for (int count=0; count < naviData.length; count++) {
Matcher m = p.matcher(naviData[count]);
-
+
if (m.matches()) {
params.put(m.group(1), m.group(2));
}
}
-
+
// d: google.navigation:q=blabla-strasse # (this happens when you are offline, or from contacts)
// a: google.navigation:ll=48.25676,16.643&q=blabla-strasse
// c: google.navigation:ll=48.25676,16.643
// b: google.navigation:q=48.25676,16.643
-
+
Float lat;
Float lon;
Bundle b = new Bundle();
-
+
String geoString = params.get("ll");
if (geoString != null) {
String address = params.get("q");
@@ -581,7 +571,7 @@ public class Navit extends Activity
/* Only show the Backup to SD-Card Option if we really have one */
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
menu.add(1, 7, 700, getString(R.string.optionsmenu_backup_restore)); //TRANS
-
+
return true;
}
@@ -688,8 +678,8 @@ public class Navit extends Activity
break;
}
}
-
-
+
+
/**
* @brief Shows the Options menu.
*
@@ -737,8 +727,8 @@ public class Navit extends Activity
Log.d(TAG, "showNativeKeyboard:return (assuming true)");
return inputHeight;
}
-
-
+
+
/**
* @brief Hides the native keyboard or other input method.
*/
@@ -746,8 +736,8 @@ public class Navit extends Activity
mgr.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
show_soft_keyboard_now_showing = false;
}
-
-
+
+
void setDestination(float latitude, float longitude, String address) {
Toast.makeText( getApplicationContext(),getString(R.string.address_search_set_destination) + "\n" + address, Toast.LENGTH_LONG).show(); //TRANS
@@ -794,7 +784,7 @@ public class Navit extends Activity
SharedPreferences.Editor prefs_editor = prefs.edit();
prefs_editor.putString("filenamePath", newDir);
prefs_editor.apply();
- Toast.makeText(this, String.format(Navit.T("New location set to %s\nRestart Navit to apply the changes."),newDir),Toast.LENGTH_LONG).show();
+ Toast.makeText(this, String.format(T("New location set to %s\nRestart Navit to apply the changes."),newDir),Toast.LENGTH_LONG).show();
}
else Log.w(TAG, "select path failed");
break;
@@ -806,7 +796,7 @@ public class Navit extends Activity
@Override
protected void onPrepareDialog(int id, Dialog dialog) {
- dialogs.prepareDialog(id, dialog);
+ dialogs.prepareDialog(id);
super.onPrepareDialog(id, dialog);
}
@@ -824,7 +814,7 @@ public class Navit extends Activity
return true;
}
- public void setMapLocation()
+ private void setMapLocation()
{
Intent fileExploreIntent = new Intent(this,FileBrowserActivity.class);
fileExploreIntent
@@ -838,15 +828,15 @@ public class Navit extends Activity
{
super.onDestroy();
Log.d(TAG, "OnDestroy");
- // TODO next call will kill our app the hard way. This should not be necessary, but ensures navit is
+ // next call will kill our app the hard way. This should not be necessary, but ensures navit is
// properly restarted and no resources are wasted with navit in background. Remove this call after
// code review
NavitDestroy();
}
-
+
public void fullscreen(int fullscreen) {
int w, h;
-
+
isFullscreen = (fullscreen != 0);
if (isFullscreen) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -856,7 +846,7 @@ public class Navit extends Activity
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
-
+
Display display_ = getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT < 17) {
w = display_.getWidth();
@@ -877,7 +867,7 @@ public class Navit extends Activity
wl.release();
}
- public void exit()
+ private void exit()
{
nm.cancelAll();
NavitVehicle.removeListener();
@@ -887,6 +877,13 @@ public class Navit extends Activity
public native void NavitMain(Navit x, String lang, int version, String display_density_string, String path, String path2);
public native void NavitDestroy();
+
+ protected String getLocalizedString(String text)
+ {
+ return NavitGraphics.CallbackLocalizedString(text);
+ }
+
+
/*
* this is used to load the 'navit' native library on
* application startup. The library has already been unpacked at
diff --git a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
index 361a511ab..1fbe65a86 100644
--- a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
@@ -63,10 +63,10 @@ public class NavitAddressSearchActivity extends Activity {
addr = address;
}
- int result_type;
- float lat;
- float lon;
- String addr;
+ final int result_type;
+ final float lat;
+ final float lon;
+ final String addr;
}
private static final String TAG = "NavitAddress";
@@ -78,7 +78,7 @@ public class NavitAddressSearchActivity extends Activity {
private boolean mPartialSearch = false;
private String mCountry;
private ImageButton mCountryButton;
- ProgressDialog search_results_wait = null;
+ private ProgressDialog search_results_wait = null;
public RelativeLayout NavitAddressSearchActivity_layout;
private int search_results_towns = 0;
private int search_results_streets = 0;
@@ -97,7 +97,7 @@ public class NavitAddressSearchActivity extends Activity {
Field field = res.getField(resourceName);
drawableId = field.getInt(null);
} catch (Exception e) {
- Log.e("NavitAddressSearch", "Failure to get drawable id.", e);
+ Log.e(TAG, "Failure to get drawable id.", e);
}
return drawableId;
}
@@ -152,7 +152,7 @@ public class NavitAddressSearchActivity extends Activity {
mCountry = defaultLocale.getCountry().toLowerCase(defaultLocale);
SharedPreferences.Editor edit_settings = settings.edit();
edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.commit();
+ edit_settings.apply();
}
mCountryButton = new ImageButton(this);
@@ -167,14 +167,14 @@ public class NavitAddressSearchActivity extends Activity {
// address: label and text field
TextView addr_view = new TextView(this);
- addr_view.setText(Navit.T("Enter Destination")); // TRANS
+ addr_view.setText(Navit.getInstance().T("Enter Destination")); // TRANS
addr_view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
addr_view.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addr_view.setPadding(4, 4, 4, 4);
// partial match checkbox
final CheckBox checkboxPartialMatch = new CheckBox(this);
- checkboxPartialMatch.setText(Navit.T("partial match")); // TRANS
+ checkboxPartialMatch.setText(Navit.getInstance().T("partial match")); // TRANS
checkboxPartialMatch.setChecked(last_address_partial_match);
checkboxPartialMatch.setGravity(Gravity.CENTER);
@@ -184,7 +184,7 @@ public class NavitAddressSearchActivity extends Activity {
// search button
final Button btnSearch = new Button(this);
- btnSearch.setText(Navit.T("Search")); // TRANS
+ btnSearch.setText(Navit.getInstance().T("Search")); // TRANS
btnSearch.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
btnSearch.setGravity(Gravity.CENTER);
btnSearch.setOnClickListener(new OnClickListener() {
@@ -226,9 +226,7 @@ public class NavitAddressSearchActivity extends Activity {
}
String title = getString(R.string.address_search_title);
-
- if (title != null && title.length() > 0)
- this.setTitle(title);
+ this.setTitle(title);
LinearLayout searchSettingsLayout = new LinearLayout(this);
searchSettingsLayout.setOrientation(LinearLayout.HORIZONTAL);
@@ -269,7 +267,7 @@ public class NavitAddressSearchActivity extends Activity {
mCountry = all_countries[item][0];
SharedPreferences.Editor edit_settings = settings.edit();
edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.commit();
+ edit_settings.apply();
setCountryButtonImage();
}
@@ -298,8 +296,8 @@ public class NavitAddressSearchActivity extends Activity {
break;
}
- search_results_wait.setMessage(Navit.T("Towns") + ":" + search_results_towns + " "
- + Navit.T("Streets") + ":" + search_results_streets + "/"
+ search_results_wait.setMessage(Navit.getInstance().T("Towns") + ":" + search_results_towns + " "
+ + Navit.getInstance().T("Streets") + ":" + search_results_streets + "/"
+ search_results_streets_hn);
search_results_wait.setProgress(Addresses_found.size() % (ADDRESS_RESULT_PROGRESS_MAX + 1));
@@ -378,7 +376,7 @@ public class NavitAddressSearchActivity extends Activity {
return search_results_wait;
}
- void executeSearch() {
+ private void executeSearch() {
showDialog(0);
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitDialogs.java b/navit/android/src/org/navitproject/navit/NavitDialogs.java
index 7605b7aa9..3d39227c4 100644
--- a/navit/android/src/org/navitproject/navit/NavitDialogs.java
+++ b/navit/android/src/org/navitproject/navit/NavitDialogs.java
@@ -26,14 +26,12 @@ public class NavitDialogs extends Handler{
static final int MSG_PROGRESS_BAR = 1;
static final int MSG_TOAST = 2;
static final int MSG_TOAST_LONG = 3;
- static final int MSG_POSITION_MENU = 6;
- static final int MSG_START_MAP_DOWNLOAD = 7;
+ static final int MSG_START_MAP_DOWNLOAD = 7;
private static final int MSG_REMOVE_DIALOG_GENERIC = 99;
private static Handler mHandler;
-
+ private final String TAG = "NavitDialogs";
private ProgressDialog mapdownloader_dialog = null;
private NavitMapDownloader mapdownloader = null;
-
private Navit mActivity;
NavitDialogs(Navit activity) {
@@ -102,7 +100,7 @@ public class NavitDialogs extends Handler{
case MSG_START_MAP_DOWNLOAD:
{
int download_map_id = msg.arg1;
- Log.d("Navit", "PRI id=" + download_map_id);
+ Log.d(TAG, "PRI id=" + download_map_id);
// set map id to download
// show the map download progressbar, and download the map
@@ -140,7 +138,7 @@ public class NavitDialogs extends Handler{
{
public void onDismiss(DialogInterface dialog)
{
- Log.e("Navit", "onDismiss: mapdownloader_dialog");
+ Log.e(TAG, "onDismiss: mapdownloader_dialog");
if(mapdownloader!=null)
mapdownloader.stop_thread();
}
@@ -148,7 +146,7 @@ public class NavitDialogs extends Handler{
mapdownloader_dialog.setOnDismissListener(onDismissListener);
// show license for OSM maps
Toast.makeText(mActivity.getApplicationContext(),
- Navit.T("Map data (c) OpenStreetMap contributors, ODBL"),
+ Navit.getInstance().T("Map data (c) OpenStreetMap contributors, ODBL"),
Toast.LENGTH_LONG).show(); //TRANS
return mapdownloader_dialog;
@@ -209,7 +207,7 @@ public class NavitDialogs extends Handler{
return null;
}
- public void prepareDialog(int id, Dialog dialog) {
+ public void prepareDialog(int id) {
/* Remove the Dialog to force Android to rerun onCreateDialog */
if(id == DIALOG_SELECT_BACKUP)
diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
index f0b01ee0f..3c47cef1a 100644
--- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
@@ -23,31 +23,33 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ExpandableListActivity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
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;
import android.widget.ExpandableListView;
-import android.widget.RelativeLayout;
import android.widget.SimpleExpandableListAdapter;
-import android.widget.TextView;
public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
- private static SimpleExpandableListAdapter adapter = null;
- private static final String MAP_BULLETPOINT = " * ";
- private static ArrayList<HashMap<String, String>> downloaded_maps_childs = null;
+ private static final String TAG = "DownloadSelectMap";
+ private static SimpleExpandableListAdapter adapter = null;
+ private static final String MAP_BULLETPOINT = " * ";
+ private static ArrayList<HashMap<String, String>> downloaded_maps_childs = null;
private static ArrayList<HashMap<String, String>> maps_current_position_childs = null;
- private static boolean currentLocationKnown = false;
+ private static boolean currentLocationKnown = false;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -62,18 +64,17 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
try {
setTitle(String.valueOf(getFreeSpace() / 1024 / 1024) + "MB available");
} catch (Exception e) {
- Log.e("Navit","Exception "+e.getClass().getName()+" during getFreeSpace, reporting 'no sdcard present'");
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- String.format(Navit.T("Current map location %s is not available\nPlease restart Navit after you attach an SD card or select a different map location."),Navit.map_filename_path),
- -1, 0, 0);
+ Log.e(TAG, "Exception " + e.getClass().getName() + " during getFreeSpace, reporting 'no sdcard present'");
+ NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
+ String.format(Navit.getInstance().T("Current map location %s is not available\nPlease restart Navit after you attach an SD card or select a different map location."), Navit.map_filename_path),
+ -1, 0, 0);
finish();
}
}
- protected long getFreeSpace()
- {
+ private long getFreeSpace() {
StatFs fsInfo = new StatFs(Navit.map_filename_path);
- return (long)fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
+ return (long) fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
}
private void updateDownloadedMaps() {
@@ -92,9 +93,13 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
if (currentLocation == null) {
LocationManager mapLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> providers = mapLocationManager.getProviders(true);
- long lastUpdate = 0;
+ long lastUpdate;
long bestUpdateTime = -1;
for (String provider : providers) {
+ if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
+ && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
Location lastKnownLocation = mapLocationManager.getLastKnownLocation(provider);
if (lastKnownLocation != null) {
lastUpdate = lastKnownLocation.getTime();
@@ -108,8 +113,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
if (currentLocation != null) {
// if this map contains data to our current position, add it to
- // the
- // MapsOfCurrentLocation-list
+ // the MapsOfCurrentLocation-list
for (int currentMapIndex = 0; currentMapIndex < osm_maps.length; currentMapIndex++) {
if (osm_maps[currentMapIndex].isInMap(currentLocation)) {
HashMap<String, String> currentPositionMapChild = new HashMap<String, String>();
@@ -134,7 +138,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
// add already downloaded maps (group and empty child list
HashMap<String, String> downloaded_maps_hash = new HashMap<String, String>();
- downloaded_maps_hash.put("category_name", Navit.T("Downloaded maps"));
+ downloaded_maps_hash.put("category_name", Navit.getInstance().T(getString(R.string.maps_installed)));
resultGroups.add(downloaded_maps_hash);
downloaded_maps_childs = new ArrayList<HashMap<String, String>>();
resultChilds.add(downloaded_maps_childs);
@@ -143,14 +147,14 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
maps_current_position_childs = new ArrayList<HashMap<String, String>>();
// maps containing the current location
HashMap<String, String> matching_maps = new HashMap<String, String>();
- matching_maps.put("category_name", Navit.NavitResources.getString(R.string.maps_for_current_location));
+ matching_maps.put("category_name", Navit.getInstance().T(getString(R.string.maps_for_current_location)));
resultGroups.add(matching_maps);
resultChilds.add(maps_current_position_childs);
// add all maps
for (int currentMapIndex = 0; currentMapIndex < osm_maps.length; currentMapIndex++) {
if (osm_maps[currentMapIndex].level == 0) {
- if (secList != null && secList.size() > 0) {
+ if (secList.size() > 0) {
resultChilds.add(secList);
}
secList = new ArrayList<HashMap<String, String>>();
@@ -178,7 +182,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
super.onChildClick(parent, v, groupPosition, childPosition, id);
- Log.d("Navit", "p:" + groupPosition + ", child_pos:" + childPosition);
+ Log.d(TAG, "p:" + groupPosition + ", child_pos:" + childPosition);
@SuppressWarnings("unchecked")
HashMap<String, String> child = (HashMap<String, String>) adapter.getChild(groupPosition, childPosition);
@@ -188,7 +192,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
int mi=Integer.parseInt(map_index);
if(NavitMapDownloader.osm_maps[mi].est_size_bytes/1024/1024/950>=4) {
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- Navit.T("Sorry, we currently do not support maps above 3.8G on Android, please select a smaller one."),
+ Navit.getInstance().T("Sorry, we currently do not support maps above 3.8G on Android, please select a smaller one."),
-1, 0, 0);
return true;
}
@@ -210,12 +214,11 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
NavitMap maptoDelete = new NavitMap(map_location);
deleteMapBox.setMessage(maptoDelete.mapName + " " + String.valueOf(maptoDelete.size() / 1024 / 1024) + "MB");
-
// TRANS
- deleteMapBox.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
+ deleteMapBox.setPositiveButton(Navit.getInstance().T(getString(R.string.yes)), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "Delete Map");
+ Log.d(TAG, "Delete Map");
Message msg =
Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
@@ -228,9 +231,9 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
});
// TRANS
- deleteMapBox.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
+ deleteMapBox.setNegativeButton(Navit.getInstance().T(getString(R.string.no)), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "don't delete map");
+ Log.d(TAG, "don't delete map");
}
});
deleteMapBox.show();
diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java
index d40dee3a5..95a875f7a 100644
--- a/navit/android/src/org/navitproject/navit/NavitGraphics.java
+++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
@@ -52,32 +53,31 @@ import android.widget.RelativeLayout;
public class NavitGraphics
{
- private NavitGraphics parent_graphics;
- private ArrayList<NavitGraphics> overlays = new ArrayList<NavitGraphics>();
- private int bitmap_w;
- private int bitmap_h;
- private int pos_x;
- private int pos_y;
- private int pos_wraparound;
- private int overlay_disabled;
- private int bgcolor;
- private float trackball_x, trackball_y;
- private View view;
- private SystemBarTintView navigationTintView;
- private SystemBarTintView statusTintView;
- private FrameLayout frameLayout;
- private RelativeLayout relativelayout;
- private NavitCamera camera;
- private Navit activity;
-
- private static Boolean in_map = false;
-
+ private static final String TAG = "NavitGraphics";
+ private final NavitGraphics parent_graphics;
+ private final ArrayList<NavitGraphics> overlays = new ArrayList<NavitGraphics>();
+ private int bitmap_w;
+ private int bitmap_h;
+ private int pos_x;
+ private int pos_y;
+ private int pos_wraparound;
+ private int overlay_disabled;
+ private int bgcolor;
+ private float trackball_x, trackball_y;
+ private View view;
+ private SystemBarTintView navigationTintView;
+ private SystemBarTintView statusTintView;
+ private FrameLayout frameLayout;
+ private RelativeLayout relativelayout;
+ private NavitCamera camera;
+ private Navit activity;
+ private static Boolean in_map = false;
// for menu key
- private static long time_for_long_press = 300L;
+ private static final long time_for_long_press = 300L;
private Handler timer_handler = new Handler();
-
+
public void setBackgroundColor(int bgcolor) {
this.bgcolor = bgcolor;
if (navigationTintView != null)
@@ -133,9 +133,9 @@ public class NavitGraphics
Method eventGetX = null;
Method eventGetY = null;
-
- public PointF mPressedPosition = null;
-
+
+ PointF mPressedPosition = null;
+
public NavitView(Context context) {
super(context);
try
@@ -145,17 +145,17 @@ public class NavitGraphics
}
catch (Exception e)
{
- Log.e("NavitGraphics", "Multitouch zoom not supported");
+ Log.e(TAG, "Multitouch zoom not supported");
}
}
@Override
protected void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);
-
- menu.setHeaderTitle(Navit.T("Position")+"..");
- menu.add(1, 1, NONE, Navit.T("Route to here")).setOnMenuItemClickListener(this);
- menu.add(1, 2, NONE, Navit.T("Cancel")).setOnMenuItemClickListener(this);
+
+ menu.setHeaderTitle(activity.T("Position")+"..");
+ menu.add(1, 1, NONE, activity.T("Route to here")).setOnMenuItemClickListener(this);
+ menu.add(1, 2, NONE, activity.T("Cancel")).setOnMenuItemClickListener(this);
}
@Override
@@ -195,8 +195,6 @@ public class NavitGraphics
{
if (Navit.mgr != null)
{
- //Log.e("NavitGraphics", "view -> SHOW SoftInput");
- //Log.e("NavitGraphics", "view mgr=" + String.valueOf(Navit.mgr));
Navit.mgr.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
Navit.show_soft_keyboard_now_showing = true;
// clear the variable now, keyboard will stay on screen until backbutton pressed
@@ -209,18 +207,18 @@ public class NavitGraphics
@Override
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 density=" + Navit.metrics.density);
- Log.e("Navit", "NavitGraphics -> onSizeChanged scaledDensity="
+ Log.d(TAG, "onSizeChanged pixels x=" + w + " pixels y=" + h);
+ Log.d(TAG, "onSizeChanged density=" + Navit.metrics.density);
+ Log.d(TAG, "onSizeChanged scaledDensity="
+ Navit.metrics.scaledDensity);
super.onSizeChanged(w, h, oldw, oldh);
handleResize(w, h);
}
- public void do_longpress_action()
+ void do_longpress_action()
{
- Log.e("NavitGraphics", "do_longpress_action enter");
+ Log.d(TAG, "do_longpress_action enter");
activity.openContextMenu(this);
}
@@ -243,14 +241,13 @@ public class NavitGraphics
catch (NoSuchFieldException ex) {
ex.printStackTrace();
}
-
return ret_value;
}
+ @SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event)
{
- //Log.e("NavitGraphics", "onTouchEvent");
super.onTouchEvent(event);
int x = (int) event.getX();
int y = (int) event.getY();
@@ -274,91 +271,74 @@ public class NavitGraphics
}
else if ((switch_value == MotionEvent.ACTION_UP) || (switch_value == _ACTION_POINTER_UP_))
{
- Log.e("NavitGraphics", "ACTION_UP");
+ Log.d(TAG, "ACTION_UP");
- if ( touch_mode == DRAG )
- {
- Log.e("NavitGraphics", "onTouch move");
+ switch (touch_mode) {
+ case DRAG:
+ Log.d(TAG, "onTouch move");
- MotionCallback(MotionCallbackID, x, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
- }
- else if (touch_mode == ZOOM)
- {
- //Log.e("NavitGraphics", "onTouch zoom");
+ MotionCallback(MotionCallbackID, x, y);
+ ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = 0;
- if (newDist > 10f)
- {
- scale = newDist / oldDist;
- }
+ break;
+ case ZOOM:
+ float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
+ float scale = 0;
+ if (newDist > 10f) {
+ scale = newDist / oldDist;
+ }
- if (scale > 1.3)
- {
- // zoom in
- CallbackMessageChannel(1, null);
- //Log.e("NavitGraphics", "onTouch zoom in");
- }
- else if (scale < 0.8)
- {
- // zoom out
- CallbackMessageChannel(2, null);
- //Log.e("NavitGraphics", "onTouch zoom out");
- }
- }
- else if (touch_mode == PRESSED)
- {
- if (in_map) ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
+ if (scale > 1.3) {
+ // zoom in
+ CallbackMessageChannel(1, null);
+ } else if (scale < 0.8) {
+ // zoom out
+ CallbackMessageChannel(2, null);
+ }
+ break;
+ case PRESSED:
+ if (in_map) ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
+
+ break;
}
touch_mode = NONE;
}
else if (switch_value == MotionEvent.ACTION_MOVE)
{
- //Log.e("NavitGraphics", "ACTION_MOVE");
-
- if (touch_mode == DRAG)
- {
- MotionCallback(MotionCallbackID, x, y);
- }
- else if (touch_mode == ZOOM)
- {
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = newDist / oldDist;
- Log.e("NavitGraphics", "New scale = " + scale);
- if (scale > 1.2)
- {
- // zoom in
- CallbackMessageChannel(1, "");
- oldDist = newDist;
- //Log.e("NavitGraphics", "onTouch zoom in");
- }
- else if (scale < 0.8)
- {
- oldDist = newDist;
- // zoom out
- CallbackMessageChannel(2, "");
- //Log.e("NavitGraphics", "onTouch zoom out");
- }
- }
- else if (touch_mode == PRESSED)
- {
- Log.e("NavitGraphics", "Start drag mode");
- if ( spacing(mPressedPosition, new PointF(event.getX(), event.getY())) > 20f) {
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- touch_mode = DRAG;
- }
+ switch (touch_mode) {
+ case DRAG:
+ MotionCallback(MotionCallbackID, x, y);
+ break;
+ case ZOOM:
+ float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
+ float scale = newDist / oldDist;
+ Log.d(TAG, "New scale = " + scale);
+ if (scale > 1.2) {
+ // zoom in
+ CallbackMessageChannel(1, "");
+ oldDist = newDist;
+ } else if (scale < 0.8) {
+ oldDist = newDist;
+ // zoom out
+ CallbackMessageChannel(2, "");
+ }
+ break;
+ case PRESSED:
+ Log.d(TAG, "Start drag mode");
+ if (spacing(mPressedPosition, new PointF(event.getX(), event.getY())) > 20f) {
+ ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ touch_mode = DRAG;
+ }
+ break;
}
}
else if (switch_value == _ACTION_POINTER_DOWN_)
{
- //Log.e("NavitGraphics", "ACTION_POINTER_DOWN");
oldDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
if (oldDist > 2f)
{
touch_mode = ZOOM;
- //Log.e("NavitGraphics", "--> zoom");
}
}
return true;
@@ -381,7 +361,7 @@ public class NavitGraphics
{
Float x = (java.lang.Float) eventGetX.invoke(instance, argument);
Float y = (java.lang.Float) eventGetY.invoke(instance, argument);
- pos.set(x.floatValue(), y.floatValue());
+ pos.set(x, y);
}
catch (Exception e){
@@ -390,131 +370,99 @@ public class NavitGraphics
}
return pos;
}
-
+
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
int i;
String s = null;
- boolean handled = true;
long interval_for_long_press = 200L;
i = event.getUnicodeChar();
- //Log.e("NavitGraphics", "onKeyDown " + keyCode + " " + i);
- // Log.e("NavitGraphics","Unicode "+event.getUnicodeChar());
if (i == 0)
{
- if (keyCode == android.view.KeyEvent.KEYCODE_DEL)
- {
- s = java.lang.String.valueOf((char) 8);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_MENU)
- {
- if (!in_map)
- {
- // if last menukeypress is less than 0.2 seconds away then count longpress
- if ((System.currentTimeMillis() - Navit.last_pressed_menu_key) < interval_for_long_press)
- {
- Navit.time_pressed_menu_key = Navit.time_pressed_menu_key
- + (System.currentTimeMillis() - Navit.last_pressed_menu_key);
- //Log.e("NavitGraphics", "press time=" + Navit.time_pressed_menu_key);
-
- // on long press let softkeyboard popup
- if (Navit.time_pressed_menu_key > time_for_long_press)
- {
- //Log.e("NavitGraphics", "long press menu key!!");
- Navit.show_soft_keyboard = true;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_DEL:
+ s = String.valueOf((char) 8);
+ break;
+ case KeyEvent.KEYCODE_MENU:
+ if (!in_map) {
+ // if last menukeypress is less than 0.2 seconds away then count longpress
+ if ((System.currentTimeMillis() - Navit.last_pressed_menu_key) < interval_for_long_press) {
+ Navit.time_pressed_menu_key = Navit.time_pressed_menu_key
+ + (System.currentTimeMillis() - Navit.last_pressed_menu_key);
+ // on long press let softkeyboard popup
+ if (Navit.time_pressed_menu_key > time_for_long_press) {
+ Navit.show_soft_keyboard = true;
+ Navit.time_pressed_menu_key = 0L;
+ // need to draw to get the keyboard showing
+ this.postInvalidate();
+ }
+ } else {
Navit.time_pressed_menu_key = 0L;
- // need to draw to get the keyboard showing
- this.postInvalidate();
}
+ Navit.last_pressed_menu_key = System.currentTimeMillis();
+ // if in menu view:
+ // use as OK (Enter) key
+ // dont use menu key here (use it in onKeyUp)
+ return true;
+ } else {
+ // if on map view:
+ // volume UP
+ //s = java.lang.String.valueOf((char) 1);
+ return true;
}
- else
- {
- Navit.time_pressed_menu_key = 0L;
+ case KeyEvent.KEYCODE_SEARCH:
+ /* Handle event in Main Activity if map is shown */
+ if (in_map)
+ return false;
+
+ s = String.valueOf((char) 19);
+ break;
+ case KeyEvent.KEYCODE_BACK:
+ s = String.valueOf((char) 27);
+ break;
+ case KeyEvent.KEYCODE_CALL:
+ s = String.valueOf((char) 3);
+ break;
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ if (!in_map) {
+ // if in menu view:
+ // use as UP key
+ s = String.valueOf((char) 16);
+ } else {
+ // if on map view:
+ // volume UP
+ //s = java.lang.String.valueOf((char) 21);
+ return false;
}
- Navit.last_pressed_menu_key = System.currentTimeMillis();
- // if in menu view:
- // use as OK (Enter) key
- s = java.lang.String.valueOf((char) 13);
- // dont use menu key here (use it in onKeyUp)
- return true;
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
- return true;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_SEARCH)
- {
- /* Handle event in Main Activity if map is shown */
- if(in_map)
- return false;
-
- s = java.lang.String.valueOf((char) 19);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_BACK)
- {
- //Log.e("NavitGraphics", "KEYCODE_BACK down");
- s = java.lang.String.valueOf((char) 27);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_CALL)
- {
- s = java.lang.String.valueOf((char) 3);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_UP)
- {
- if (!in_map)
- {
- // if in menu view:
- // use as UP key
- s = java.lang.String.valueOf((char) 16);
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 21);
- return false;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_DOWN)
- {
- if (!in_map)
- {
- // if in menu view:
- // use as DOWN key
- s = java.lang.String.valueOf((char) 14);
- }
- else
- {
- // if on map view:
- // volume DOWN
- //s = java.lang.String.valueOf((char) 4);
- return false;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_CENTER)
- {
- s = java.lang.String.valueOf((char) 13);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_DOWN)
- {
- s = java.lang.String.valueOf((char) 14);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_LEFT)
- {
- s = java.lang.String.valueOf((char) 2);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_RIGHT)
- {
- s = java.lang.String.valueOf((char) 6);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_UP)
- {
- s = java.lang.String.valueOf((char) 16);
+ break;
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ if (!in_map) {
+ // if in menu view:
+ // use as DOWN key
+ s = String.valueOf((char) 14);
+ } else {
+ // if on map view:
+ // volume DOWN
+ //s = java.lang.String.valueOf((char) 4);
+ return false;
+ }
+ break;
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ s = String.valueOf((char) 13);
+ break;
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ s = String.valueOf((char) 14);
+ break;
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ s = String.valueOf((char) 2);
+ break;
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ s = String.valueOf((char) 6);
+ break;
+ case KeyEvent.KEYCODE_DPAD_UP:
+ s = String.valueOf((char) 16);
+ break;
}
}
else if (i == 10)
@@ -532,60 +480,44 @@ public class NavitGraphics
@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
- //Log.e("NavitGraphics", "onKeyUp " + keyCode);
-
int i;
String s = null;
- boolean handled = true;
i = event.getUnicodeChar();
if (i == 0)
{
- if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_UP)
- {
- return (!in_map);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_DOWN)
- {
- return (!in_map);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_SEARCH) {
- /* Handle event in Main Activity if map is shown */
- if(in_map)
- return false;
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_BACK)
- {
- if (Navit.show_soft_keyboard_now_showing)
- {
- Navit.show_soft_keyboard_now_showing = false;
- }
- //Log.e("NavitGraphics", "KEYCODE_BACK up");
- //s = java.lang.String.valueOf((char) 27);
- return true;
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_MENU)
- {
- if (!in_map)
- {
- if (Navit.show_soft_keyboard_now_showing)
- {
- // if soft keyboard showing on screen, dont use menu button as select key
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ return (!in_map);
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ return (!in_map);
+ case KeyEvent.KEYCODE_SEARCH:
+ /* Handle event in Main Activity if map is shown */
+ if (in_map)
+ return false;
+ break;
+ case KeyEvent.KEYCODE_BACK:
+ if (Navit.show_soft_keyboard_now_showing) {
+ Navit.show_soft_keyboard_now_showing = false;
}
- else
- {
- // if in menu view:
- // use as OK (Enter) key
- s = java.lang.String.valueOf((char) 13);
+ //s = java.lang.String.valueOf((char) 27);
+ return true;
+ case KeyEvent.KEYCODE_MENU:
+ if (!in_map) {
+ if (Navit.show_soft_keyboard_now_showing) {
+ // if soft keyboard showing on screen, dont use menu button as select key
+ } else {
+ // if in menu view:
+ // use as OK (Enter) key
+ s = String.valueOf((char) 13);
+ }
+ } else {
+ // if on map view:
+ // volume UP
+ //s = java.lang.String.valueOf((char) 1);
+ return false;
}
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
- return false;
- }
+ break;
}
}
else if(i!=10)
@@ -604,7 +536,7 @@ public class NavitGraphics
@Override
public boolean onKeyMultiple (int keyCode, int count, KeyEvent event)
{
- String s = null;
+ String s;
if(keyCode == KeyEvent.KEYCODE_UNKNOWN) {
s=event.getCharacters();
KeypressCallback(KeypressCallbackID, s);
@@ -616,8 +548,6 @@ public class NavitGraphics
@Override
public boolean onTrackballEvent(MotionEvent event)
{
- //Log.e("NavitGraphics", "onTrackball " + event.getAction() + " " + event.getX() + " "
- // + event.getY());
String s = null;
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
@@ -627,7 +557,6 @@ public class NavitGraphics
{
trackball_x += event.getX();
trackball_y += event.getY();
- //Log.e("NavitGraphics", "trackball " + trackball_x + " " + trackball_y);
if (trackball_x <= -1)
{
s = java.lang.String.valueOf((char) 2);
@@ -655,13 +584,6 @@ public class NavitGraphics
}
return true;
}
- @Override
- protected void onFocusChanged(boolean gainFocus, int direction,
- Rect previouslyFocusedRect)
- {
- super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
- //Log.e("NavitGraphics", "FocusChange " + gainFocus);
- }
public void run() {
if (in_map && touch_mode == PRESSED)
@@ -672,7 +594,7 @@ public class NavitGraphics
}
}
-
+
private class SystemBarTintView extends View {
public SystemBarTintView(Context context) {
@@ -681,7 +603,7 @@ public class NavitGraphics
}
}
-
+
public NavitGraphics(final Activity activity, NavitGraphics parent, int x, int y, int w, int h,
int wraparound, int use_camera)
{
@@ -733,14 +655,14 @@ public class NavitGraphics
parent_graphics = parent;
}
- static public enum msg_type {
+ public enum msg_type {
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
- };
+ }
- static private msg_type[] msg_values = msg_type.values();
+ static private final msg_type[] msg_values = msg_type.values();
- public Handler callback_handler = new Handler()
+ public final Handler callback_handler = new Handler()
{
public void handleMessage(Message msg)
{
@@ -803,8 +725,7 @@ public class NavitGraphics
private Canvas draw_canvas;
private Bitmap draw_bitmap;
private int SizeChangedCallbackID, PaddingChangedCallbackID, ButtonCallbackID, MotionCallbackID, KeypressCallbackID;
- // private int count;
-
+
/**
* @brief Adjust views used to tint navigation and status bars.
*
@@ -821,11 +742,11 @@ public class NavitGraphics
return;
if (activity == null) {
- Log.w("NavitGraphics", "Main Activity is not a Navit instance, cannot update padding");
+ Log.w(TAG, "Main Activity is not a Navit instance, cannot update padding");
return;
}
- Navit navit = (Navit) activity;
+ Navit navit = activity;
/*
* Determine visibility of status bar.
@@ -839,7 +760,7 @@ public class NavitGraphics
* devices which allow switching between hw and sw buttons (OnePlus One running CyanogenMod).
*/
final Boolean isNavShowing = !ViewConfiguration.get(navit.getApplication()).hasPermanentMenuKey();
- Log.d("NavitGraphics", String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
+ Log.d(TAG, String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
/*
* Determine where the navigation bar would be displayed.
@@ -848,7 +769,7 @@ public class NavitGraphics
*/
final Boolean isLandscape = (navit.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
final Boolean isNavAtBottom = (!isLandscape) || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
- Log.d("NavitGraphics", String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
+ Log.d(TAG, String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
int left = 0;
@@ -869,7 +790,7 @@ public class NavitGraphics
/* Prevent tint views from overlapping when navigation is on the right */
statusLayoutParams.setMargins(0, 0, (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0, 0);
statusTintView.setLayoutParams(statusLayoutParams);
- Log.d("NavitGraphics", String.format("statusTintView: width=%d height=%d",
+ Log.d(TAG, String.format("statusTintView: width=%d height=%d",
statusTintView.getWidth(), statusTintView.getHeight()));
navigationTintView.setVisibility(isNavShowing ? View.VISIBLE : View.GONE);
LayoutParams navigationLayoutParams = new FrameLayout.LayoutParams(
@@ -877,12 +798,12 @@ public class NavitGraphics
isNavAtBottom ? bottom : LayoutParams.MATCH_PARENT, // Y
Gravity.BOTTOM | Gravity.RIGHT);
navigationTintView.setLayoutParams(navigationLayoutParams);
- Log.d("NavitGraphics", String.format("navigationTintView: width=%d height=%d",
+ Log.d(TAG, String.format("navigationTintView: width=%d height=%d",
navigationTintView.getWidth(), navigationTintView.getHeight()));
}
});
- Log.d("NavitGraphics", String.format("Padding left=%d top=%d right=%d bottom=%d", left, top, right, bottom));
+ Log.d(TAG, String.format("Padding left=%d top=%d right=%d bottom=%d", left, top, right, bottom));
PaddingChangedCallback(PaddingChangedCallbackID, left, top, right, bottom);
}
@@ -898,7 +819,7 @@ public class NavitGraphics
if (this.parent_graphics != null)
this.parent_graphics.handleResize(w, h);
else {
- Log.d("NavitGraphics", String.format("handleResize w=%d h=%d", w, h));
+ Log.d(TAG, String.format("handleResize w=%d h=%d", w, h));
adjustSystemBarsTintingViews();
@@ -931,7 +852,7 @@ public class NavitGraphics
else
return ViewConfiguration.get(activity.getApplication()).hasPermanentMenuKey();
}
-
+
public void setSizeChangedCallback(int id)
{
SizeChangedCallbackID = id;
@@ -966,7 +887,6 @@ public class NavitGraphics
{
int i, ndashes;
float [] intervals;
- // Log.e("NavitGraphics","draw_polyline");
paint.setStrokeWidth(c[0]);
paint.setARGB(c[1],c[2],c[3],c[4]);
paint.setStyle(Paint.Style.STROKE);
@@ -996,7 +916,6 @@ public class NavitGraphics
protected void draw_polygon(Paint paint, int c[])
{
- //Log.e("NavitGraphics","draw_polygon");
paint.setStrokeWidth(c[0]);
paint.setARGB(c[1],c[2],c[3],c[4]);
paint.setStyle(Paint.Style.FILL);
@@ -1013,7 +932,6 @@ public class NavitGraphics
}
protected void draw_rectangle(Paint paint, int x, int y, int w, int h)
{
- //Log.e("NavitGraphics","draw_rectangle");
Rect r = new Rect(x, y, x + w, y + h);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
@@ -1022,10 +940,6 @@ public class NavitGraphics
}
protected void draw_circle(Paint paint, int x, int y, int r)
{
- //Log.e("NavitGraphics","draw_circle");
- // float fx = x;
- // float fy = y;
- // float fr = r / 2;
paint.setStyle(Paint.Style.STROKE);
draw_canvas.drawCircle(x, y, r / 2, paint);
}
@@ -1066,9 +980,6 @@ public class NavitGraphics
}
protected void draw_image(Paint paint, int x, int y, Bitmap bitmap)
{
- //Log.e("NavitGraphics","draw_image");
- // float fx = x;
- // float fy = y;
draw_canvas.drawBitmap(bitmap, x, y, null);
}
@@ -1091,14 +1002,14 @@ public class NavitGraphics
*/
protected void draw_image_warp(Paint paint, int count, int p0x, int p0y, int p1x, int p1y, int p2x, int p2y, Bitmap bitmap)
{
-
+
float width;
float scale;
float deltaY;
float deltaX;
float angle;
Matrix matrix;
-
+
if (count == 3)
{
matrix = new Matrix();
@@ -1120,9 +1031,6 @@ public class NavitGraphics
protected void draw_mode(int mode)
{
- //Log.e("NavitGraphics", "draw_mode mode=" + mode + " parent_graphics="
- // + String.valueOf(parent_graphics));
-
if (mode == draw_mode_end) {
if (parent_graphics == null) {
view.invalidate();
@@ -1137,13 +1045,12 @@ public class NavitGraphics
}
protected void draw_drag(int x, int y)
{
- //Log.e("NavitGraphics","draw_drag");
pos_x = x;
pos_y = y;
}
protected void overlay_disable(int disable)
{
- Log.e("NavitGraphics","overlay_disable: " + disable + "Parent: " + (parent_graphics != null));
+ Log.d(TAG,"overlay_disable: " + disable + "Parent: " + (parent_graphics != null));
// assume we are NOT in map view mode!
if (parent_graphics == null)
in_map = (disable==0);
@@ -1157,7 +1064,6 @@ public class NavitGraphics
protected void overlay_resize(int x, int y, int w, int h, int wraparound)
{
- //Log.e("NavitGraphics","overlay_resize");
draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
bitmap_w = w;
bitmap_h = h;
@@ -1167,17 +1073,5 @@ public class NavitGraphics
draw_canvas.setBitmap(draw_bitmap);
}
- public static String getLocalizedString(String text)
- {
- return CallbackLocalizedString(text);
- }
-
-
-
-
- /**
- * get localized string
- */
- public static native String CallbackLocalizedString(String s);
-
+ public static native String CallbackLocalizedString(String s);
}
diff --git a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
index dc520ff30..4004c352a 100644
--- a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
+++ b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
@@ -50,13 +50,13 @@ public class NavitMapDownloader extends Thread
{
public static class osm_map_values
{
- String lon1;
- String lat1;
- String lon2;
- String lat2;
- String map_name = "";
- long est_size_bytes = 0;
- int level = 0;
+ final String lon1;
+ final String lat1;
+ final String lon2;
+ final String lat2;
+ final String map_name;
+ final long est_size_bytes;
+ final int level;
private osm_map_values(String mapname, String lon_1, String lat_1, String lon_2, String lat_2,
@@ -95,212 +95,212 @@ public class NavitMapDownloader extends Thread
// size estimations updated 2017-06-22
//
public static final osm_map_values[] osm_maps = {
- new osm_map_values(Navit.T("Whole Planet"), "-180", "-90", "180", "90", 23992258630L, 0),
- new osm_map_values(Navit.T("Africa"), "-30.89", "-36.17", "61.68", "38.40", 2070076339L, 0),
- new osm_map_values(Navit.T("Angola"), "11.4", "-18.1", "24.2", "-5.3", 127557789L, 1),
- new osm_map_values(Navit.T("Burundi"), "28.9", "-4.5", "30.9", "-2.2", 124049667L, 1),
- new osm_map_values(Navit.T("Canary Islands"), "-18.69", "26.52", "-12.79", "29.99", 133565815L, 1),
- new osm_map_values(Navit.T("Congo, Democratic Republic of the"), "11.7", "-13.6", "31.5", "5.7", 244228485L, 1),
- new osm_map_values(Navit.T("Ethiopia"), "32.89", "3.33", "48.07", "14.97", 153067406L, 1),
- new osm_map_values(Navit.T("Guinea"), "-15.47", "7.12", "-7.58", "12.74", 188047126L, 1),
- new osm_map_values(Navit.T("Cote d'Ivoire"), "-8.72", "4.09", "-2.43", "10.80", 132187496L, 1),
- new osm_map_values(Navit.T("Kenya"), "33.8", "-5.2", "42.4", "4.9", 190073089L, 1),
- new osm_map_values(Navit.T("Lesotho"), "26.9", "-30.7", "29.6", "-28.4", 196189429L, 1),
- new osm_map_values(Navit.T("Liberia"), "-15.00", "-0.73", "-7.20", "8.65", 156257253L, 1),
- new osm_map_values(Navit.T("Libya"), "9.32", "19.40", "25.54", "33.63", 126046917L, 1),
- new osm_map_values(Navit.T("Madagascar"), "42.25", "-26.63", "51.20", "-11.31", 145210721L, 1),
- new osm_map_values(Navit.T("Namibia")+"+"+Navit.T("Botswana"), "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
- new osm_map_values(Navit.T("Reunion"), "55.2", "-21.4", "55.9", "-20.9", 126008774L, 1),
- new osm_map_values(Navit.T("Rwanda"), "28.8", "-2.9", "30.9", "-1.0", 128267595L, 1),
- new osm_map_values(Navit.T("South Africa")+"+"+Navit.T("Lesotho"), "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
- new osm_map_values(Navit.T("Tanzania, United Republic of"), "29.19", "-11.87", "40.74", "-0.88", 253621029L, 1),
- new osm_map_values(Navit.T("Uganda"), "29.3", "-1.6", "35.1", "4.3", 179134521L, 1),
- new osm_map_values(Navit.T("Asia"), "23.8", "0.1", "195.0", "82.4", 5113673780L, 0),
- new osm_map_values(Navit.T("Azerbaijan"), "44.74", "38.34", "51.69", "42.37", 138346406L, 1),
- new osm_map_values(Navit.T("China"), "67.3", "5.3", "135.0", "54.5", 1718108758L, 1),
- new osm_map_values(Navit.T("Cyprus"), "32.0", "34.5", "34.9", "35.8", 118472448L, 1),
- new osm_map_values(Navit.T("India")+"+"+Navit.T("Nepal"), "67.9", "5.5", "89.6", "36.0", 601877877L, 1),
- new osm_map_values(Navit.T("Indonesia"), "93.7", "-17.3", "155.5", "7.6", 420741405L, 1),
- new osm_map_values(Navit.T("Iran, Islamic Republic of"), "43.5", "24.4", "63.6", "40.4", 242016066L, 1),
- new osm_map_values(Navit.T("Iraq"), "38.7", "28.5", "49.2", "37.4", 160751805L, 1),
- new osm_map_values(Navit.T("Israel"), "33.99", "29.8", "35.95", "33.4", 155685778L, 1),
- new osm_map_values(Navit.T("Japan")+"+"+Navit.T("Korea"), "123.6", "25.2", "151.3", "47.1", 1029080156L, 1),
- new osm_map_values(Navit.T("Kazakhstan"), "46.44", "40.89", "87.36", "55.45", 407633007L, 1),
- new osm_map_values(Navit.T("Kyrgyzstan"), "69.23", "39.13", "80.33", "43.29", 147997835L, 1),
- new osm_map_values(Navit.T("Malaysia")+"+"+Navit.T("Singapore"), "94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
- new osm_map_values(Navit.T("Mongolia"), "87.5", "41.4", "120.3", "52.7", 153534851L, 1),
- new osm_map_values(Navit.T("Pakistan"), "60.83", "23.28", "77.89", "37.15", 217644321L, 1),
- new osm_map_values(Navit.T("Philippines"), "115.58", "4.47", "127.85", "21.60", 281428307L, 1),
- new osm_map_values(Navit.T("Saudi Arabia"), "33.2", "16.1", "55.9", "33.5", 242648303L, 1),
- new osm_map_values(Navit.T("Taiwan"), "119.1", "21.5", "122.5", "25.2", 1029080156L, 1),
- new osm_map_values(Navit.T("Thailand"), "97.5", "5.7", "105.2", "19.7", 185135492L, 1),
- new osm_map_values(Navit.T("Turkey"), "25.1", "35.8", "46.4", "42.8", 331087441L, 1),
- new osm_map_values(Navit.T("Turkmenistan"), "51.78", "35.07", "66.76", "42.91", 131045087L, 1),
- new osm_map_values(Navit.T("UAE+Other"), "51.5", "22.6", "56.7", "26.5", 128934674L, 1),
- new osm_map_values(Navit.T("Australia")+"+"+Navit.T("Oceania"), "89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
- new osm_map_values(Navit.T("Australia"), "110.5", "-44.2", "154.9", "-9.2", 348652900L, 0),
- new osm_map_values(Navit.T("Tasmania"), "144.0", "-45.1", "155.3", "-24.8", 253231890L, 1),
- new osm_map_values(Navit.T("Victoria")+"+"+Navit.T("New South Wales"), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
- new osm_map_values(Navit.T("New Caledonia"), "157.85", "-25.05", "174.15", "-16.85", 115512336L, 1),
- new osm_map_values(Navit.T("New Zealand"), "165.2", "-47.6", "179.1", "-33.7", 239264192L, 1),
- new osm_map_values(Navit.T("Europe"), "-12.97", "33.59", "34.15", "72.10", 11984126789L, 0),
- new osm_map_values(Navit.T("Western Europe"), "-17.6", "34.5", "42.9", "70.9", 12648810717L, 1),
- new osm_map_values(Navit.T("Austria"), "9.4", "46.32", "17.21", "49.1", 898273634L, 1),
- new osm_map_values(Navit.T("Azores"), "-31.62", "36.63", "-24.67", "40.13", 112687225L, 1),
- new osm_map_values(Navit.T("BeNeLux"), "2.08", "48.87", "7.78", "54.52", 1771971595L, 1),
- new osm_map_values(Navit.T("Netherlands"), "3.07", "50.75", "7.23", "53.73", 1191828033L, 1),
- new osm_map_values(Navit.T("Denmark"), "7.65", "54.32", "15.58", "58.07", 365606979L, 1),
- new osm_map_values(Navit.T("Faroe Islands"), "-7.8", "61.3", "-6.1", "62.5", 109377568L, 1),
- new osm_map_values(Navit.T("France"), "-5.45", "42.00", "8.44", "51.68", 3907969744L, 1),
- new osm_map_values(Navit.T("Alsace"), "6.79", "47.27", "8.48", "49.17", 354249349L, 2),
- new osm_map_values(Navit.T("Aquitaine"), "-2.27", "42.44", "1.50", "45.76", 443715019L, 2),
- new osm_map_values(Navit.T("Auvergne"), "2.01", "44.57", "4.54", "46.85", 287663213L, 2),
- new osm_map_values(Navit.T("Basse-Normandie"), "-2.09", "48.13", "1.03", "49.98", 262352354L, 2),
- new osm_map_values(Navit.T("Bourgogne"), "2.80", "46.11", "5.58", "48.45", 298868796L, 2),
- new osm_map_values(Navit.T("Bretagne"), "-5.58", "46.95", "-0.96", "48.99", 382770794L, 2),
- new osm_map_values(Navit.T("Centre"), "0.01", "46.29", "3.18", "48.99", 474224721L, 2),
- new osm_map_values(Navit.T("Champagne-Ardenne"), "3.34", "47.53", "5.94", "50.28", 269947824L, 2),
- new osm_map_values(Navit.T("Corse"), "8.12", "41.32", "9.95", "43.28", 129902146L, 2),
- new osm_map_values(Navit.T("Franche-Comte"), "5.20", "46.21", "7.83", "48.07", 324476070L, 2),
- new osm_map_values(Navit.T("Haute-Normandie"), "-0.15", "48.62", "1.85", "50.18", 202782876L, 2),
- new osm_map_values(Navit.T("Ile-de-France"), "1.40", "48.07", "3.61", "49.29", 311052699L, 2),
- new osm_map_values(Navit.T("Languedoc-Roussillon"), "1.53", "42.25", "4.89", "45.02", 380145667L, 2),
- new osm_map_values(Navit.T("Limousin"), "0.58", "44.87", "2.66", "46.50", 206696539L, 2),
- new osm_map_values(Navit.T("Lorraine"), "4.84", "47.77", "7.72", "49.73", 330777318L, 2),
- new osm_map_values(Navit.T("Midi-Pyrenees"), "-0.37", "42.18", "3.50", "45.10", 462618363L, 2),
- new osm_map_values(Navit.T("Nord-pas-de-Calais"), "1.42", "49.92", "4.49", "51.31", 368467511L, 2),
- new osm_map_values(Navit.T("Pays-de-la-Loire"), "-2.88", "46.20", "0.97", "48.62", 499471143L, 2),
- new osm_map_values(Navit.T("Picardie"), "1.25", "48.79", "4.31", "50.43", 374308041L, 2),
- new osm_map_values(Navit.T("Poitou-Charentes"), "-1.69", "45.04", "1.26", "47.23", 342125526L, 2),
- new osm_map_values(Navit.T("Provence-Alpes-Cote-d-Azur"), "4.21", "42.91", "7.99", "45.18", 390306134L, 2),
- new osm_map_values(Navit.T("Rhone-Alpes"), "3.65", "44.07", "7.88", "46.64", 510797942L, 2),
- new osm_map_values(Navit.T("Germany"), "5.18", "46.84", "15.47", "55.64", 3521359466L, 1),
- new osm_map_values(Navit.T("Baden-Wuerttemberg"), "7.32", "47.14", "10.57", "49.85", 674361124L, 2),
- new osm_map_values(Navit.T("Bayern"), "8.92", "47.22", "13.90", "50.62", 860161150L, 2),
- new osm_map_values(Navit.T("Mittelfranken"), "9.86", "48.78", "11.65", "49.84", 203055195L, 2),
- new osm_map_values(Navit.T("Niederbayern"), "11.55", "47.75", "14.12", "49.42", 312924770L, 2),
- new osm_map_values(Navit.T("Oberbayern"), "10.67", "47.05", "13.57", "49.14", 382734883L, 2),
- new osm_map_values(Navit.T("Oberfranken"), "10.31", "49.54", "12.49", "50.95", 235258691L, 2),
- new osm_map_values(Navit.T("Oberpfalz"), "11.14", "48.71", "13.47", "50.43", 264536012L, 2),
- new osm_map_values(Navit.T("Schwaben"), "9.27", "47.10", "11.36", "49.09", 321141607L, 2),
- new osm_map_values(Navit.T("Unterfranken"), "8.59", "49.16", "10.93", "50.67", 303720890L, 2),
- new osm_map_values(Navit.T("Berlin"), "13.03", "52.28", "13.81", "52.73", 169019946L, 2),
- new osm_map_values(Navit.T("Brandenburg"), "11.17", "51.30", "14.83", "53.63", 323497599L, 2),
- new osm_map_values(Navit.T("Bremen"), "8.43", "52.96", "9.04", "53.66", 150963608L, 2),
- new osm_map_values(Navit.T("Hamburg"), "9.56", "53.34", "10.39", "53.80", 156284421L, 2),
- new osm_map_values(Navit.T("Hessen"), "7.72", "49.34", "10.29", "51.71", 432279328L, 2),
- new osm_map_values(Navit.T("Mecklenburg-Vorpommern"), "10.54", "53.05", "14.48", "55.05", 213183908L, 2),
- new osm_map_values(Navit.T("Niedersachsen"), "6.40", "51.24", "11.69", "54.22", 819766939L, 2),
- new osm_map_values(Navit.T("Nordrhein-westfalen"), "5.46", "50.26", "9.52", "52.59", 967053517L, 2),
- new osm_map_values(Navit.T("Rheinland-Pfalz"), "6.06", "48.91", "8.56", "51.00", 442868899L, 2),
- new osm_map_values(Navit.T("Saarland"), "6.30", "49.06", "7.46", "49.69", 157721162L, 2),
- new osm_map_values(Navit.T("Sachsen-Anhalt"), "10.50", "50.88", "13.26", "53.11", 287785088L, 2),
- new osm_map_values(Navit.T("Sachsen"), "11.82", "50.11", "15.10", "51.73", 342620834L, 2),
- new osm_map_values(Navit.T("Schleswig-Holstein"), "7.41", "53.30", "11.98", "55.20", 280293910L, 2),
- new osm_map_values(Navit.T("Thueringen"), "9.81", "50.15", "12.72", "51.70", 269428239L, 2),
- new osm_map_values(Navit.T("Germany")+"+"+Navit.T("Austria")+"+"+Navit.T("Switzerland"), "3.4", "44.5", "18.6", "55.1", 5746126429L, 1),
- new osm_map_values(Navit.T("Iceland"), "-25.3", "62.8", "-11.4", "67.5", 124837162L, 1),
- new osm_map_values(Navit.T("Ireland"), "-11.17", "51.25", "-5.23", "55.9", 234750271L, 1),
- new osm_map_values(Navit.T("Italy"), "6.52", "36.38", "18.96", "47.19", 1610171395L, 1),
- new osm_map_values(Navit.T("Spain")+"+"+Navit.T("Portugal"), "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
- new osm_map_values(Navit.T("Mallorca"), "2.2", "38.8", "4.7", "40.2", 137200636L, 2),
- new osm_map_values(Navit.T("Galicia"), "-10.0", "41.7", "-6.3", "44.1", 174549553L, 2),
- new osm_map_values(Navit.T("Scandinavia"), "4.0", "54.4", "32.1", "71.5", 1398661090L, 1),
- new osm_map_values(Navit.T("Finland"), "18.6", "59.2", "32.3", "70.3", 460997178L, 1),
- new osm_map_values(Navit.T("Denmark"), "7.49", "54.33", "13.05", "57.88", 321870414L, 1),
- new osm_map_values(Navit.T("Switzerland"), "5.79", "45.74", "10.59", "47.84", 552565332L, 1),
- new osm_map_values(Navit.T("United Kingdom"), "-9.7", "49.6", "2.2", "61.2", 901724648L, 1),
- new osm_map_values(Navit.T("England"), "-7.80", "48.93", "2.41", "56.14", 937728414L, 1),
- new osm_map_values(Navit.T("Buckinghamshire"), "-1.19", "51.44", "-0.43", "52.25", 142256978L, 2),
- new osm_map_values(Navit.T("Cambridgeshire"), "-0.55", "51.96", "0.56", "52.79", 142334001L, 2),
- new osm_map_values(Navit.T("Cumbria"), "-3.96", "53.85", "-2.11", "55.24", 144422460L, 2),
- new osm_map_values(Navit.T("East yorkshire with hull"), "-1.16", "53.50", "0.54", "54.26", 141518744L, 2),
- new osm_map_values(Navit.T("Essex"), "-0.07", "51.40", "1.36", "52.14", 162542730L, 2),
- new osm_map_values(Navit.T("Herefordshire"), "-3.19", "51.78", "-2.29", "52.45", 129368660L, 2),
- new osm_map_values(Navit.T("Kent"), "-0.02", "50.81", "1.65", "51.53", 145482562L, 2),
- new osm_map_values(Navit.T("Lancashire"), "-3.20", "53.43", "-2.00", "54.29", 148964975L, 2),
- new osm_map_values(Navit.T("Leicestershire"), "-1.65", "52.34", "-0.61", "53.03", 154199956L, 2),
- new osm_map_values(Navit.T("Norfolk"), "0.10", "52.30", "2.04", "53.41", 146017009L, 2),
- new osm_map_values(Navit.T("Nottinghamshire"), "-1.39", "52.73", "-0.62", "53.55", 147986548L, 2),
- new osm_map_values(Navit.T("Oxfordshire"), "-1.77", "51.41", "-0.82", "52.22", 142240992L, 2),
- new osm_map_values(Navit.T("Shropshire"), "-3.29", "52.26", "-2.18", "53.05", 136909363L, 2),
- new osm_map_values(Navit.T("Somerset"), "-3.89", "50.77", "-2.20", "51.40", 145186096L, 2),
- new osm_map_values(Navit.T("South yorkshire"), "-1.88", "53.25", "-0.80", "53.71", 145902650L, 2),
- new osm_map_values(Navit.T("Suffolk"), "0.29", "51.88", "1.81", "52.60", 143799697L, 2),
- new osm_map_values(Navit.T("Surrey"), "-0.90", "51.02", "0.10", "51.52", 157987139L, 2),
- new osm_map_values(Navit.T("Wiltshire"), "-2.41", "50.90", "-1.44", "51.76", 138652346L, 2),
- new osm_map_values(Navit.T("Scotland"), "-8.13", "54.49", "-0.15", "61.40", 258853845L, 2),
- new osm_map_values(Navit.T("Wales"), "-5.56", "51.28", "-2.60", "53.60", 193593409L, 2),
- new osm_map_values(Navit.T("Albania"), "19.09", "39.55", "21.12", "42.72", 146199817L, 1),
- new osm_map_values(Navit.T("Belarus"), "23.12", "51.21", "32.87", "56.23", 324470696L, 1),
- new osm_map_values(Navit.T("Russian Federation"), "27.9", "41.5", "190.4", "77.6", 2148314279L, 1),
- new osm_map_values(Navit.T("Bulgaria"), "24.7", "42.1", "24.8", "42.1", 109869373L, 1),
- new osm_map_values(Navit.T("Bosnia and Herzegovina"), "15.69", "42.52", "19.67", "45.32", 187122485L, 1),
- new osm_map_values(Navit.T("Czech Republic"), "11.91", "48.48", "19.02", "51.17", 904838442L, 1),
- new osm_map_values(Navit.T("Croatia"), "13.4", "42.1", "19.4", "46.9", 460854751L, 1),
- new osm_map_values(Navit.T("Estonia"), "21.5", "57.5", "28.2", "59.6", 173378927L, 1),
- new osm_map_values(Navit.T("Greece"), "28.9", "37.8", "29.0", "37.8", 109435051L, 1),
- new osm_map_values(Navit.T("Crete"), "23.3", "34.5", "26.8", "36.0", 115985063L, 1),
- new osm_map_values(Navit.T("Hungary"), "16.08", "45.57", "23.03", "48.39", 350318541L, 1),
- new osm_map_values(Navit.T("Latvia"), "20.7", "55.6", "28.3", "58.1", 188188140L, 1),
- new osm_map_values(Navit.T("Lithuania"), "20.9", "53.8", "26.9", "56.5", 217852597L, 1),
- new osm_map_values(Navit.T("Poland"), "13.6", "48.8", "24.5", "55.0", 1464968657L, 1),
- new osm_map_values(Navit.T("Romania"), "20.3", "43.5", "29.9", "48.4", 347931565L, 1),
- new osm_map_values(Navit.T("Ukraine"), "22.0", "44.3", "40.4", "52.4", 793611912L, 1),
- new osm_map_values(Navit.T("North America"), "-178.1", "6.5", "-10.4", "84.0", 5601866516L, 0),
- new osm_map_values(Navit.T("Alaska"), "-179.5", "49.5", "-129", "71.6", 207746039L, 1),
- new osm_map_values(Navit.T("Canada"), "-141.3", "41.5", "-52.2", "70.2", 2635719651L, 1),
- new osm_map_values(Navit.T("Hawaii"), "-161.07", "18.49", "-154.45", "22.85", 115016656L, 1),
- new osm_map_values(Navit.T("USA")+Navit.T(" (except Alaska and Hawaii)"), "-125.4", "24.3", "-66.5", "49.3", 4060487198L, 1),
- new osm_map_values(Navit.T("Midwest"), "-104.11", "35.92", "-80.46", "49.46", 1145596450L, 2),
- new osm_map_values(Navit.T("Michigan"), "-90.47", "41.64", "-79.00", "49.37", 538247019L, 2),
- new osm_map_values(Navit.T("Ohio"), "-84.87", "38.05", "-79.85", "43.53", 277022336L, 2),
- new osm_map_values(Navit.T("Northeast"), "-80.58", "38.72", "-66.83", "47.53", 1017160709L, 2),
- new osm_map_values(Navit.T("Massachusetts"), "-73.56", "40.78", "-68.67", "42.94", 340055487L, 2),
- new osm_map_values(Navit.T("Vermont"), "-73.49", "42.68", "-71.41", "45.07", 139626067L, 2),
- new osm_map_values(Navit.T("Pacific"), "-180.05", "15.87", "-129.75", "73.04", 207090640L, 2),
- new osm_map_values(Navit.T("South"), "-106.70", "23.98", "-71.46", "40.70", 1747935356L, 2),
- new osm_map_values(Navit.T("Arkansas"), "-94.67", "32.95", "-89.59", "36.60", 155658661L, 2),
- new osm_map_values(Navit.T("District of Columbia"), "-77.17", "38.74", "-76.86", "39.05", 129235755L, 2),
- new osm_map_values(Navit.T("Florida"), "-88.75", "23.63", "-77.67", "31.05", 224022108L, 2),
- new osm_map_values(Navit.T("Louisiana"), "-94.09", "28.09", "-88.62", "33.07", 210120605L, 2),
- new osm_map_values(Navit.T("Maryland"), "-79.54", "37.83", "-74.99", "40.22", 276462622L, 2),
- new osm_map_values(Navit.T("Mississippi"), "-91.71", "29.99", "-88.04", "35.05", 177858031L, 2),
- new osm_map_values(Navit.T("Oklahoma"), "-103.41", "33.56", "-94.38", "37.38", 200061473L, 2),
- new osm_map_values(Navit.T("Texas"), "-106.96", "25.62", "-92.97", "36.58", 430089141L, 2),
- new osm_map_values(Navit.T("Virginia"), "-83.73", "36.49", "-74.25", "39.52", 384187569L, 2),
- new osm_map_values(Navit.T("West Virginia"), "-82.70", "37.15", "-77.66", "40.97", 220552071L, 2),
- new osm_map_values(Navit.T("West"), "-133.11", "31.28", "-101.99", "49.51", 1152909162L, 2),
- new osm_map_values(Navit.T("Arizona"), "-114.88", "30.01", "-108.99", "37.06", 182826833L, 2),
- new osm_map_values(Navit.T("California"), "-125.94", "32.43", "-114.08", "42.07", 586923326L, 2),
- new osm_map_values(Navit.T("Colorado"), "-109.11", "36.52", "-100.41", "41.05", 228623724L, 2),
- new osm_map_values(Navit.T("Idaho"), "-117.30", "41.93", "-110.99", "49.18", 170684507L, 2),
- new osm_map_values(Navit.T("Montana"), "-116.10", "44.31", "-102.64", "49.74", 176229800L, 2),
- new osm_map_values(Navit.T("New Mexico"), "-109.10", "26.98", "-96.07", "37.05", 361793070L, 2),
- new osm_map_values(Navit.T("Nevada"), "-120.2", "35.0", "-113.8", "42.1", 200614482L, 2),
- new osm_map_values(Navit.T("Oregon"), "-124.8", "41.8", "-116.3", "46.3", 211462685L, 2),
- new osm_map_values(Navit.T("Utah"), "-114.11", "36.95", "-108.99", "42.05", 151590197L, 2),
- new osm_map_values(Navit.T("Washington State"), "-125.0", "45.5", "-116.9", "49.0", 222553768L, 2),
- new osm_map_values(Navit.T("South+Middle America"), "-83.5", "-56.3", "-30.8", "13.7", 958895383L, 0),
- new osm_map_values(Navit.T("Argentina"), "-73.9", "-57.3", "-51.6", "-21.0", 376857648L, 1),
- new osm_map_values(Navit.T("Argentina")+"+"+Navit.T("Chile"), "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
- new osm_map_values(Navit.T("Bolivia"), "-70.5", "-23.1", "-57.3", "-9.3", 175937824L, 1),
- new osm_map_values(Navit.T("Brazil"), "-71.4", "-34.7", "-32.8", "5.4", 664872975L, 1),
- new osm_map_values(Navit.T("Chile"), "-81.77", "-58.50", "-65.46", "-17.41", 241657330L, 1),
- new osm_map_values(Navit.T("Cuba"), "-85.3", "19.6", "-74.0", "23.6", 129043575L, 1),
- new osm_map_values(Navit.T("Colombia"), "-79.1", "-4.0", "-66.7", "12.6", 212016580L, 1),
- new osm_map_values(Navit.T("Ecuador"), "-82.6", "-5.4", "-74.4", "2.3", 158857591L, 1),
- new osm_map_values(Navit.T("Guyana")+"+"+Navit.T("Suriname")+"+"+Navit.T("Guyane Francaise"), "-62.0", "1.0", "-51.2", "8.9", 123000072L, 1),
- new osm_map_values(Navit.T("Haiti")+"+"+Navit.T("Dominican Republic"), "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1),
- new osm_map_values(Navit.T("Jamaica"), "-78.6", "17.4", "-75.9", "18.9", 113961998L, 1),
- new osm_map_values(Navit.T("Mexico"), "-117.6", "14.1", "-86.4", "32.8", 551307973L, 1),
- new osm_map_values(Navit.T("Paraguay"), "-63.8", "-28.1", "-53.6", "-18.8", 159498397L, 1),
- new osm_map_values(Navit.T("Peru"), "-82.4", "-18.1", "-67.5", "0.4", 212490557L, 1),
- new osm_map_values(Navit.T("Uruguay"), "-59.2", "-36.5", "-51.7", "-29.7", 157482719L, 1),
- new osm_map_values(Navit.T("Venezuela"), "-73.6", "0.4", "-59.7", "12.8", 167295729L, 1)
+ new osm_map_values(Navit.getInstance().T("Whole Planet"), "-180", "-90", "180", "90", 23992258630L, 0),
+ new osm_map_values(Navit.getInstance().T("Africa"), "-30.89", "-36.17", "61.68", "38.40", 2070076339L, 0),
+ new osm_map_values(Navit.getInstance().T("Angola"), "11.4", "-18.1", "24.2", "-5.3", 127557789L, 1),
+ new osm_map_values(Navit.getInstance().T("Burundi"), "28.9", "-4.5", "30.9", "-2.2", 124049667L, 1),
+ new osm_map_values(Navit.getInstance().T("Canary Islands"), "-18.69", "26.52", "-12.79", "29.99", 133565815L, 1),
+ new osm_map_values(Navit.getInstance().T("Congo, Democratic Republic of the"), "11.7", "-13.6", "31.5", "5.7", 244228485L, 1),
+ new osm_map_values(Navit.getInstance().T("Ethiopia"), "32.89", "3.33", "48.07", "14.97", 153067406L, 1),
+ new osm_map_values(Navit.getInstance().T("Guinea"), "-15.47", "7.12", "-7.58", "12.74", 188047126L, 1),
+ new osm_map_values(Navit.getInstance().T("Cote d'Ivoire"), "-8.72", "4.09", "-2.43", "10.80", 132187496L, 1),
+ new osm_map_values(Navit.getInstance().T("Kenya"), "33.8", "-5.2", "42.4", "4.9", 190073089L, 1),
+ new osm_map_values(Navit.getInstance().T("Lesotho"), "26.9", "-30.7", "29.6", "-28.4", 196189429L, 1),
+ new osm_map_values(Navit.getInstance().T("Liberia"), "-15.00", "-0.73", "-7.20", "8.65", 156257253L, 1),
+ new osm_map_values(Navit.getInstance().T("Libya"), "9.32", "19.40", "25.54", "33.63", 126046917L, 1),
+ new osm_map_values(Navit.getInstance().T("Madagascar"), "42.25", "-26.63", "51.20", "-11.31", 145210721L, 1),
+ new osm_map_values(Navit.getInstance().T("Namibia")+"+"+Navit.getInstance().T("Botswana"), "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
+ new osm_map_values(Navit.getInstance().T("Reunion"), "55.2", "-21.4", "55.9", "-20.9", 126008774L, 1),
+ new osm_map_values(Navit.getInstance().T("Rwanda"), "28.8", "-2.9", "30.9", "-1.0", 128267595L, 1),
+ new osm_map_values(Navit.getInstance().T("South Africa")+"+"+Navit.getInstance().T("Lesotho"), "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
+ new osm_map_values(Navit.getInstance().T("Tanzania, United Republic of"), "29.19", "-11.87", "40.74", "-0.88", 253621029L, 1),
+ new osm_map_values(Navit.getInstance().T("Uganda"), "29.3", "-1.6", "35.1", "4.3", 179134521L, 1),
+ new osm_map_values(Navit.getInstance().T("Asia"), "23.8", "0.1", "195.0", "82.4", 5113673780L, 0),
+ new osm_map_values(Navit.getInstance().T("Azerbaijan"), "44.74", "38.34", "51.69", "42.37", 138346406L, 1),
+ new osm_map_values(Navit.getInstance().T("China"), "67.3", "5.3", "135.0", "54.5", 1718108758L, 1),
+ new osm_map_values(Navit.getInstance().T("Cyprus"), "32.0", "34.5", "34.9", "35.8", 118472448L, 1),
+ new osm_map_values(Navit.getInstance().T("India")+"+"+Navit.getInstance().T("Nepal"), "67.9", "5.5", "89.6", "36.0", 601877877L, 1),
+ new osm_map_values(Navit.getInstance().T("Indonesia"), "93.7", "-17.3", "155.5", "7.6", 420741405L, 1),
+ new osm_map_values(Navit.getInstance().T("Iran, Islamic Republic of"), "43.5", "24.4", "63.6", "40.4", 242016066L, 1),
+ new osm_map_values(Navit.getInstance().T("Iraq"), "38.7", "28.5", "49.2", "37.4", 160751805L, 1),
+ new osm_map_values(Navit.getInstance().T("Israel"), "33.99", "29.8", "35.95", "33.4", 155685778L, 1),
+ new osm_map_values(Navit.getInstance().T("Japan")+"+"+Navit.getInstance().T("Korea"), "123.6", "25.2", "151.3", "47.1", 1029080156L, 1),
+ new osm_map_values(Navit.getInstance().T("Kazakhstan"), "46.44", "40.89", "87.36", "55.45", 407633007L, 1),
+ new osm_map_values(Navit.getInstance().T("Kyrgyzstan"), "69.23", "39.13", "80.33", "43.29", 147997835L, 1),
+ new osm_map_values(Navit.getInstance().T("Malaysia")+"+"+Navit.getInstance().T("Singapore"), "94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
+ new osm_map_values(Navit.getInstance().T("Mongolia"), "87.5", "41.4", "120.3", "52.7", 153534851L, 1),
+ new osm_map_values(Navit.getInstance().T("Pakistan"), "60.83", "23.28", "77.89", "37.15", 217644321L, 1),
+ new osm_map_values(Navit.getInstance().T("Philippines"), "115.58", "4.47", "127.85", "21.60", 281428307L, 1),
+ new osm_map_values(Navit.getInstance().T("Saudi Arabia"), "33.2", "16.1", "55.9", "33.5", 242648303L, 1),
+ new osm_map_values(Navit.getInstance().T("Taiwan"), "119.1", "21.5", "122.5", "25.2", 1029080156L, 1),
+ new osm_map_values(Navit.getInstance().T("Thailand"), "97.5", "5.7", "105.2", "19.7", 185135492L, 1),
+ new osm_map_values(Navit.getInstance().T("Turkey"), "25.1", "35.8", "46.4", "42.8", 331087441L, 1),
+ new osm_map_values(Navit.getInstance().T("Turkmenistan"), "51.78", "35.07", "66.76", "42.91", 131045087L, 1),
+ new osm_map_values(Navit.getInstance().T("UAE+Other"), "51.5", "22.6", "56.7", "26.5", 128934674L, 1),
+ new osm_map_values(Navit.getInstance().T("Australia")+"+"+Navit.getInstance().T("Oceania"), "89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
+ new osm_map_values(Navit.getInstance().T("Australia"), "110.5", "-44.2", "154.9", "-9.2", 348652900L, 0),
+ new osm_map_values(Navit.getInstance().T("Tasmania"), "144.0", "-45.1", "155.3", "-24.8", 253231890L, 1),
+ new osm_map_values(Navit.getInstance().T("Victoria")+"+"+Navit.getInstance().T("New South Wales"), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
+ new osm_map_values(Navit.getInstance().T("New Caledonia"), "157.85", "-25.05", "174.15", "-16.85", 115512336L, 1),
+ new osm_map_values(Navit.getInstance().T("New Zealand"), "165.2", "-47.6", "179.1", "-33.7", 239264192L, 1),
+ new osm_map_values(Navit.getInstance().T("Europe"), "-12.97", "33.59", "34.15", "72.10", 11984126789L, 0),
+ new osm_map_values(Navit.getInstance().T("Western Europe"), "-17.6", "34.5", "42.9", "70.9", 12648810717L, 1),
+ new osm_map_values(Navit.getInstance().T("Austria"), "9.4", "46.32", "17.21", "49.1", 898273634L, 1),
+ new osm_map_values(Navit.getInstance().T("Azores"), "-31.62", "36.63", "-24.67", "40.13", 112687225L, 1),
+ new osm_map_values(Navit.getInstance().T("BeNeLux"), "2.08", "48.87", "7.78", "54.52", 1771971595L, 1),
+ new osm_map_values(Navit.getInstance().T("Netherlands"), "3.07", "50.75", "7.23", "53.73", 1191828033L, 1),
+ new osm_map_values(Navit.getInstance().T("Denmark"), "7.65", "54.32", "15.58", "58.07", 365606979L, 1),
+ new osm_map_values(Navit.getInstance().T("Faroe Islands"), "-7.8", "61.3", "-6.1", "62.5", 109377568L, 1),
+ new osm_map_values(Navit.getInstance().T("France"), "-5.45", "42.00", "8.44", "51.68", 3907969744L, 1),
+ new osm_map_values(Navit.getInstance().T("Alsace"), "6.79", "47.27", "8.48", "49.17", 354249349L, 2),
+ new osm_map_values(Navit.getInstance().T("Aquitaine"), "-2.27", "42.44", "1.50", "45.76", 443715019L, 2),
+ new osm_map_values(Navit.getInstance().T("Auvergne"), "2.01", "44.57", "4.54", "46.85", 287663213L, 2),
+ new osm_map_values(Navit.getInstance().T("Basse-Normandie"), "-2.09", "48.13", "1.03", "49.98", 262352354L, 2),
+ new osm_map_values(Navit.getInstance().T("Bourgogne"), "2.80", "46.11", "5.58", "48.45", 298868796L, 2),
+ new osm_map_values(Navit.getInstance().T("Bretagne"), "-5.58", "46.95", "-0.96", "48.99", 382770794L, 2),
+ new osm_map_values(Navit.getInstance().T("Centre"), "0.01", "46.29", "3.18", "48.99", 474224721L, 2),
+ new osm_map_values(Navit.getInstance().T("Champagne-Ardenne"), "3.34", "47.53", "5.94", "50.28", 269947824L, 2),
+ new osm_map_values(Navit.getInstance().T("Corse"), "8.12", "41.32", "9.95", "43.28", 129902146L, 2),
+ new osm_map_values(Navit.getInstance().T("Franche-Comte"), "5.20", "46.21", "7.83", "48.07", 324476070L, 2),
+ new osm_map_values(Navit.getInstance().T("Haute-Normandie"), "-0.15", "48.62", "1.85", "50.18", 202782876L, 2),
+ new osm_map_values(Navit.getInstance().T("Ile-de-France"), "1.40", "48.07", "3.61", "49.29", 311052699L, 2),
+ new osm_map_values(Navit.getInstance().T("Languedoc-Roussillon"), "1.53", "42.25", "4.89", "45.02", 380145667L, 2),
+ new osm_map_values(Navit.getInstance().T("Limousin"), "0.58", "44.87", "2.66", "46.50", 206696539L, 2),
+ new osm_map_values(Navit.getInstance().T("Lorraine"), "4.84", "47.77", "7.72", "49.73", 330777318L, 2),
+ new osm_map_values(Navit.getInstance().T("Midi-Pyrenees"), "-0.37", "42.18", "3.50", "45.10", 462618363L, 2),
+ new osm_map_values(Navit.getInstance().T("Nord-pas-de-Calais"), "1.42", "49.92", "4.49", "51.31", 368467511L, 2),
+ new osm_map_values(Navit.getInstance().T("Pays-de-la-Loire"), "-2.88", "46.20", "0.97", "48.62", 499471143L, 2),
+ new osm_map_values(Navit.getInstance().T("Picardie"), "1.25", "48.79", "4.31", "50.43", 374308041L, 2),
+ new osm_map_values(Navit.getInstance().T("Poitou-Charentes"), "-1.69", "45.04", "1.26", "47.23", 342125526L, 2),
+ new osm_map_values(Navit.getInstance().T("Provence-Alpes-Cote-d-Azur"), "4.21", "42.91", "7.99", "45.18", 390306134L, 2),
+ new osm_map_values(Navit.getInstance().T("Rhone-Alpes"), "3.65", "44.07", "7.88", "46.64", 510797942L, 2),
+ new osm_map_values(Navit.getInstance().T("Germany"), "5.18", "46.84", "15.47", "55.64", 3521359466L, 1),
+ new osm_map_values(Navit.getInstance().T("Baden-Wuerttemberg"), "7.32", "47.14", "10.57", "49.85", 674361124L, 2),
+ new osm_map_values(Navit.getInstance().T("Bayern"), "8.92", "47.22", "13.90", "50.62", 860161150L, 2),
+ new osm_map_values(Navit.getInstance().T("Mittelfranken"), "9.86", "48.78", "11.65", "49.84", 203055195L, 2),
+ new osm_map_values(Navit.getInstance().T("Niederbayern"), "11.55", "47.75", "14.12", "49.42", 312924770L, 2),
+ new osm_map_values(Navit.getInstance().T("Oberbayern"), "10.67", "47.05", "13.57", "49.14", 382734883L, 2),
+ new osm_map_values(Navit.getInstance().T("Oberfranken"), "10.31", "49.54", "12.49", "50.95", 235258691L, 2),
+ new osm_map_values(Navit.getInstance().T("Oberpfalz"), "11.14", "48.71", "13.47", "50.43", 264536012L, 2),
+ new osm_map_values(Navit.getInstance().T("Schwaben"), "9.27", "47.10", "11.36", "49.09", 321141607L, 2),
+ new osm_map_values(Navit.getInstance().T("Unterfranken"), "8.59", "49.16", "10.93", "50.67", 303720890L, 2),
+ new osm_map_values(Navit.getInstance().T("Berlin"), "13.03", "52.28", "13.81", "52.73", 169019946L, 2),
+ new osm_map_values(Navit.getInstance().T("Brandenburg"), "11.17", "51.30", "14.83", "53.63", 323497599L, 2),
+ new osm_map_values(Navit.getInstance().T("Bremen"), "8.43", "52.96", "9.04", "53.66", 150963608L, 2),
+ new osm_map_values(Navit.getInstance().T("Hamburg"), "9.56", "53.34", "10.39", "53.80", 156284421L, 2),
+ new osm_map_values(Navit.getInstance().T("Hessen"), "7.72", "49.34", "10.29", "51.71", 432279328L, 2),
+ new osm_map_values(Navit.getInstance().T("Mecklenburg-Vorpommern"), "10.54", "53.05", "14.48", "55.05", 213183908L, 2),
+ new osm_map_values(Navit.getInstance().T("Niedersachsen"), "6.40", "51.24", "11.69", "54.22", 819766939L, 2),
+ new osm_map_values(Navit.getInstance().T("Nordrhein-westfalen"), "5.46", "50.26", "9.52", "52.59", 967053517L, 2),
+ new osm_map_values(Navit.getInstance().T("Rheinland-Pfalz"), "6.06", "48.91", "8.56", "51.00", 442868899L, 2),
+ new osm_map_values(Navit.getInstance().T("Saarland"), "6.30", "49.06", "7.46", "49.69", 157721162L, 2),
+ new osm_map_values(Navit.getInstance().T("Sachsen-Anhalt"), "10.50", "50.88", "13.26", "53.11", 287785088L, 2),
+ new osm_map_values(Navit.getInstance().T("Sachsen"), "11.82", "50.11", "15.10", "51.73", 342620834L, 2),
+ new osm_map_values(Navit.getInstance().T("Schleswig-Holstein"), "7.41", "53.30", "11.98", "55.20", 280293910L, 2),
+ new osm_map_values(Navit.getInstance().T("Thueringen"), "9.81", "50.15", "12.72", "51.70", 269428239L, 2),
+ new osm_map_values(Navit.getInstance().T("Germany")+"+"+Navit.getInstance().T("Austria")+"+"+Navit.getInstance().T("Switzerland"), "3.4", "44.5", "18.6", "55.1", 5746126429L, 1),
+ new osm_map_values(Navit.getInstance().T("Iceland"), "-25.3", "62.8", "-11.4", "67.5", 124837162L, 1),
+ new osm_map_values(Navit.getInstance().T("Ireland"), "-11.17", "51.25", "-5.23", "55.9", 234750271L, 1),
+ new osm_map_values(Navit.getInstance().T("Italy"), "6.52", "36.38", "18.96", "47.19", 1610171395L, 1),
+ new osm_map_values(Navit.getInstance().T("Spain")+"+"+Navit.getInstance().T("Portugal"), "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
+ new osm_map_values(Navit.getInstance().T("Mallorca"), "2.2", "38.8", "4.7", "40.2", 137200636L, 2),
+ new osm_map_values(Navit.getInstance().T("Galicia"), "-10.0", "41.7", "-6.3", "44.1", 174549553L, 2),
+ new osm_map_values(Navit.getInstance().T("Scandinavia"), "4.0", "54.4", "32.1", "71.5", 1398661090L, 1),
+ new osm_map_values(Navit.getInstance().T("Finland"), "18.6", "59.2", "32.3", "70.3", 460997178L, 1),
+ new osm_map_values(Navit.getInstance().T("Denmark"), "7.49", "54.33", "13.05", "57.88", 321870414L, 1),
+ new osm_map_values(Navit.getInstance().T("Switzerland"), "5.79", "45.74", "10.59", "47.84", 552565332L, 1),
+ new osm_map_values(Navit.getInstance().T("United Kingdom"), "-9.7", "49.6", "2.2", "61.2", 901724648L, 1),
+ new osm_map_values(Navit.getInstance().T("England"), "-7.80", "48.93", "2.41", "56.14", 937728414L, 1),
+ new osm_map_values(Navit.getInstance().T("Buckinghamshire"), "-1.19", "51.44", "-0.43", "52.25", 142256978L, 2),
+ new osm_map_values(Navit.getInstance().T("Cambridgeshire"), "-0.55", "51.96", "0.56", "52.79", 142334001L, 2),
+ new osm_map_values(Navit.getInstance().T("Cumbria"), "-3.96", "53.85", "-2.11", "55.24", 144422460L, 2),
+ new osm_map_values(Navit.getInstance().T("East yorkshire with hull"), "-1.16", "53.50", "0.54", "54.26", 141518744L, 2),
+ new osm_map_values(Navit.getInstance().T("Essex"), "-0.07", "51.40", "1.36", "52.14", 162542730L, 2),
+ new osm_map_values(Navit.getInstance().T("Herefordshire"), "-3.19", "51.78", "-2.29", "52.45", 129368660L, 2),
+ new osm_map_values(Navit.getInstance().T("Kent"), "-0.02", "50.81", "1.65", "51.53", 145482562L, 2),
+ new osm_map_values(Navit.getInstance().T("Lancashire"), "-3.20", "53.43", "-2.00", "54.29", 148964975L, 2),
+ new osm_map_values(Navit.getInstance().T("Leicestershire"), "-1.65", "52.34", "-0.61", "53.03", 154199956L, 2),
+ new osm_map_values(Navit.getInstance().T("Norfolk"), "0.10", "52.30", "2.04", "53.41", 146017009L, 2),
+ new osm_map_values(Navit.getInstance().T("Nottinghamshire"), "-1.39", "52.73", "-0.62", "53.55", 147986548L, 2),
+ new osm_map_values(Navit.getInstance().T("Oxfordshire"), "-1.77", "51.41", "-0.82", "52.22", 142240992L, 2),
+ new osm_map_values(Navit.getInstance().T("Shropshire"), "-3.29", "52.26", "-2.18", "53.05", 136909363L, 2),
+ new osm_map_values(Navit.getInstance().T("Somerset"), "-3.89", "50.77", "-2.20", "51.40", 145186096L, 2),
+ new osm_map_values(Navit.getInstance().T("South yorkshire"), "-1.88", "53.25", "-0.80", "53.71", 145902650L, 2),
+ new osm_map_values(Navit.getInstance().T("Suffolk"), "0.29", "51.88", "1.81", "52.60", 143799697L, 2),
+ new osm_map_values(Navit.getInstance().T("Surrey"), "-0.90", "51.02", "0.10", "51.52", 157987139L, 2),
+ new osm_map_values(Navit.getInstance().T("Wiltshire"), "-2.41", "50.90", "-1.44", "51.76", 138652346L, 2),
+ new osm_map_values(Navit.getInstance().T("Scotland"), "-8.13", "54.49", "-0.15", "61.40", 258853845L, 2),
+ new osm_map_values(Navit.getInstance().T("Wales"), "-5.56", "51.28", "-2.60", "53.60", 193593409L, 2),
+ new osm_map_values(Navit.getInstance().T("Albania"), "19.09", "39.55", "21.12", "42.72", 146199817L, 1),
+ new osm_map_values(Navit.getInstance().T("Belarus"), "23.12", "51.21", "32.87", "56.23", 324470696L, 1),
+ new osm_map_values(Navit.getInstance().T("Russian Federation"), "27.9", "41.5", "190.4", "77.6", 2148314279L, 1),
+ new osm_map_values(Navit.getInstance().T("Bulgaria"), "24.7", "42.1", "24.8", "42.1", 109869373L, 1),
+ new osm_map_values(Navit.getInstance().T("Bosnia and Herzegovina"), "15.69", "42.52", "19.67", "45.32", 187122485L, 1),
+ new osm_map_values(Navit.getInstance().T("Czech Republic"), "11.91", "48.48", "19.02", "51.17", 904838442L, 1),
+ new osm_map_values(Navit.getInstance().T("Croatia"), "13.4", "42.1", "19.4", "46.9", 460854751L, 1),
+ new osm_map_values(Navit.getInstance().T("Estonia"), "21.5", "57.5", "28.2", "59.6", 173378927L, 1),
+ new osm_map_values(Navit.getInstance().T("Greece"), "28.9", "37.8", "29.0", "37.8", 109435051L, 1),
+ new osm_map_values(Navit.getInstance().T("Crete"), "23.3", "34.5", "26.8", "36.0", 115985063L, 1),
+ new osm_map_values(Navit.getInstance().T("Hungary"), "16.08", "45.57", "23.03", "48.39", 350318541L, 1),
+ new osm_map_values(Navit.getInstance().T("Latvia"), "20.7", "55.6", "28.3", "58.1", 188188140L, 1),
+ new osm_map_values(Navit.getInstance().T("Lithuania"), "20.9", "53.8", "26.9", "56.5", 217852597L, 1),
+ new osm_map_values(Navit.getInstance().T("Poland"), "13.6", "48.8", "24.5", "55.0", 1464968657L, 1),
+ new osm_map_values(Navit.getInstance().T("Romania"), "20.3", "43.5", "29.9", "48.4", 347931565L, 1),
+ new osm_map_values(Navit.getInstance().T("Ukraine"), "22.0", "44.3", "40.4", "52.4", 793611912L, 1),
+ new osm_map_values(Navit.getInstance().T("North America"), "-178.1", "6.5", "-10.4", "84.0", 5601866516L, 0),
+ new osm_map_values(Navit.getInstance().T("Alaska"), "-179.5", "49.5", "-129", "71.6", 207746039L, 1),
+ new osm_map_values(Navit.getInstance().T("Canada"), "-141.3", "41.5", "-52.2", "70.2", 2635719651L, 1),
+ new osm_map_values(Navit.getInstance().T("Hawaii"), "-161.07", "18.49", "-154.45", "22.85", 115016656L, 1),
+ new osm_map_values(Navit.getInstance().T("USA")+Navit.getInstance().T(" (except Alaska and Hawaii)"), "-125.4", "24.3", "-66.5", "49.3", 4060487198L, 1),
+ new osm_map_values(Navit.getInstance().T("Midwest"), "-104.11", "35.92", "-80.46", "49.46", 1145596450L, 2),
+ new osm_map_values(Navit.getInstance().T("Michigan"), "-90.47", "41.64", "-79.00", "49.37", 538247019L, 2),
+ new osm_map_values(Navit.getInstance().T("Ohio"), "-84.87", "38.05", "-79.85", "43.53", 277022336L, 2),
+ new osm_map_values(Navit.getInstance().T("Northeast"), "-80.58", "38.72", "-66.83", "47.53", 1017160709L, 2),
+ new osm_map_values(Navit.getInstance().T("Massachusetts"), "-73.56", "40.78", "-68.67", "42.94", 340055487L, 2),
+ new osm_map_values(Navit.getInstance().T("Vermont"), "-73.49", "42.68", "-71.41", "45.07", 139626067L, 2),
+ new osm_map_values(Navit.getInstance().T("Pacific"), "-180.05", "15.87", "-129.75", "73.04", 207090640L, 2),
+ new osm_map_values(Navit.getInstance().T("South"), "-106.70", "23.98", "-71.46", "40.70", 1747935356L, 2),
+ new osm_map_values(Navit.getInstance().T("Arkansas"), "-94.67", "32.95", "-89.59", "36.60", 155658661L, 2),
+ new osm_map_values(Navit.getInstance().T("District of Columbia"), "-77.17", "38.74", "-76.86", "39.05", 129235755L, 2),
+ new osm_map_values(Navit.getInstance().T("Florida"), "-88.75", "23.63", "-77.67", "31.05", 224022108L, 2),
+ new osm_map_values(Navit.getInstance().T("Louisiana"), "-94.09", "28.09", "-88.62", "33.07", 210120605L, 2),
+ new osm_map_values(Navit.getInstance().T("Maryland"), "-79.54", "37.83", "-74.99", "40.22", 276462622L, 2),
+ new osm_map_values(Navit.getInstance().T("Mississippi"), "-91.71", "29.99", "-88.04", "35.05", 177858031L, 2),
+ new osm_map_values(Navit.getInstance().T("Oklahoma"), "-103.41", "33.56", "-94.38", "37.38", 200061473L, 2),
+ new osm_map_values(Navit.getInstance().T("Texas"), "-106.96", "25.62", "-92.97", "36.58", 430089141L, 2),
+ new osm_map_values(Navit.getInstance().T("Virginia"), "-83.73", "36.49", "-74.25", "39.52", 384187569L, 2),
+ new osm_map_values(Navit.getInstance().T("West Virginia"), "-82.70", "37.15", "-77.66", "40.97", 220552071L, 2),
+ new osm_map_values(Navit.getInstance().T("West"), "-133.11", "31.28", "-101.99", "49.51", 1152909162L, 2),
+ new osm_map_values(Navit.getInstance().T("Arizona"), "-114.88", "30.01", "-108.99", "37.06", 182826833L, 2),
+ new osm_map_values(Navit.getInstance().T("California"), "-125.94", "32.43", "-114.08", "42.07", 586923326L, 2),
+ new osm_map_values(Navit.getInstance().T("Colorado"), "-109.11", "36.52", "-100.41", "41.05", 228623724L, 2),
+ new osm_map_values(Navit.getInstance().T("Idaho"), "-117.30", "41.93", "-110.99", "49.18", 170684507L, 2),
+ new osm_map_values(Navit.getInstance().T("Montana"), "-116.10", "44.31", "-102.64", "49.74", 176229800L, 2),
+ new osm_map_values(Navit.getInstance().T("New Mexico"), "-109.10", "26.98", "-96.07", "37.05", 361793070L, 2),
+ new osm_map_values(Navit.getInstance().T("Nevada"), "-120.2", "35.0", "-113.8", "42.1", 200614482L, 2),
+ new osm_map_values(Navit.getInstance().T("Oregon"), "-124.8", "41.8", "-116.3", "46.3", 211462685L, 2),
+ new osm_map_values(Navit.getInstance().T("Utah"), "-114.11", "36.95", "-108.99", "42.05", 151590197L, 2),
+ new osm_map_values(Navit.getInstance().T("Washington State"), "-125.0", "45.5", "-116.9", "49.0", 222553768L, 2),
+ new osm_map_values(Navit.getInstance().T("South+Middle America"), "-83.5", "-56.3", "-30.8", "13.7", 958895383L, 0),
+ new osm_map_values(Navit.getInstance().T("Argentina"), "-73.9", "-57.3", "-51.6", "-21.0", 376857648L, 1),
+ new osm_map_values(Navit.getInstance().T("Argentina")+"+"+Navit.getInstance().T("Chile"), "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
+ new osm_map_values(Navit.getInstance().T("Bolivia"), "-70.5", "-23.1", "-57.3", "-9.3", 175937824L, 1),
+ new osm_map_values(Navit.getInstance().T("Brazil"), "-71.4", "-34.7", "-32.8", "5.4", 664872975L, 1),
+ new osm_map_values(Navit.getInstance().T("Chile"), "-81.77", "-58.50", "-65.46", "-17.41", 241657330L, 1),
+ new osm_map_values(Navit.getInstance().T("Cuba"), "-85.3", "19.6", "-74.0", "23.6", 129043575L, 1),
+ new osm_map_values(Navit.getInstance().T("Colombia"), "-79.1", "-4.0", "-66.7", "12.6", 212016580L, 1),
+ new osm_map_values(Navit.getInstance().T("Ecuador"), "-82.6", "-5.4", "-74.4", "2.3", 158857591L, 1),
+ new osm_map_values(Navit.getInstance().T("Guyana")+"+"+Navit.getInstance().T("Suriname")+"+"+Navit.getInstance().T("Guyane Francaise"), "-62.0", "1.0", "-51.2", "8.9", 123000072L, 1),
+ new osm_map_values(Navit.getInstance().T("Haiti")+"+"+Navit.getInstance().T("Dominican Republic"), "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1),
+ new osm_map_values(Navit.getInstance().T("Jamaica"), "-78.6", "17.4", "-75.9", "18.9", 113961998L, 1),
+ new osm_map_values(Navit.getInstance().T("Mexico"), "-117.6", "14.1", "-86.4", "32.8", 551307973L, 1),
+ new osm_map_values(Navit.getInstance().T("Paraguay"), "-63.8", "-28.1", "-53.6", "-18.8", 159498397L, 1),
+ new osm_map_values(Navit.getInstance().T("Peru"), "-82.4", "-18.1", "-67.5", "0.4", 212490557L, 1),
+ new osm_map_values(Navit.getInstance().T("Uruguay"), "-59.2", "-36.5", "-51.7", "-29.7", 157482719L, 1),
+ new osm_map_values(Navit.getInstance().T("Venezuela"), "-73.6", "0.4", "-59.7", "12.8", 167295729L, 1)
};
- private String map_filename_path;
+ private final String map_filename_path;
public static NavitMap[] getAvailableMaps() {
class filterMaps implements FilenameFilter {
@@ -320,8 +320,8 @@ public class NavitMapDownloader extends Thread
return maps;
}
private Boolean stop_me = false;
- private osm_map_values map_values;
- private int map_id;
+ private final osm_map_values map_values;
+ private final int map_id;
private long uiLastUpdated = -1;
private Boolean retryDownload = false; //Download failed, but
@@ -334,8 +334,7 @@ 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 int retry_counter = 0;
+ private int retry_counter = 0;
NavitMapDownloader(int map_id) {
this.map_values = osm_maps[map_id];
@@ -348,13 +347,15 @@ public class NavitMapDownloader extends Thread
retry_counter = 0;
Log.v(TAG, "start download " + map_values.map_name);
- updateProgress(0, map_values.est_size_bytes, Navit.T("downloading") + ": " + map_values.map_name);
+ updateProgress(0, map_values.est_size_bytes, Navit.getInstance().T("downloading") + ": " + map_values.map_name);
boolean success;
do {
try {
Thread.sleep(10 + retry_counter * 1000);
- } catch (InterruptedException e1) {}
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
retryDownload = false;
success = download_osm_map();
} while ( !success
@@ -363,7 +364,7 @@ public class NavitMapDownloader extends Thread
&& !stop_me);
if (success) {
- toast(map_values.map_name + " " + Navit.T("ready"));
+ toast(map_values.map_name + " " + Navit.getInstance().T("ready"));
getMapInfoFile().delete();
Log.d(TAG, "success");
}
@@ -389,10 +390,10 @@ public class NavitMapDownloader extends Thread
String msg;
Log.e(TAG, "Not enough free space or media not available. Please free at least " + needed_bytes / 1024 /1024 + "Mb.");
if(free_space<0)
- msg=Navit.T("Media selected for map storage is not available");
+ msg=Navit.getInstance().T("Media selected for map storage is not available");
else
- msg=Navit.T("Not enough free space");
- updateProgress(free_space, needed_bytes, Navit.T("Error downloading map!") + "\n" + msg);
+ msg=Navit.getInstance().T("Not enough free space");
+ updateProgress(free_space, needed_bytes, Navit.getInstance().T("Error downloading map!") + "\n" + msg);
return false;
}
return true;
@@ -415,12 +416,11 @@ public class NavitMapDownloader extends Thread
}
/**
- * @param map_values
* @return
*/
private boolean download_osm_map() {
long already_read = 0;
- long real_size_bytes = 0;
+ long real_size_bytes;
boolean resume = true;
File outputFile = getDestinationFile();
@@ -498,13 +498,14 @@ public class NavitMapDownloader extends Thread
bif.close();
} catch (IOException e) {
+ e.printStackTrace();
}
}
return success;
}
private URL getDownloadURL() {
- URL url = null;
+ URL url;
try {
url =
new URL("http://maps.navit-project.org/api/map/?bbox=" + map_values.lon1 + "," + map_values.lat1
@@ -528,7 +529,7 @@ public class NavitMapDownloader extends Thread
}
private BufferedInputStream getInputStream(URLConnection c) {
- BufferedInputStream bif = null;
+ BufferedInputStream bif;
try {
bif = new BufferedInputStream(c.getInputStream(), MAP_READ_FILE_BUFFER);
} catch (FileNotFoundException e) {
@@ -555,7 +556,7 @@ public class NavitMapDownloader extends Thread
}
private BufferedOutputStream getOutputStream(File outputFile, boolean resume) {
- BufferedOutputStream buf = null;
+ BufferedOutputStream buf;
try {
buf = new BufferedOutputStream(new FileOutputStream(outputFile, resume), MAP_WRITE_FILE_BUFFER);
} catch (FileNotFoundException e) {
@@ -566,7 +567,7 @@ public class NavitMapDownloader extends Thread
}
private URLConnection initConnection(URL url) {
- HttpURLConnection c = null;
+ HttpURLConnection c;
try {
c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
@@ -584,15 +585,14 @@ public class NavitMapDownloader extends Thread
private boolean readData(OutputStream buf, InputStream bif, long already_read, long real_size_bytes) {
long start_timestamp = System.nanoTime();
byte[] buffer = new byte[MAP_WRITE_MEM_BUFFER];
- int len1 = 0;
- long mapFileSize = real_size_bytes;
+ int len1;
long startOffset = already_read;
boolean success = false;
try {
while (!stop_me && (len1 = bif.read(buffer)) != -1) {
already_read += len1;
- updateProgress(start_timestamp, startOffset, already_read, mapFileSize);
+ updateProgress(start_timestamp, startOffset, already_read, real_size_bytes);
try {
buf.write(buffer, 0, len1);
@@ -602,11 +602,11 @@ public class NavitMapDownloader extends Thread
if (deleteMap()) {
enableRetry();
} else {
- updateProgress(already_read, real_size_bytes, Navit.T("Error downloading map!") + "\n"
- + Navit.T("Not enough free space"));
+ updateProgress(already_read, real_size_bytes, Navit.getInstance().T("Error downloading map!") + "\n"
+ + Navit.getInstance().T("Not enough free space"));
}
} else {
- updateProgress(already_read, real_size_bytes, Navit.T("Error writing map!"));
+ updateProgress(already_read, real_size_bytes, Navit.getInstance().T("Error writing map!"));
}
return false;
@@ -614,7 +614,7 @@ public class NavitMapDownloader extends Thread
}
if (stop_me) {
- toast(Navit.T("Map download aborted!"));
+ toast(Navit.getInstance().T("Map download aborted!"));
} else if ( already_read < real_size_bytes ) {
Log.d(TAG, "Server send only " + already_read + " bytes of " + real_size_bytes);
enableRetry();
@@ -625,7 +625,7 @@ public class NavitMapDownloader extends Thread
Log.d(TAG, "Error: " + e);
enableRetry();
- updateProgress(already_read, real_size_bytes, Navit.T("Error downloading map!"));
+ updateProgress(already_read, real_size_bytes, Navit.getInstance().T("Error downloading map!"));
}
return success;
@@ -667,14 +667,14 @@ public class NavitMapDownloader extends Thread
eta_string = eta_seconds + " s";
}
String info =
- String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s", Navit.T("downloading")
+ String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s", Navit.getInstance().T("downloading")
, map_values.map_name, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
- per_second_overall / 1024f, Navit.T("ETA"), eta_string);
+ per_second_overall / 1024f, Navit.getInstance().T("ETA"), eta_string);
if (retry_counter > 0) {
info += "\n Retry " + retry_counter + "/" + MAX_RETRIES;
}
- Log.e(TAG, "info: " + info);
+ Log.d(TAG, "info: " + info);
updateProgress(readBytes, maxBytes, info);
uiLastUpdated = currentTime;
@@ -682,7 +682,7 @@ public class NavitMapDownloader extends Thread
}
private void updateProgress(long positionBytes, long maximumBytes, String infoText) {
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_PROGRESS_BAR, Navit.T("Map download"), infoText
+ NavitDialogs.sendDialogMessage(NavitDialogs.MSG_PROGRESS_BAR, Navit.getInstance().T("Map download"), infoText
, NavitDialogs.DIALOG_MAPDOWNLOAD, (int) (maximumBytes / 1024),
(int) (positionBytes / 1024));
}
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
index 77b79c3c2..23419ac0f 100644
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
@@ -27,10 +27,11 @@ import android.speech.tts.TextToSpeech;
import android.util.Log;
+@SuppressWarnings("unused")
public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
private TextToSpeech mTts;
- private Navit navit;
- private int MY_DATA_CHECK_CODE=1;
+ private final Navit navit;
+ private final int MY_DATA_CHECK_CODE=1;
public void onInit(int status)
@@ -52,7 +53,7 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
.setTitle(R.string.TTS_title_data_missing)
.setMessage(R.string.TTS_qery_install_data)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
+ public void onClick(DialogInterface dialog, int which) {
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
navit.startActivity(installIntent);
@@ -68,11 +69,11 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
{
this.navit=navit;
navit.setActivityResult(1, this);
- Log.e("NavitSpeech2","Create");
+ Log.d("NavitSpeech2","Create");
Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
if (navit.getPackageManager().resolveActivity(checkIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
- Log.e("NavitSpeech2","ACTION_CHECK_TTS_DATA available");
+ Log.d("NavitSpeech2","ACTION_CHECK_TTS_DATA available");
navit.startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
} else {
Log.e("NavitSpeech2","ACTION_CHECK_TTS_DATA not available, assume tts is working");
diff --git a/navit/android/src/org/navitproject/navit/NavitTextTranslations.java b/navit/android/src/org/navitproject/navit/NavitTextTranslations.java
deleted file mode 100644
index 5deaca305..000000000
--- a/navit/android/src/org/navitproject/navit/NavitTextTranslations.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.util.HashMap;
-
-import android.util.Log;
-
-public class NavitTextTranslations
-{
- static String main_language = "en";
- static String sub_language = "EN";
- static String fallback_language = "en";
- static String fallback_sub_language = "EN";
- private static HashMap<String, HashMap<String, String>> Navit_text_lookup = new HashMap<String, HashMap<String, String>>();
-
- public static void init()
- {
- Log.e("NavitTextTranslations", "initializing translated text ...");
- String k = null;
- String[] v = null;
-/*
- k = "exit navit";
- v = new String[]{"en", "Exit Navit", "de", "Navit beenden", "nl", "Navit afsluiten", "fr","Quittez Navit"};
- p(k, v);
-
- k = "zoom in";
- v = new String[]{"en", "Zoom in", "fr", "Zoom-avant"};
- p(k, v);
-
- k = "zoom out";
- v = new String[]{"en", "Zoom out", "fr", "Zoom-arrière", "nl", "Zoom uit"};
- p(k, v);
-
- k = "address search";
- v = new String[]{"en", "Address search", "de", "Adresse suchen", "nl", "Zoek adres", "fr","Cherchez adresse"};
- p(k, v);
-
- k = "Mapdownload";
- v = new String[]{"en", "Mapdownload", "de", "Kartendownload"};
- p(k, v);
-
- k = "downloading";
- v = new String[]{"en", "downloading"};
- p(k, v);
-
- k = "Downloaded maps";
- v = new String[]{"en", "Downloaded maps", "de", "Heruntergeladene Karten", "nl", "Gedownloade kaarten", "fr","Cartes téléchargées" };
- p(k, v);
-
- k = "ETA";
- v = new String[]{"en", "ETA", "de", "fertig in"};
- p(k, v);
-
- k = "Error downloading map";
- v = new String[]{"en", "Error downloading map!", "de", "Fehler beim Kartendownload"};
- p(k, v);
-
- k = "ready";
- v = new String[]{"en", "ready", "de", "fertig"};
- p(k, v);
-
- k = "Ok";
- v = new String[]{"en", "OK"};
- p(k, v);
-
- k = "No address found";
- v = new String[]{"en", "No address found", "de", "Keine Adresse gefunden"};
- p(k, v);
-
- k = "Enter: City and Street";
- v = new String[]{"en", "Enter: City, Street", "de", "Stadt und Straße:"};
- p(k, v);
-
- k = "No search string entered";
- v = new String[]{"en", "No text entered", "de", "Keine Eingabe"};
- p(k, v);
-
- k = "setting destination to";
- v = new String[]{"en", "Setting destination to:", "de", "neues Fahrziel"};
- p(k, v);
-
- k = "getting search results";
- v = new String[]{"en", "getting search results", "de", "lade Suchergebnisse"};
- p(k, v);
-
- k = "searching ...";
- v = new String[]{"en", "searching ...", "de", "Suche läuft ..."};
- p(k, v);
-
- k = "No Results found!";
- v = new String[]{"en", "No Results found!", "de", "Suche liefert kein Ergebnis!"};
- p(k, v);
-
- k = "Map data (c) OpenStreetMap contributors, CC-BY-SA";
- v = new String[]{"en", "Map data (c) OpenStreetMap contributors, CC-BY-SA"};
- p(k, v);
-
- k = "partial match";
- v = new String[]{"en", "partial match", "de", "ungefähr"};
- p(k, v);
-
- k = "Search";
- v = new String[]{"en", "Search", "de", "suchen"};
- p(k, v);
-
- k = "drive here";
- v = new String[]{"en", "Route to here", "de", "Ziel setzen"};
- p(k, v);
-
- k = "loading search results";
- v = new String[]{"en", "Loading search results", "de", "lade Suchergebnisse"};
- p(k, v);
-
- k = "towns";
- v = new String[]{"en", "Towns", "de", "Städte"};
- p(k, v);
-*/
- Log.e("NavitTextTranslations", "... ready");
- }
-
- private static void p(String key, String[] values)
- {
- HashMap<String, String> t = new HashMap<String, String>();
- //Log.e("NavitTextTranslations", "trying: " + key);
- try
- {
- for (int i = 0; i < (int) (values.length / 2); i++)
- {
- t.put(values[i * 2], values[(i * 2) + 1]);
- }
- Navit_text_lookup.put(key, t);
- }
- catch (Exception e)
- {
- Log.e("NavitTextTranslations", "!!Error in translationkey: " + key);
- }
- }
-
- public static String get_text(String in)
- {
- String out = null;
- //Log.e("NavitTextTranslations", "lookup L:" + main_language + " T:" + in);
- try
- {
- out = Navit_text_lookup.get(in).get(main_language);
- }
- catch (Exception e)
- {
- // most likely there is not translation yet
- //Log.e("NavitTextTranslations", "lookup: exception");
- out = null;
- }
-
- if (out == null)
- {
- // always return a string for output (use fallback language)
- //Log.e("NavitTextTranslations", "using default language");
- try
- {
- out = Navit_text_lookup.get(in).get(fallback_language);
- }
- catch (Exception e)
- {
- //Log.e("NavitTextTranslations", "using default language: exception");
- // most likely there is not translation yet
- out = null;
- }
- }
-
- if (out == null)
- {
- // if we still dont have any text, use the ".mo" file and call the c-function gettext(in)
- out = NavitGraphics.getLocalizedString(in);
- if (out != null)
- {
- HashMap<String, String> langmap = new HashMap<String, String>();
- langmap.put(main_language, out);
- Navit_text_lookup.put(in, langmap);
- }
-
- //Log.e("NavitTextTranslations", "return the value from gettext() = " + out);
- }
- return out;
- }
-
-}