summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2018-09-29 18:32:09 +0300
committermvglasow <michael -at- vonglasow.com>2018-09-29 18:32:09 +0300
commit53c4864ffbe38945fd288dc62dd5c48ba01b45f0 (patch)
treef3c59bc47cfb333ff0ea17eec65db6e5c567cc12 /navit
parent3c94452c687094b54add1e415fd17ee161d796bf (diff)
parent98e7489e1098e22ec13097ea09c2af49a8889a59 (diff)
downloadnavit-53c4864ffbe38945fd288dc62dd5c48ba01b45f0.tar.gz
Merge branch 'master' into traffic
Diffstat (limited to 'navit')
-rw-r--r--navit/Doxyfile2
-rw-r--r--navit/android/src/org/navitproject/navit/FileBrowserActivity.java117
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java346
-rw-r--r--navit/android/src/org/navitproject/navit/NavitActivityResult.java2
-rw-r--r--navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java49
-rwxr-xr-xnavit/android/src/org/navitproject/navit/NavitAppConfig.java12
-rw-r--r--navit/android/src/org/navitproject/navit/NavitBackupTask.java22
-rw-r--r--navit/android/src/org/navitproject/navit/NavitCamera.java3
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDialogs.java265
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java86
-rw-r--r--navit/android/src/org/navitproject/navit/NavitGraphics.java576
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMapDownloader.java518
-rw-r--r--navit/android/src/org/navitproject/navit/NavitRestoreTask.java38
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSensors.java12
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java24
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTimeout.java11
-rw-r--r--navit/android/src/org/navitproject/navit/NavitVehicle.java29
-rw-r--r--navit/android/src/org/navitproject/navit/NavitWatch.java47
-rw-r--r--navit/callback.c18
-rw-r--r--navit/coord.c19
-rw-r--r--navit/gui/gtk/CMakeLists.txt3
-rw-r--r--navit/gui/gtk/gui_gtk.h51
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c27
-rw-r--r--navit/gui/gtk/gui_gtk_window.c9
-rw-r--r--navit/gui/internal/CMakeLists.txt4
-rw-r--r--navit/gui/internal/gui_internal.c19
-rw-r--r--navit/gui/internal/gui_internal.h107
-rw-r--r--navit/gui/internal/gui_internal_keyboard.h28
-rw-r--r--navit/gui/internal/gui_internal_poi.h69
-rw-r--r--navit/gui/internal/gui_internal_priv.h274
-rw-r--r--navit/gui/internal/gui_internal_widget.h233
-rw-r--r--navit/maps/CMakeLists.txt3
-rw-r--r--navit/script/mapExtract.class.php76
-rw-r--r--navit/script/mapextract.php60
34 files changed, 1643 insertions, 1516 deletions
diff --git a/navit/Doxyfile b/navit/Doxyfile
index 6b3bc777a..13f382f44 100644
--- a/navit/Doxyfile
+++ b/navit/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME = navit
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 0.5.1-trunk
+PROJECT_NUMBER = 0.5.3-trunk
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java b/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
index 319623a83..dc7462b76 100644
--- a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
+++ b/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
@@ -2,7 +2,7 @@ package org.navitproject.navit;
//Heavily based on code from
//https://github.com/mburman/Android-File-Explore
-// Version of Aug 13, 2011
+// Version of Aug 13, 2011
//Also contributed:
// Sugan Krishnan (https://github.com/rgksugan) - Jan 2013.
//
@@ -10,14 +10,6 @@ package org.navitproject.navit;
//Project type now is Android library:
// http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject
-//General Java imports
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Collections;
-
//Android imports
import android.app.Activity;
import android.content.Intent;
@@ -27,11 +19,19 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.StatFs;
import android.util.Log;
+import android.view.*;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
-import android.view.*;
import android.widget.*;
+//General Java imports
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
//Import of resources file for file browser
import org.navitproject.navit.R;
@@ -113,22 +113,22 @@ public class FileBrowserActivity extends Activity {
String requestedStartDir = thisInt
.getStringExtra(startDirectoryParameter);
- if (requestedStartDir != null && requestedStartDir.length() > 0) {// if(requestedStartDir!=null
+ if (requestedStartDir != null && requestedStartDir.length() > 0) { // if(requestedStartDir!=null
File tempFile = new File(requestedStartDir);
- if (tempFile.isDirectory())
+ if (tempFile.isDirectory()) {
this.path = tempFile;
- }// if(requestedStartDir!=null
+ }
+ } // if(requestedStartDir!=null
- if (this.path == null) {// No or invalid directory supplied in intent
- // parameter
+ if (this.path == null) { // No or invalid directory supplied in intent parameter
if (Environment.getExternalStorageDirectory().isDirectory()
- && Environment.getExternalStorageDirectory().canRead())
+ && Environment.getExternalStorageDirectory().canRead()) {
path = Environment.getExternalStorageDirectory();
- else
+ } else {
path = new File("/");
- }// if(this.path==null) {//No or invalid directory supplied in intent
- // parameter
- }// private void setInitialDirectory() {
+ }
+ } // if(this.path==null) {//No or invalid directory supplied in intent parameter
+ } // private void setInitialDirectory() {
private void parseDirectoryPath() {
pathDirsList.clear();
@@ -162,10 +162,10 @@ public class FileBrowserActivity extends Activity {
returnDirectoryFinishActivity();
}
});
- } else {// if(currentAction == this.SELECT_DIRECTORY) {
+ } else { // if(currentAction == this.SELECT_DIRECTORY) {
selectFolderButton.setVisibility(View.GONE);
- }// } else {//if(currentAction == this.SELECT_DIRECTORY) {
- }// private void initializeButtons() {
+ } // } else {//if(currentAction == this.SELECT_DIRECTORY) {
+ } // private void initializeButtons() {
private void loadDirectoryUp() {
// present directory removed from list
@@ -187,25 +187,26 @@ public class FileBrowserActivity extends Activity {
((Button) this.findViewById(R.id.upDirectoryButton))
.setEnabled(false);
curDirString = "/";
- } else
+ } else {
((Button) this.findViewById(R.id.upDirectoryButton))
.setEnabled(true);
+ }
long freeSpace = getFreeSpace(curDirString);
String formattedSpaceString = formatBytes(freeSpace);
if (freeSpace == 0) {
Log.d(LOGTAG, "NO FREE SPACE");
File currentDir = new File(curDirString);
- if(!currentDir.canWrite())
+ if (!currentDir.canWrite()) {
formattedSpaceString = "NON Writable";
+ }
}
((Button) this.findViewById(R.id.selectCurrentDirectoryButton))
- .setText("Select\n[" + formattedSpaceString
- + "]");
+ .setText("Select\n[" + formattedSpaceString + "]");
((TextView) this.findViewById(R.id.currentDirectoryTextView))
.setText("Current directory: " + curDirString);
- }// END private void updateCurrentDirectoryTextView() {
+ } // END private void updateCurrentDirectoryTextView() {
private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
@@ -214,7 +215,7 @@ public class FileBrowserActivity extends Activity {
private void initializeFileListView() {
ListView lView = (ListView) this.findViewById(R.id.fileListView);
LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(
- LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+ LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lParam.setMargins(15, 5, 15, 5);
lView.setAdapter(this.adapter);
lView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@@ -233,35 +234,34 @@ public class FileBrowserActivity extends Activity {
adapter.notifyDataSetChanged();
updateCurrentDirectoryTextView();
Log.d(LOGTAG, path.getAbsolutePath());
- } else {// if(sel.canRead()) {
+ } else { // if(sel.canRead()) {
showToast("Path does not exist or cannot be read");
- }// } else {//if(sel.canRead()) {
- }// if (sel.isDirectory()) {
- // File picked or an empty directory message clicked
- else {// if (sel.isDirectory()) {
+ } // } else {//if(sel.canRead()) {
+ } else { // if (sel.isDirectory()) {
+ // File picked or an empty directory message clicked
Log.d(LOGTAG, "item clicked");
if (!directoryShownIsEmpty) {
Log.d(LOGTAG, "File selected:" + chosenFile);
returnFileFinishActivity(sel.getAbsolutePath());
}
- }// else {//if (sel.isDirectory()) {
- }// public void onClick(DialogInterface dialog, int which) {
- });// lView.setOnClickListener(
- }// private void initializeFileListView() {
+ } // else {//if (sel.isDirectory()) {
+ } // public void onClick(DialogInterface dialog, int which) {
+ }); // lView.setOnClickListener(
+ } // private void initializeFileListView() {
private void returnDirectoryFinishActivity() {
Intent retIntent = new Intent();
retIntent.putExtra(returnDirectoryParameter, path.getAbsolutePath());
this.setResult(RESULT_OK, retIntent);
this.finish();
- }// END private void returnDirectoryFinishActivity() {
+ } // END private void returnDirectoryFinishActivity() {
private void returnFileFinishActivity(String filePath) {
Intent retIntent = new Intent();
retIntent.putExtra(returnFileParameter, filePath);
this.setResult(RESULT_OK, retIntent);
this.finish();
- }// END private void returnDirectoryFinishActivity() {
+ } // END private void returnDirectoryFinishActivity() {
private void loadFileList() {
try {
@@ -291,17 +291,15 @@ public class FileBrowserActivity extends Activity {
return (showReadableFile);
}
return true;
- }// public boolean accept(File dir, String filename) {
- };// FilenameFilter filter = new FilenameFilter() {
+ } // public boolean accept(File dir, String filename) {
+ }; // FilenameFilter filter = new FilenameFilter() {
String[] fList = path.list(filter);
this.directoryShownIsEmpty = false;
for (int i = 0; i < fList.length; i++) {
// Convert into file path
File sel = new File(path, fList[i]);
- Log.d(LOGTAG,
- "File:" + fList[i] + " readable:"
- + (Boolean.valueOf(sel.canRead())).toString());
+ Log.d(LOGTAG, "File:" + fList[i] + " readable:" + (Boolean.valueOf(sel.canRead())).toString());
int drawableID = R.drawable.file_icon;
boolean canRead = sel.canRead();
// Set drawables
@@ -313,19 +311,19 @@ public class FileBrowserActivity extends Activity {
}
}
fileList.add(i, new Item(fList[i], drawableID, canRead));
- }// for (int i = 0; i < fList.length; i++) {
+ } // for (int i = 0; i < fList.length; i++) {
if (fileList.size() == 0) {
// Log.d(LOGTAG, "This directory is empty");
this.directoryShownIsEmpty = true;
fileList.add(0, new Item("Directory is empty", -1, true));
- } else {// sort non empty list
+ } else { // sort non empty list
Collections.sort(fileList, new ItemFileNameComparator());
}
} else {
Log.e(LOGTAG, "path does not exist or cannot be read");
}
// Log.d(TAG, "loadFileList finished");
- }// private void loadFileList() {
+ } // private void loadFileList() {
private void createFileListAdapter() {
adapter = new ArrayAdapter<Item>(this,
@@ -357,9 +355,9 @@ public class FileBrowserActivity extends Activity {
// centered
textView.setCompoundDrawablePadding(dp3);
return view;
- }// public View getView(int position, View convertView, ViewGroup
- };// adapter = new ArrayAdapter<Item>(this,
- }// private createFileListAdapter(){
+ } // public View getView(int position, View convertView, ViewGroup
+ }; // adapter = new ArrayAdapter<Item>(this,
+ } // private createFileListAdapter(){
private class Item {
public String file;
@@ -375,7 +373,7 @@ public class FileBrowserActivity extends Activity {
public String toString() {
return file;
}
- }// END private class Item {
+ } // END private class Item {
private class ItemFileNameComparator implements Comparator<Item> {
public int compare(Item lhs, Item rhs) {
@@ -394,26 +392,26 @@ public class FileBrowserActivity extends Activity {
// in custom components
// TODO: check with keyboard
// if(newConfig.keyboard == Configuration.KEYBOARDHIDDEN_YES)
- }// END public void onConfigurationChanged(Configuration newConfig) {
+ } // END public void onConfigurationChanged(Configuration newConfig) {
public static long getFreeSpace(String path) {
StatFs stat = new StatFs(path);
long availSize = (long) stat.getAvailableBlocks()
* (long) stat.getBlockSize();
return availSize;
- }// END public static long getFreeSpace(String path) {
+ } // END public static long getFreeSpace(String path) {
public static String formatBytes(long bytes) {
// TODO: add flag to which part is needed (e.g. GB, MB, KB or bytes)
String retStr = "";
// One binary gigabyte equals 1,073,741,824 bytes.
- if (bytes > 1073741824) {// Add GB
+ if (bytes > 1073741824) { // Add GB
long gbs = bytes / 1073741824;
retStr += (new Long(gbs)).toString() + "GB ";
bytes = bytes - (gbs * 1073741824);
}
// One MB - 1048576 bytes
- if (bytes > 1048576) {// Add GB
+ if (bytes > 1048576) { // Add GB
long mbs = bytes / 1048576;
retStr += (new Long(mbs)).toString() + "MB ";
bytes = bytes - (mbs * 1048576);
@@ -422,9 +420,10 @@ public class FileBrowserActivity extends Activity {
long kbs = bytes / 1024;
retStr += (new Long(kbs)).toString() + "KB";
bytes = bytes - (kbs * 1024);
- } else
+ } else {
retStr += (new Long(bytes)).toString() + " bytes";
+ }
return retStr;
- }// public static String formatBytes(long bytes){
+ } // public static String formatBytes(long bytes){
-}// END public class FileBrowserActivity extends Activity {
+} // END public class FileBrowserActivity extends Activity {
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
index 34aeab857..feb472764 100644
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ b/navit/android/src/org/navitproject/navit/Navit.java
@@ -71,7 +71,7 @@ public class Navit extends Activity {
private NavitDialogs dialogs;
private PowerManager.WakeLock wl;
- private NavitActivityResult[] ActivityResults;
+ private NavitActivityResult[] ActivityResults;
public static InputMethodManager mgr = null;
public static DisplayMetrics metrics = null;
public static int status_bar_height = 0;
@@ -123,8 +123,9 @@ public class Navit extends Activity {
public void removeFileIfExists(String source) {
File file = new File(source);
- if (!file.exists())
+ if (!file.exists()) {
return;
+ }
file.delete();
}
@@ -132,8 +133,9 @@ public class Navit extends Activity {
public void copyFileIfExists(String source, String destination) throws IOException {
File file = new File(source);
- if (!file.exists())
+ if (!file.exists()) {
return;
+ }
FileInputStream is = null;
FileOutputStream os = null;
@@ -150,11 +152,13 @@ public class Navit extends Activity {
}
} finally {
/* Close the FileStreams to prevent Resource leaks */
- if (is != null)
+ if (is != null) {
is.close();
+ }
- if (os != null)
+ if (os != null) {
os.close();
+ }
}
}
@@ -173,15 +177,17 @@ public class Navit extends Activity {
Log.e(TAG, "Res Name " + resname + ", result " + result);
int id = NavitResources.getIdentifier(resname, "raw", NAVIT_PACKAGE_NAME);
Log.e(TAG, "Res ID " + id);
- if (id == 0)
+ if (id == 0) {
return false;
+ }
File resultfile = new File(result);
if (!resultfile.exists()) {
needs_update = true;
File path = resultfile.getParentFile();
- if ( !path.exists() && !resultfile.getParentFile().mkdirs())
+ if (!path.exists() && !resultfile.getParentFile().mkdirs()) {
return false;
+ }
} else {
PackageManager pm = getPackageManager();
ApplicationInfo appInfo;
@@ -193,8 +199,9 @@ public class Navit extends Activity {
Log.e(TAG, "Could not read package infos");
e.printStackTrace();
}
- if (apkUpdateTime > resultfile.lastModified())
+ if (apkUpdateTime > resultfile.lastModified()) {
needs_update = true;
+ }
}
if (needs_update) {
@@ -234,15 +241,16 @@ public class Navit extends Activity {
}
});
- infobox.setNeutralButton(getTstring(R.string.initial_info_box_more_info), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.d(TAG, "user wants more info, show the website");
- String url = "http://wiki.navit-project.org/index.php/Navit_on_Android";
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(url));
- startActivity(i);
- }
- });
+ infobox.setNeutralButton(getTstring(R.string.initial_info_box_more_info),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ Log.d(TAG, "user wants more info, show the website");
+ String url = "http://wiki.navit-project.org/index.php/Navit_on_Android";
+ Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(Uri.parse(url));
+ startActivity(i);
+ }
+ });
infobox.show();
SharedPreferences.Editor edit_settings = settings.edit();
edit_settings.putBoolean("firstStart", false);
@@ -254,10 +262,11 @@ public class Navit extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- else
+ } else {
this.getActionBar().hide();
+ }
navit = this;
dialogs = new NavitDialogs(this);
@@ -300,17 +309,19 @@ public class Navit extends Activity {
navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
- Log.d(TAG,
- String.format("status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, navigation_bar_height_landscape=%d, navigation_bar_width=%d",
- status_bar_height, action_bar_default_height, navigation_bar_height, navigation_bar_height_landscape,
- navigation_bar_width));
+ Log.d(TAG, String.format(
+ "status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, "
+ + "navigation_bar_height_landscape=%d, navigation_bar_width=%d",
+ status_bar_height, action_bar_default_height, navigation_bar_height,
+ navigation_bar_height_landscape, navigation_bar_width));
if ((ContextCompat.checkSelfPermission(this,
- Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)||
- (ContextCompat.checkSelfPermission(this,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
+ || (ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- Log.d (TAG,"ask for permission(s)");
+ Log.d(TAG,"ask for permission(s)");
ActivityCompat.requestPermissions(this,
- new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_FINE_LOCATION},MY_PERMISSIONS_REQUEST_ALL);
+ new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_FINE_LOCATION},
+ MY_PERMISSIONS_REQUEST_ALL);
}
// get the local language -------------
Locale locale = java.util.Locale.getDefault();
@@ -331,7 +342,8 @@ public class Navit extends Activity {
Log.d(TAG, "Language " + lang);
SharedPreferences prefs = getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- map_filename_path = prefs.getString("filenamePath", Environment.getExternalStorageDirectory().getPath() + "/navit/");
+ map_filename_path = prefs.getString("filenamePath",
+ Environment.getExternalStorageDirectory().getPath() + "/navit/");
// make sure the new path for the navitmap.bin file(s) exist!!
File navit_maps_dir = new File(map_filename_path);
@@ -346,7 +358,7 @@ public class Navit extends Activity {
int height_ = display_.getHeight();
metrics = new DisplayMetrics();
display_.getMetrics(Navit.metrics);
- int densityDpi = (int)(( Navit.metrics.density*160)-.5f);
+ int densityDpi = (int)((Navit.metrics.density * 160) - .5f);
Log.d(TAG, "Navit -> pixels x=" + width_ + " pixels y=" + height_);
Log.d(TAG, "Navit -> dpi=" + densityDpi);
Log.d(TAG, "Navit -> density=" + Navit.metrics.density);
@@ -374,7 +386,7 @@ public class Navit extends Activity {
} else if (densityDpi < 640) {
my_display_density = "xxxhdpi";
} else {
- Log.e(TAG, "found device of very high density ("+densityDpi+")");
+ Log.e(TAG, "found device of very high density (" + densityDpi + ")");
Log.e(TAG, "using xxxhdpi values");
my_display_density = "xxxhdpi";
}
@@ -385,7 +397,7 @@ public class Navit extends Activity {
Log.d(TAG, "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(android.os.Build.VERSION.SDK));
NavitMain(this, NavitLanguage, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density,
- NAVIT_DATA_DIR+"/bin/navit",map_filename_path);
+ NAVIT_DATA_DIR + "/bin/navit", map_filename_path);
showInfos();
@@ -413,7 +425,7 @@ public class Navit extends Activity {
Log.d(TAG, "**2**A " + startup_intent.getAction());
Log.d(TAG, "**2**D " + startup_intent.getDataString());
String navi_scheme = startup_intent.getScheme();
- if ( navi_scheme != null && navi_scheme.equals("google.navigation")) {
+ if (navi_scheme != null && navi_scheme.equals("google.navigation")) {
parseNavigationURI(startup_intent.getData().getSchemeSpecificPart());
}
} else {
@@ -424,10 +436,11 @@ public class Navit extends Activity {
if (show_soft_keyboard_now_showing) {
/* Calling showNativeKeyboard() directly won't work here, we need to use the message queue */
View cf = getCurrentFocus();
- if (cf == null)
+ if (cf == null) {
Log.e(TAG, "no view in focus, can't get a handler");
- else
+ } else {
cf.getHandler().post(new SoftInputRestorer());
+ }
}
}
@@ -445,23 +458,24 @@ public class Navit extends Activity {
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
- case MY_PERMISSIONS_REQUEST_ALL: {
- if (grantResults.length > 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED
- && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
- return;
- }
- AlertDialog.Builder infobox = new AlertDialog.Builder(this);
- infobox.setTitle(getTstring(R.string.permissions_info_box_title)); // TRANS
- infobox.setCancelable(false);
- infobox.setMessage(getTstring(R.string.permissions_not_granted));
- // TRANS
- infobox.setPositiveButton(getTstring(R.string.initial_info_box_OK), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- exit();
+ case MY_PERMISSIONS_REQUEST_ALL: {
+ if (grantResults.length > 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED
+ && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
+ return;
}
- });
- infobox.show();
- }
+ AlertDialog.Builder infobox = new AlertDialog.Builder(this);
+ infobox.setTitle(getTstring(R.string.permissions_info_box_title)); // TRANS
+ infobox.setCancelable(false);
+ infobox.setMessage(getTstring(R.string.permissions_not_granted));
+ // TRANS
+ infobox.setPositiveButton(getTstring(R.string.initial_info_box_OK),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ exit();
+ }
+ });
+ infobox.show();
+ }
}
}
@@ -469,7 +483,7 @@ public class Navit extends Activity {
String[] naviData = schemeSpecificPart.split("&");
Pattern p = Pattern.compile("(.*)=(.*)");
Map<String,String> params = new HashMap<String,String>();
- for (int count=0; count < naviData.length; count++) {
+ for (int count = 0; count < naviData.length; count++) {
Matcher m = p.matcher(naviData[count]);
if (m.matches()) {
@@ -489,12 +503,14 @@ public class Navit extends Activity {
String geoString = params.get("ll");
if (geoString != null) {
String address = params.get("q");
- if (address != null) b.putString("q", address);
+ if (address != null) {
+ b.putString("q", address);
+ }
} else {
geoString = params.get("q");
}
- if ( geoString != null) {
+ if (geoString != null) {
if (geoString.matches("^[+-]{0,1}\\d+(|\\.\\d*),[+-]{0,1}\\d+(|\\.\\d*)$")) {
String[] geo = geoString.split(",");
if (geo.length == 2) {
@@ -503,7 +519,8 @@ public class Navit extends Activity {
lon = Float.valueOf(geo[1]);
b.putFloat("lat", lat);
b.putFloat("lon", lon);
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
+ Message msg = Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
msg.setData(b);
msg.sendToTarget();
@@ -544,8 +561,9 @@ public class Navit extends Activity {
menu.add(1, 99, 900, getTstring(R.string.optionsmenu_exit_navit)); //TRANS
/* Only show the Backup to SD-Card Option if we really have one */
- if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
+ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
menu.add(1, 7, 700, getTstring(R.string.optionsmenu_backup_restore)); //TRANS
+ }
return true;
}
@@ -571,7 +589,7 @@ public class Navit extends Activity {
if (target_address == null || target_address.equals("")) {
// empty search string entered
Toast.makeText(getApplicationContext(), getTstring(R.string.address_search_not_found),
- Toast.LENGTH_LONG).show(); //TRANS
+ Toast.LENGTH_LONG).show(); //TRANS
} else {
Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
search_intent.putExtra("search_string", target_address);
@@ -587,62 +605,65 @@ public class Navit extends Activity {
public void runOptionsItem(int id) {
switch (id) {
- case 1 :
- // zoom in
- Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_IN.ordinal()).sendToTarget();
- // if we zoom, hide the bubble
- Log.d(TAG, "onOptionsItemSelected -> zoom in");
- break;
- case 2 :
- // zoom out
- Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_OUT.ordinal()).sendToTarget();
- // if we zoom, hide the bubble
- Log.d(TAG, "onOptionsItemSelected -> zoom out");
- break;
- case 3 :
- // map download menu
- Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
- startActivityForResult(map_download_list_activity, Navit.NavitDownloaderSelectMap_id);
- break;
- case 5 :
- // toggle the normal POI layers and labels (to avoid double POIs)
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- Bundle b = new Bundle();
- b.putString("cmd", "toggle_layer(\"POI Symbols\");");
- msg.setData(b);
- msg.sendToTarget();
-
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- b = new Bundle();
- b.putString("cmd", "toggle_layer(\"POI Labels\");");
- msg.setData(b);
- msg.sendToTarget();
-
- // toggle full POI icons on/off
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- b = new Bundle();
- b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");");
- msg.setData(b);
- msg.sendToTarget();
-
- break;
- case 6 :
- // ok startup address search activity
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
- break;
- case 7 :
- /* Backup / Restore */
- showDialog(NavitDialogs.DIALOG_BACKUP_RESTORE);
- break;
- case 10:
- setMapLocation();
- break;
- case 99 :
- // exit
- this.onStop();
- this.exit();
- break;
+ case 1 :
+ // zoom in
+ Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_ZOOM_IN.ordinal()).sendToTarget();
+ // if we zoom, hide the bubble
+ Log.d(TAG, "onOptionsItemSelected -> zoom in");
+ break;
+ case 2 :
+ // zoom out
+ Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_ZOOM_OUT.ordinal()).sendToTarget();
+ // if we zoom, hide the bubble
+ Log.d(TAG, "onOptionsItemSelected -> zoom out");
+ break;
+ case 3 :
+ // map download menu
+ Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
+ startActivityForResult(map_download_list_activity, Navit.NavitDownloaderSelectMap_id);
+ break;
+ case 5 :
+ // toggle the normal POI layers and labels (to avoid double POIs)
+ Message msg = Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ Bundle b = new Bundle();
+ b.putString("cmd", "toggle_layer(\"POI Symbols\");");
+ msg.setData(b);
+ msg.sendToTarget();
+
+ msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ b = new Bundle();
+ b.putString("cmd", "toggle_layer(\"POI Labels\");");
+ msg.setData(b);
+ msg.sendToTarget();
+
+ // toggle full POI icons on/off
+ msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ b = new Bundle();
+ b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");");
+ msg.setData(b);
+ msg.sendToTarget();
+
+ break;
+ case 6 :
+ // ok startup address search activity
+ Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
+ this.startActivityForResult(search_intent, NavitAddressSearch_id);
+ break;
+ case 7 :
+ /* Backup / Restore */
+ showDialog(NavitDialogs.DIALOG_BACKUP_RESTORE);
+ break;
+ case 10:
+ setMapLocation();
+ break;
+ case 99 :
+ // exit
+ this.onStop();
+ this.exit();
+ break;
}
}
@@ -670,9 +691,10 @@ public class Navit extends Activity {
*/
Configuration config = getResources().getConfiguration();
if ((config.keyboard == Configuration.KEYBOARD_QWERTY)
- && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO))
+ && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)) {
/* physical keyboard present, exit */
return 0;
+ }
/* Use SHOW_FORCED here, else keyboard won't show in landscape mode */
mgr.showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED);
@@ -688,8 +710,9 @@ public class Navit extends Activity {
int height_ = display_.getHeight();
int maxHeight = height_ * 47 / 100;
int inputHeight = width_ * 63 / 100;
- if (inputHeight > (maxHeight))
+ if (inputHeight > (maxHeight)) {
inputHeight = maxHeight;
+ }
/* the receiver isn't going to fire before the UI thread becomes idle, well after this method returns */
Log.d(TAG, "showNativeKeyboard:return (assuming true)");
@@ -707,10 +730,11 @@ public class Navit extends Activity {
void setDestination(float latitude, float longitude, String address) {
- Toast.makeText( getApplicationContext(),getTstring(R.string.address_search_set_destination) + "\n" + address,
- Toast.LENGTH_LONG).show(); //TRANS
+ Toast.makeText(getApplicationContext(),getTstring(R.string.address_search_set_destination) + "\n" + address,
+ Toast.LENGTH_LONG).show(); //TRANS
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
+ Message msg = Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
Bundle b = new Bundle();
b.putFloat("lat", latitude);
b.putFloat("lon", longitude);
@@ -721,44 +745,49 @@ public class Navit extends Activity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
- case Navit.NavitDownloaderSelectMap_id :
- if (resultCode == Activity.RESULT_OK) {
- Message msg = dialogs.obtainMessage(NavitDialogs.MSG_START_MAP_DOWNLOAD
- , data.getIntExtra("map_index", -1), 0);
- msg.sendToTarget();
- }
- break;
- case NavitAddressSearch_id :
- if (resultCode == Activity.RESULT_OK) {
- Bundle destination = data.getExtras();
- Toast.makeText( getApplicationContext(),
- getTstring(R.string.address_search_set_destination) + "\n" + destination.getString(("q")),
- Toast.LENGTH_LONG).show(); //TRANS
-
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
- msg.setData(destination);
- msg.sendToTarget();
- }
- break;
- case NavitSelectStorage_id :
- if(resultCode == RESULT_OK) {
- String newDir = data.getStringExtra(FileBrowserActivity.returnDirectoryParameter);
- Log.d(TAG, "selected path= "+newDir);
- if(!newDir.contains("/navit"))
- newDir = newDir+"/navit/";
- else
- newDir = newDir+"/";
- SharedPreferences prefs = this.getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- SharedPreferences.Editor prefs_editor = prefs.edit();
- prefs_editor.putString("filenamePath", newDir);
- prefs_editor.apply();
-
- Toast.makeText(this, String.format(getTstring(R.string.map_location_changed),newDir),Toast.LENGTH_LONG).show();
- } else Log.w(TAG, "select path failed");
- break;
- default :
- ActivityResults[requestCode].onActivityResult(requestCode, resultCode, data);
- break;
+ case Navit.NavitDownloaderSelectMap_id :
+ if (resultCode == Activity.RESULT_OK) {
+ Message msg = dialogs.obtainMessage(NavitDialogs.MSG_START_MAP_DOWNLOAD,
+ data.getIntExtra("map_index", -1), 0);
+ msg.sendToTarget();
+ }
+ break;
+ case NavitAddressSearch_id :
+ if (resultCode == Activity.RESULT_OK) {
+ Bundle destination = data.getExtras();
+ Toast.makeText(getApplicationContext(),
+ getTstring(R.string.address_search_set_destination) + "\n" + destination.getString(("q")),
+ Toast.LENGTH_LONG).show(); //TRANS
+
+ Message msg = Message.obtain(N_NavitGraphics.callback_handler,
+ NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
+ msg.setData(destination);
+ msg.sendToTarget();
+ }
+ break;
+ case NavitSelectStorage_id :
+ if (resultCode == RESULT_OK) {
+ String newDir = data.getStringExtra(FileBrowserActivity.returnDirectoryParameter);
+ Log.d(TAG, "selected path= " + newDir);
+ if (!newDir.contains("/navit")) {
+ newDir = newDir + "/navit/";
+ } else {
+ newDir = newDir + "/";
+ }
+ SharedPreferences prefs = this.getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
+ SharedPreferences.Editor prefs_editor = prefs.edit();
+ prefs_editor.putString("filenamePath", newDir);
+ prefs_editor.apply();
+
+ Toast.makeText(this, String.format(getTstring(R.string.map_location_changed),newDir),
+ Toast.LENGTH_LONG).show();
+ } else {
+ Log.w(TAG, "select path failed");
+ }
+ break;
+ default :
+ ActivityResults[requestCode].onActivityResult(requestCode, resultCode, data);
+ break;
}
}
@@ -784,8 +813,8 @@ public class Navit extends Activity {
private void setMapLocation() {
Intent fileExploreIntent = new Intent(this,FileBrowserActivity.class);
fileExploreIntent
- .putExtra(FileBrowserActivity.startDirectoryParameter, "/mnt")
- .setAction(FileBrowserActivity.INTENT_ACTION_SELECT_DIR);
+ .putExtra(FileBrowserActivity.startDirectoryParameter, "/mnt")
+ .setAction(FileBrowserActivity.INTENT_ACTION_SELECT_DIR);
startActivityForResult(fileExploreIntent,NavitSelectStorage_id);
}
@@ -837,7 +866,8 @@ public class Navit extends Activity {
}
public native void NavitMain(Navit x, String lang, int version, String display_density_string, String path,
- String path2);
+ String path2);
+
public native void NavitDestroy();
diff --git a/navit/android/src/org/navitproject/navit/NavitActivityResult.java b/navit/android/src/org/navitproject/navit/NavitActivityResult.java
index f52f06c9c..7d3ef8cb4 100644
--- a/navit/android/src/org/navitproject/navit/NavitActivityResult.java
+++ b/navit/android/src/org/navitproject/navit/NavitActivityResult.java
@@ -4,4 +4,4 @@ import android.content.Intent;
public interface NavitActivityResult {
public void onActivityResult(int requestCode, int resultCode, Intent data);
-};
+}
diff --git a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
index ef5f7ed52..5905433d6 100644
--- a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
@@ -107,14 +107,15 @@ public class NavitAddressSearchActivity extends Activity {
// reinvent the wheel here to show an image in android native interface.
int[] flag_icon_sizes = {24,32,48,64,96};
int exact_size, nearest_size;
- exact_size = (int)(Navit.metrics.density*24.0 -.5);
+ exact_size = (int)(Navit.metrics.density * 24.0 - .5);
nearest_size = flag_icon_sizes[0];
- for(int size: flag_icon_sizes) {
+ for (int size: flag_icon_sizes) {
nearest_size = size;
- if(exact_size <= size)
+ if (exact_size <= size) {
break;
+ }
}
- mCountryButton.setImageResource(getDrawableID("country_" + mCountry+"_"+nearest_size+"_"+nearest_size));
+ mCountryButton.setImageResource(getDrawableID("country_" + mCountry + "_" + nearest_size + "_" + nearest_size));
}
@@ -123,7 +124,7 @@ public class NavitAddressSearchActivity extends Activity {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
- if ( extras != null ) {
+ if (extras != null) {
String search_string = extras.getString(("search_string"));
if (search_string != null) {
mPartialSearch = true;
@@ -206,7 +207,7 @@ public class NavitAddressSearchActivity extends Activity {
strAddresses[addrIndex] = addresses.get(addrIndex).addr;
}
ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strAddresses);
+ new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strAddresses);
lastAddresses.setAdapter(addressList);
lastAddresses.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
@@ -271,7 +272,7 @@ public class NavitAddressSearchActivity extends Activity {
}
});
- AlertDialog d=mapModeChooser.create();
+ AlertDialog d = mapModeChooser.create();
d.getListView().setFastScrollEnabled(true);
d.show();
}
@@ -283,21 +284,21 @@ public class NavitAddressSearchActivity extends Activity {
Log.e(TAG, "(" + String.valueOf(latitude) + ", " + String.valueOf(longitude) + ") " + address);
switch (type) {
- case 0:
- search_results_towns++;
- break;
- case 1:
- search_results_streets++;
- break;
- case 2:
- search_results_streets_hn++;
- break;
+ case 0:
+ search_results_towns++;
+ break;
+ case 1:
+ search_results_streets++;
+ break;
+ case 2:
+ search_results_streets_hn++;
+ break;
}
- search_results_wait.setMessage(Navit.getInstance().getTstring(R.string.address_search_towns) + ":" +
- search_results_towns + " "
- + Navit.getInstance().getTstring(R.string.address_search_streets) + ":" + search_results_streets + "/"
- + search_results_streets_hn);
+ search_results_wait.setMessage(Navit.getInstance().getTstring(R.string.address_search_towns) + ":"
+ + search_results_towns + " "
+ + Navit.getInstance().getTstring(R.string.address_search_streets) + ":" + search_results_streets + "/"
+ + search_results_streets_hn);
search_results_wait.setProgress(Addresses_found.size() % (ADDRESS_RESULT_PROGRESS_MAX + 1));
@@ -306,15 +307,16 @@ public class NavitAddressSearchActivity extends Activity {
public void finishAddressSearch() {
if (Addresses_found.isEmpty()) {
- Toast.makeText( getApplicationContext(),getString(R.string.address_search_not_found) + "\n" + mAddressString,
- Toast.LENGTH_LONG).show(); //TRANS
+ // TRANS
+ Toast.makeText(getApplicationContext(),
+ getString(R.string.address_search_not_found) + "\n" + mAddressString, Toast.LENGTH_LONG).show();
setResult(Activity.RESULT_CANCELED);
finish();
}
ListView addressesFound = new ListView(this);
addressesFound.setFastScrollEnabled(true);
ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
+ new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
addresses_shown = new ArrayList<NavitAddress>();
@@ -346,6 +348,7 @@ public class NavitAddressSearchActivity extends Activity {
}
public native long CallbackStartAddressSearch(int partial_match, String country, String s);
+
public native void CallbackCancelAddressSearch(long handle);
@Override
diff --git a/navit/android/src/org/navitproject/navit/NavitAppConfig.java b/navit/android/src/org/navitproject/navit/NavitAppConfig.java
index fe87b26c8..22c310f70 100755
--- a/navit/android/src/org/navitproject/navit/NavitAppConfig.java
+++ b/navit/android/src/org/navitproject/navit/NavitAppConfig.java
@@ -40,7 +40,9 @@ public class NavitAppConfig extends Application {
addr_str));
}
- if (--index < 0) index = MAX_LAST_ADDRESSES - 1;
+ if (--index < 0) {
+ index = MAX_LAST_ADDRESSES - 1;
+ }
} while (index != mLastAddressField);
}
@@ -52,10 +54,14 @@ public class NavitAppConfig extends Application {
getLastAddresses();
mLastAddresses.add(newAddress);
- if (mLastAddresses.size() > MAX_LAST_ADDRESSES) mLastAddresses.remove(0);
+ if (mLastAddresses.size() > MAX_LAST_ADDRESSES) {
+ mLastAddresses.remove(0);
+ }
mLastAddressField++;
- if (mLastAddressField >= MAX_LAST_ADDRESSES) mLastAddressField = 0;
+ if (mLastAddressField >= MAX_LAST_ADDRESSES) {
+ mLastAddressField = 0;
+ }
SharedPreferences.Editor editSettings = mSettings.edit();
diff --git a/navit/android/src/org/navitproject/navit/NavitBackupTask.java b/navit/android/src/org/navitproject/navit/NavitBackupTask.java
index 93d0c4c33..c3fbe0517 100644
--- a/navit/android/src/org/navitproject/navit/NavitBackupTask.java
+++ b/navit/android/src/org/navitproject/navit/NavitBackupTask.java
@@ -39,7 +39,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* This is the Directory where all Subdirectories are stored by date */
File mainBackupDir = new File(
- Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
+ Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
/* Create the Main Backup Directory if it doesn't exist */
if (!mainBackupDir.isDirectory()) {
@@ -50,7 +50,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* Create a Timestamp in the format YYYY-MM-DD-Index */
String timestamp = now.year + "-" + String.format("%02d", now.month + 1) + "-" + String
- .format("%02d", now.monthDay);
+ .format("%02d", now.monthDay);
/* Get the next free index */
int index = 1;
for (String s : mainBackupDir.list()) {
@@ -65,7 +65,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* This is the Directory in which the Files are copied into */
File backupDir = new File(
- Environment.getExternalStorageDirectory().getPath() + "/navit/backup/" + timestamp);
+ Environment.getExternalStorageDirectory().getPath() + "/navit/backup/" + timestamp);
/* Create the Backup Directory if it doesn't exist */
if (!backupDir.isDirectory()) {
@@ -78,18 +78,18 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
try {
/* Backup Files in home */
mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt",
- backupDir.getPath() + "/bookmark.txt");
+ backupDir.getPath() + "/bookmark.txt");
mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/destination.txt",
- backupDir.getPath() + "/destination.txt");
+ backupDir.getPath() + "/destination.txt");
mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt",
- backupDir.getPath() + "/gui_internal.txt");
+ backupDir.getPath() + "/gui_internal.txt");
/* Backup Shared Preferences */
preferencesOOs = new ObjectOutputStream(
- new FileOutputStream(backupDir.getPath() + "/preferences.bak"));
+ new FileOutputStream(backupDir.getPath() + "/preferences.bak"));
preferencesOOs.writeObject(
- mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE)
- .getAll());
+ mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE)
+ .getAll());
} catch (IOException e) {
e.printStackTrace();
return mActivity.getTstring(R.string.backup_failed);
@@ -122,14 +122,14 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
}
Toast.makeText(mActivity, mActivity.getTstring(R.string.backup_successful),
- Toast.LENGTH_LONG).show();
+ Toast.LENGTH_LONG).show();
}
@Override
protected void onCancelled() {
super.onCancelled();
Toast.makeText(mActivity, mActivity.getTstring(R.string.backup_failed), Toast.LENGTH_LONG)
- .show();
+ .show();
mDialog.dismiss();
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitCamera.java b/navit/android/src/org/navitproject/navit/NavitCamera.java
index a10150c48..709686b97 100644
--- a/navit/android/src/org/navitproject/navit/NavitCamera.java
+++ b/navit/android/src/org/navitproject/navit/NavitCamera.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.navitproject.navit;
import android.content.Context;
@@ -69,7 +70,7 @@ public class NavitCamera extends SurfaceView implements SurfaceHolder.Callback {
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Now that the size is known, set up the camera parameters and begin
// the preview.
- Log.e("NavitCamera","surfaceChanged "+w+"x"+h);
+ Log.e("NavitCamera","surfaceChanged " + w + "x" + h);
mCamera.stopPreview();
Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(w, h);
diff --git a/navit/android/src/org/navitproject/navit/NavitDialogs.java b/navit/android/src/org/navitproject/navit/NavitDialogs.java
index 2b28b57d5..41cac61da 100644
--- a/navit/android/src/org/navitproject/navit/NavitDialogs.java
+++ b/navit/android/src/org/navitproject/navit/NavitDialogs.java
@@ -12,7 +12,6 @@ import android.os.Message;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Toast;
-
import java.io.File;
public class NavitDialogs extends Handler {
@@ -41,10 +40,9 @@ public class NavitDialogs extends Handler {
}
static public void sendDialogMessage(int what, String title, String text, int dialog_num,
- int value1, int value2) {
+ int value1, int value2) {
Message msg = mHandler.obtainMessage(what);
Bundle data = new Bundle();
-
data.putString("title", title);
data.putString("text", text);
data.putInt("value1", value1);
@@ -58,65 +56,61 @@ public class NavitDialogs extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
- case MSG_MAP_DOWNLOAD_FINISHED: {
- // dismiss dialog, remove dialog
- mActivity.dismissDialog(DIALOG_MAPDOWNLOAD);
- mActivity.removeDialog(DIALOG_MAPDOWNLOAD);
- if (msg.getData().getInt("value1") == 1) {
- Message msg_out =
- Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_LOAD_MAP.ordinal());
- msg_out.setData(msg.getData());
- msg_out.sendToTarget();
-
- msg_out = Message
- .obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- Bundle b = new Bundle();
- int mi = msg.getData().getInt("value2");
- double lon = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lon1) + Double
- .parseDouble(NavitMapDownloader.osm_maps[mi].lon2)) / 2.0;
- double lat = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lat1) + Double
- .parseDouble(NavitMapDownloader.osm_maps[mi].lat2)) / 2.0;
- b.putString("cmd", "set_center(\"" + lon + " " + lat + "\",1); zoom=256");
- msg_out.setData(b);
- msg_out.sendToTarget();
+ case MSG_MAP_DOWNLOAD_FINISHED: {
+ // dismiss dialog, remove dialog
+ mActivity.dismissDialog(DIALOG_MAPDOWNLOAD);
+ mActivity.removeDialog(DIALOG_MAPDOWNLOAD);
+ if (msg.getData().getInt("value1") == 1) {
+ Message msg_out = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
+ NavitGraphics.msg_type.CLB_LOAD_MAP.ordinal());
+ msg_out.setData(msg.getData());
+ msg_out.sendToTarget();
+
+ msg_out = Message
+ .obtain(Navit.getInstance().getNavitGraphics().callback_handler,
+ NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ Bundle b = new Bundle();
+ int mi = msg.getData().getInt("value2");
+ double lon = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lon1) + Double
+ .parseDouble(NavitMapDownloader.osm_maps[mi].lon2)) / 2.0;
+ double lat = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lat1) + Double
+ .parseDouble(NavitMapDownloader.osm_maps[mi].lat2)) / 2.0;
+ b.putString("cmd", "set_center(\"" + lon + " " + lat + "\",1); zoom=256");
+ msg_out.setData(b);
+ msg_out.sendToTarget();
+ }
+ break;
}
- break;
- }
- case MSG_PROGRESS_BAR:
- // change progressbar values
- mapdownloader_dialog.setMax(msg.getData().getInt("value1"));
- mapdownloader_dialog.setProgress(msg.getData().getInt("value2"));
- mapdownloader_dialog.setTitle(msg.getData().getString(("title")));
- mapdownloader_dialog.setMessage(msg.getData().getString(("text")));
- break;
- case MSG_TOAST:
- Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_SHORT)
- .show();
- break;
- case MSG_TOAST_LONG:
- Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_LONG)
- .show();
- break;
- case MSG_START_MAP_DOWNLOAD: {
- int download_map_id = msg.arg1;
- Log.d(TAG, "PRI id=" + download_map_id);
- // set map id to download
-
- // show the map download progressbar, and download the map
- if (download_map_id > -1) {
- mapdownloader = new NavitMapDownloader(download_map_id);
- mActivity.showDialog(NavitDialogs.DIALOG_MAPDOWNLOAD);
- mapdownloader.start();
+ case MSG_PROGRESS_BAR:
+ // change progressbar values
+ mapdownloader_dialog.setMax(msg.getData().getInt("value1"));
+ mapdownloader_dialog.setProgress(msg.getData().getInt("value2"));
+ mapdownloader_dialog.setTitle(msg.getData().getString(("title")));
+ mapdownloader_dialog.setMessage(msg.getData().getString(("text")));
+ break;
+ case MSG_TOAST:
+ Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_SHORT).show();
+ break;
+ case MSG_TOAST_LONG:
+ Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_LONG).show();
+ break;
+ case MSG_START_MAP_DOWNLOAD: {
+ int download_map_id = msg.arg1;
+ Log.d(TAG, "PRI id=" + download_map_id);
+ // set map id to download
+ // show the map download progressbar, and download the map
+ if (download_map_id > -1) {
+ mapdownloader = new NavitMapDownloader(download_map_id);
+ mActivity.showDialog(NavitDialogs.DIALOG_MAPDOWNLOAD);
+ mapdownloader.start();
+ }
}
- }
- break;
- case MSG_REMOVE_DIALOG_GENERIC:
- // dismiss dialog, remove dialog - generic
- mActivity.dismissDialog(msg.getData().getInt("dialog_num"));
- mActivity.removeDialog(msg.getData().getInt("dialog_num"));
- break;
+ break;
+ case MSG_REMOVE_DIALOG_GENERIC:
+ // dismiss dialog, remove dialog - generic
+ mActivity.dismissDialog(msg.getData().getInt("dialog_num"));
+ mActivity.removeDialog(msg.getData().getInt("dialog_num"));
+ break;
}
}
@@ -124,90 +118,89 @@ public class NavitDialogs extends Handler {
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
switch (id) {
- case DIALOG_MAPDOWNLOAD:
- mapdownloader_dialog = new ProgressDialog(mActivity);
- mapdownloader_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- mapdownloader_dialog.setTitle("--");
- mapdownloader_dialog.setMessage("--");
- mapdownloader_dialog.setCancelable(true);
- mapdownloader_dialog.setProgress(0);
- mapdownloader_dialog.setMax(200);
- DialogInterface.OnDismissListener onDismissListener = new DialogInterface.OnDismissListener() {
- public void onDismiss(DialogInterface dialog) {
- Log.e(TAG, "onDismiss: mapdownloader_dialog");
- if (mapdownloader != null) {
- mapdownloader.stop_thread();
- }
- }
- };
- mapdownloader_dialog.setOnDismissListener(onDismissListener);
- // show license for OSM maps
- Toast.makeText(mActivity.getApplicationContext(),
- Navit.getInstance().getString(R.string.osm_copyright),
- Toast.LENGTH_LONG).show();
- return mapdownloader_dialog;
-
- case DIALOG_BACKUP_RESTORE:
- /* Create a Dialog that Displays Options wether to Backup or Restore */
- builder.setTitle(mActivity.getTstring(R.string.choose_an_action)).
- setCancelable(true).
- setItems(R.array.dialog_backup_restore_items,
- new DialogInterface.OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- /* Notify User if no SD Card present */
- if (!Environment.getExternalStorageState()
- .equals(Environment.MEDIA_MOUNTED)) {
- Toast.makeText(mActivity, mActivity
- .getTstring(R.string.please_insert_an_sd_card),
- Toast.LENGTH_LONG).show();
+ case DIALOG_MAPDOWNLOAD:
+ mapdownloader_dialog = new ProgressDialog(mActivity);
+ mapdownloader_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mapdownloader_dialog.setTitle("--");
+ mapdownloader_dialog.setMessage("--");
+ mapdownloader_dialog.setCancelable(true);
+ mapdownloader_dialog.setProgress(0);
+ mapdownloader_dialog.setMax(200);
+ DialogInterface.OnDismissListener onDismissListener = new DialogInterface.OnDismissListener() {
+ public void onDismiss(DialogInterface dialog) {
+ Log.e(TAG, "onDismiss: mapdownloader_dialog");
+ if (mapdownloader != null) {
+ mapdownloader.stop_thread();
+ }
}
+ };
+ mapdownloader_dialog.setOnDismissListener(onDismissListener);
+ // show license for OSM maps
+ Toast.makeText(mActivity.getApplicationContext(),
+ Navit.getInstance().getString(R.string.osm_copyright),
+ Toast.LENGTH_LONG).show();
+ return mapdownloader_dialog;
+
+ case DIALOG_BACKUP_RESTORE:
+ /* Create a Dialog that Displays Options wether to Backup or Restore */
+ builder.setTitle(mActivity.getTstring(R.string.choose_an_action)).
+ setCancelable(true).
+ setItems(R.array.dialog_backup_restore_items,
+ new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ /* Notify User if no SD Card present */
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ Toast.makeText(mActivity, mActivity
+ .getTstring(R.string.please_insert_an_sd_card),
+ Toast.LENGTH_LONG).show();
+ }
+
+ switch (which) {
+ case 0:
+ /* Backup */
+ new NavitBackupTask(mActivity).execute();
+ break;
+ case 1:
+ /* Restore */
+ mActivity.showDialog(DIALOG_SELECT_BACKUP);
+ break;
+ }
+ }
+ });
+ return builder.create();
- switch (which) {
- case 0:
- /* Backup */
- new NavitBackupTask(mActivity).execute();
- break;
- case 1:
- /* Restore */
- mActivity.showDialog(DIALOG_SELECT_BACKUP);
- break;
- }
+ case DIALOG_SELECT_BACKUP:
+ /* Create a Dialog with a list from which the user selects the Backup to be restored */
+ File mainBackupDir = new File(
+ Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
+
+ String[] backups = null;
+ if (mainBackupDir.isDirectory()) {
+ backups = mainBackupDir.list();
}
- });
- return builder.create();
- case DIALOG_SELECT_BACKUP:
- /* Create a Dialog with a list from which the user selects the Backup to be restored */
- File mainBackupDir = new File(
- Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
+ if (backups == null || backups.length == 0) {
+ /* No Backups were found */
+ builder.setTitle(mActivity.getTstring(R.string.no_backup_found));
+ builder.setNegativeButton(mActivity.getTstring(android.R.string.cancel), null);
+ return builder.create();
+ }
- String[] backups = null;
- if (mainBackupDir.isDirectory()) {
- backups = mainBackupDir.list();
- }
+ builder.setTitle(mActivity.getTstring(R.string.select_backup));
+ final ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity,
+ android.R.layout.simple_spinner_item, backups);
+ builder.setAdapter(adapter, new OnClickListener() {
- if (backups == null || backups.length == 0) {
- /* No Backups were found */
- builder.setTitle(mActivity.getTstring(R.string.no_backup_found));
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ new NavitRestoreTask(mActivity, adapter.getItem(which)).execute();
+ }
+ });
builder.setNegativeButton(mActivity.getTstring(android.R.string.cancel), null);
- return builder.create();
- }
-
- builder.setTitle(mActivity.getTstring(R.string.select_backup));
- final ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity,
- android.R.layout.simple_spinner_item, backups);
- builder.setAdapter(adapter, new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- new NavitRestoreTask(mActivity, adapter.getItem(which)).execute();
- }
- });
- builder.setNegativeButton(mActivity.getTstring(android.R.string.cancel), null);
-
- return builder.create();
+ return builder.create();
}
// should never get here!!
return null;
diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
index 10805d467..bb66a8df7 100644
--- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
@@ -60,12 +60,12 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
setTitle(String.valueOf(getFreeSpace() / 1024 / 1024) + "MB available");
} catch (Exception e) {
Log.e(TAG, "Exception " + e.getClass().getName()
- + " during getFreeSpace, reporting 'no sdcard present'");
+ + " during getFreeSpace, reporting 'no sdcard present'");
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- String.format(
- (Navit.getInstance().getTstring(R.string.map_location_unavailable)),
- Navit.map_filename_path),
- -1, 0, 0);
+ String.format(
+ (Navit.getInstance().getTstring(R.string.map_location_unavailable)),
+ Navit.map_filename_path),
+ -1, 0, 0);
finish();
}
}
@@ -88,7 +88,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
private void updateMapsForLocation(NavitMapDownloader.osm_map_values[] osm_maps) {
Location currentLocation = NavitVehicle.lastLocation;
if (maps_current_position_childs.size() == 0 || (currentLocation != null
- && !currentLocationKnown)) {
+ && !currentLocationKnown)) {
if (currentLocation == null) {
LocationManager mapLocationManager = (LocationManager) getSystemService(
Context.LOCATION_SERVICE);
@@ -124,10 +124,9 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
currentMapIndex++) {
if (osm_maps[currentMapIndex].isInMap(currentLocation)) {
HashMap<String, String> currentPositionMapChild = new HashMap<String, String>();
- currentPositionMapChild
- .put("map_name", osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024)
- + "MB");
+ currentPositionMapChild.put("map_name", osm_maps[currentMapIndex].map_name + " "
+ + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024)
+ + "MB");
currentPositionMapChild.put("map_index", String.valueOf(currentMapIndex));
maps_current_position_childs.add(currentPositionMapChild);
@@ -143,12 +142,12 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
ArrayList<HashMap<String, String>> resultGroups = new ArrayList<HashMap<String, String>>();
ArrayList<ArrayList<HashMap<String, String>>> resultChilds =
- new ArrayList<ArrayList<HashMap<String, String>>>();
+ new ArrayList<ArrayList<HashMap<String, String>>>();
// 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.getInstance().getTstring(R.string.maps_installed));
+ .put("category_name", Navit.getInstance().getTstring(R.string.maps_installed));
resultGroups.add(downloaded_maps_hash);
downloaded_maps_childs = new ArrayList<HashMap<String, String>>();
resultChilds.add(downloaded_maps_childs);
@@ -158,7 +157,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
// maps containing the current location
HashMap<String, String> matching_maps = new HashMap<String, String>();
matching_maps.put("category_name",
- Navit.getInstance().getTstring(R.string.maps_for_current_location));
+ Navit.getInstance().getTstring(R.string.maps_for_current_location));
resultGroups.add(matching_maps);
resultChilds.add(maps_current_position_childs);
@@ -176,8 +175,8 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
HashMap<String, String> child = new HashMap<String, String>();
child.put("map_name", (osm_maps[currentMapIndex].level > 1 ? MAP_BULLETPOINT : "")
- + osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024) + "MB");
+ + osm_maps[currentMapIndex].map_name + " "
+ + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024) + "MB");
child.put("map_index", String.valueOf(currentMapIndex));
secList.add(child);
@@ -185,29 +184,28 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
resultChilds.add(secList);
return new SimpleExpandableListAdapter(this, resultGroups,
- android.R.layout.simple_expandable_list_item_1,
- new String[] {"category_name"}, new int[] {android.R.id.text1}, resultChilds,
- android.R.layout.simple_expandable_list_item_1, new String[] {"map_name"},
- new int[] {android.R.id.text1});
+ android.R.layout.simple_expandable_list_item_1,
+ new String[] {"category_name"}, new int[] {android.R.id.text1}, resultChilds,
+ android.R.layout.simple_expandable_list_item_1, new String[] {"map_name"},
+ new int[] {android.R.id.text1});
}
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
- int childPosition, long id) {
+ int childPosition, long id) {
super.onChildClick(parent, v, groupPosition, childPosition, id);
Log.d(TAG, "p:" + groupPosition + ", child_pos:" + childPosition);
@SuppressWarnings("unchecked")
- HashMap<String, String> child = (HashMap<String, String>) adapter
- .getChild(groupPosition, childPosition);
+ HashMap<String, String> child = (HashMap<String, String>) adapter.getChild(groupPosition, childPosition);
String map_index = child.get("map_index");
if (map_index != null) {
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.getInstance().getTstring(R.string.map_download_oversize),
- -1, 0, 0);
+ Navit.getInstance().getTstring(R.string.map_download_oversize),
+ -1, 0, 0);
return true;
}
Intent resultIntent = new Intent();
@@ -228,33 +226,31 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
NavitMap maptoDelete = new NavitMap(map_location);
deleteMapBox.setMessage(
- maptoDelete.mapName + " " + String.valueOf(maptoDelete.size() / 1024 / 1024)
- + "MB");
+ maptoDelete.mapName + " " + String.valueOf(maptoDelete.size() / 1024 / 1024)
+ + "MB");
// TRANS
deleteMapBox.setPositiveButton(Navit.getInstance().getTstring(R.string.yes),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.d(TAG, "Delete Map");
- Message msg =
- Message.obtain(
- Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
- Bundle b = new Bundle();
- b.putString("title", map_location);
- msg.setData(b);
- msg.sendToTarget();
- finish();
- }
- });
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ Log.d(TAG, "Delete Map");
+ Message msg = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
+ NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
+ Bundle b = new Bundle();
+ b.putString("title", map_location);
+ msg.setData(b);
+ msg.sendToTarget();
+ finish();
+ }
+ });
// TRANS
deleteMapBox.setNegativeButton((Navit.getInstance().getTstring(R.string.no)),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.d(TAG, "don't delete map");
- }
- });
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ 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 d5c0cbed8..ba6b87bde 100644
--- a/navit/android/src/org/navitproject/navit/NavitGraphics.java
+++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java
@@ -62,7 +62,8 @@ public class NavitGraphics {
private int pos_wraparound;
private int overlay_disabled;
private int bgcolor;
- private float trackball_x, trackball_y;
+ private float trackball_x;
+ private float trackball_y;
private View view;
private SystemBarTintView navigationTintView;
private SystemBarTintView statusTintView;
@@ -79,10 +80,12 @@ public class NavitGraphics {
public void setBackgroundColor(int bgcolor) {
this.bgcolor = bgcolor;
- if (navigationTintView != null)
+ if (navigationTintView != null) {
navigationTintView.setBackgroundColor(bgcolor);
- if (statusTintView != null)
+ }
+ if (statusTintView != null) {
statusTintView.setBackgroundColor(bgcolor);
+ }
}
private void SetCamera(int use_camera) {
@@ -95,25 +98,25 @@ public class NavitGraphics {
}
private Rect get_rect() {
- Rect ret=new Rect();
- ret.left=pos_x;
- ret.top=pos_y;
+ Rect ret = new Rect();
+ ret.left = pos_x;
+ ret.top = pos_y;
if (pos_wraparound != 0) {
if (ret.left < 0) {
- ret.left+=parent_graphics.bitmap_w;
+ ret.left += parent_graphics.bitmap_w;
}
if (ret.top < 0) {
- ret.top+=parent_graphics.bitmap_h;
+ ret.top += parent_graphics.bitmap_h;
}
}
- ret.right=ret.left+bitmap_w;
- ret.bottom=ret.top+bitmap_h;
+ ret.right = ret.left + bitmap_w;
+ ret.bottom = ret.top + bitmap_h;
if (pos_wraparound != 0) {
if (bitmap_w < 0) {
- ret.right=ret.left+bitmap_w+parent_graphics.bitmap_w;
+ ret.right = ret.left + bitmap_w + parent_graphics.bitmap_w;
}
if (bitmap_h < 0) {
- ret.bottom=ret.top+bitmap_h+parent_graphics.bitmap_h;
+ ret.bottom = ret.top + bitmap_h + parent_graphics.bitmap_h;
}
}
return ret;
@@ -146,19 +149,20 @@ public class NavitGraphics {
protected void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);
- menu.setHeaderTitle(activity.getTstring(R.string.position_popup_title)+"..");
- menu.add(1, 1, NONE, activity.getTstring(R.string.position_popup_drive_here)).setOnMenuItemClickListener(this);
+ menu.setHeaderTitle(activity.getTstring(R.string.position_popup_title) + "..");
+ menu.add(1, 1, NONE, activity.getTstring(R.string.position_popup_drive_here))
+ .setOnMenuItemClickListener(this);
menu.add(1, 2, NONE, activity.getTstring(R.string.cancel)).setOnMenuItemClickListener(this);
}
@Override
public boolean onMenuItemClick(MenuItem item) {
- switch(item.getItemId()) {
- case 1:
- Message msg = Message.obtain(callback_handler, msg_type.CLB_SET_DISPLAY_DESTINATION.ordinal()
- , (int)mPressedPosition.x, (int)mPressedPosition.y);
- msg.sendToTarget();
- break;
+ switch (item.getItemId()) {
+ case 1:
+ Message msg = Message.obtain(callback_handler, msg_type.CLB_SET_DISPLAY_DESTINATION.ordinal(),
+ (int)mPressedPosition.x, (int)mPressedPosition.y);
+ msg.sendToTarget();
+ break;
}
return false;
}
@@ -173,7 +177,7 @@ public class NavitGraphics {
in_map = true;
for (NavitGraphics overlay : overlays) {
if (overlay.overlay_disabled == 0) {
- Rect r=overlay.get_rect();
+ Rect r = overlay.get_rect();
canvas.drawBitmap(overlay.draw_bitmap, r.left, r.top, null);
}
}
@@ -193,8 +197,7 @@ public class NavitGraphics {
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
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);
+ Log.d(TAG, "onSizeChanged scaledDensity=" + Navit.metrics.scaledDensity);
super.onSizeChanged(w, h, oldw, oldh);
handleResize(w, h);
@@ -239,68 +242,72 @@ public class NavitGraphics {
if (switch_value == MotionEvent.ACTION_DOWN) {
touch_mode = PRESSED;
- if (!in_map) ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ if (!in_map) {
+ ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ }
mPressedPosition = new PointF(x, y);
postDelayed(this, time_for_long_press);
} else if ((switch_value == MotionEvent.ACTION_UP) || (switch_value == _ACTION_POINTER_UP_)) {
Log.d(TAG, "ACTION_UP");
switch (touch_mode) {
- case DRAG:
- Log.d(TAG, "onTouch move");
-
- MotionCallback(MotionCallbackID, x, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
-
- break;
- case ZOOM:
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = 0;
- if (newDist > 10f) {
- scale = newDist / oldDist;
- }
+ case DRAG:
+ Log.d(TAG, "onTouch move");
+
+ MotionCallback(MotionCallbackID, x, y);
+ ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
+
+ 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);
- } 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
+ 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;
+ break;
}
touch_mode = NONE;
} else if (switch_value == MotionEvent.ACTION_MOVE) {
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;
+ 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_) {
oldDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
@@ -341,88 +348,89 @@ public class NavitGraphics {
i = event.getUnicodeChar();
if (i == 0) {
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;
+ 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 {
- Navit.time_pressed_menu_key = 0L;
+ // if on map view:
+ // volume UP
+ //s = java.lang.String.valueOf((char) 1);
+ return true;
+ }
+ case KeyEvent.KEYCODE_SEARCH:
+ /* Handle event in Main Activity if map is shown */
+ if (in_map) {
+ return false;
}
- 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;
- }
- 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;
- }
- break;
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (!in_map) {
- // if in menu view:
- // use as DOWN key
+ 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;
+ }
+ 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);
- } 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;
+ 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) {
s = java.lang.String.valueOf((char) 13);
@@ -442,39 +450,40 @@ public class NavitGraphics {
if (i == 0) {
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;
- }
- //s = java.lang.String.valueOf((char) 27);
- return true;
- case KeyEvent.KEYCODE_MENU:
- if (!in_map) {
+ 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) {
- // if soft keyboard showing on screen, dont use menu button as select key
+ Navit.show_soft_keyboard_now_showing = false;
+ }
+ //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 in menu view:
- // use as OK (Enter) key
- s = String.valueOf((char) 13);
+ // 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;
+ break;
}
- } else if(i!=10) {
+ } else if (i != 10) {
s = java.lang.String.valueOf((char) i);
}
@@ -485,10 +494,10 @@ public class NavitGraphics {
}
@Override
- public boolean onKeyMultiple (int keyCode, int count, KeyEvent event) {
+ public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
String s;
- if(keyCode == KeyEvent.KEYCODE_UNKNOWN) {
- s=event.getCharacters();
+ if (keyCode == KeyEvent.KEYCODE_UNKNOWN) {
+ s = event.getCharacters();
KeypressCallback(KeypressCallbackID, s);
return true;
}
@@ -546,7 +555,7 @@ public class NavitGraphics {
}
public NavitGraphics(final Activity activity, NavitGraphics parent, int x, int y, int w, int h,
- int wraparound, int use_camera) {
+ int wraparound, int use_camera) {
if (parent == null) {
this.activity = (Navit) activity;
view = new NavitView(activity);
@@ -562,7 +571,7 @@ public class NavitGraphics {
relativelayout.addView(view);
/* The navigational and status bar tinting code is meaningful only on API19+ */
- if(Build.VERSION.SDK_INT >= 19) {
+ if (Build.VERSION.SDK_INT >= 19) {
frameLayout = new FrameLayout(activity);
frameLayout.addView(relativelayout);
navigationTintView = new SystemBarTintView(activity);
@@ -589,8 +598,8 @@ public class NavitGraphics {
}
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
+ 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 final msg_type[] msg_values = msg_type.values();
@@ -598,63 +607,76 @@ public class NavitGraphics {
public final Handler callback_handler = new Handler() {
public void handleMessage(Message msg) {
switch (msg_values[msg.what]) {
- case CLB_ZOOM_IN:
- CallbackMessageChannel(1, "");
- break;
- case CLB_ZOOM_OUT:
- CallbackMessageChannel(2, "");
- break;
- case CLB_MOVE:
- MotionCallback(MotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y"));
- break;
- case CLB_SET_DESTINATION:
- String lat = Float.toString(msg.getData().getFloat("lat"));
- String lon = Float.toString(msg.getData().getFloat("lon"));
- String q = msg.getData().getString(("q"));
- CallbackMessageChannel(3, lat + "#" + lon + "#" + q);
- break;
- case CLB_SET_DISPLAY_DESTINATION:
- int x = msg.arg1;
- int y = msg.arg2;
- CallbackMessageChannel(4, "" + x + "#" + y);
- break;
- case CLB_CALL_CMD:
- String cmd = msg.getData().getString(("cmd"));
- CallbackMessageChannel(5, cmd);
- break;
- case CLB_BUTTON_UP:
- ButtonCallback(ButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // up
- break;
- case CLB_BUTTON_DOWN:
- ButtonCallback(ButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // down
- break;
- case CLB_COUNTRY_CHOOSER:
- break;
- case CLB_LOAD_MAP:
- CallbackMessageChannel(6, msg.getData().getString(("title")));
- break;
- case CLB_DELETE_MAP:
- File toDelete = new File( msg.getData().getString(("title")));
- toDelete.delete();
- //fallthrough
- case CLB_UNLOAD_MAP:
- CallbackMessageChannel(7, msg.getData().getString(("title")));
- break;
+ case CLB_ZOOM_IN:
+ CallbackMessageChannel(1, "");
+ break;
+ case CLB_ZOOM_OUT:
+ CallbackMessageChannel(2, "");
+ break;
+ case CLB_MOVE:
+ MotionCallback(MotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y"));
+ break;
+ case CLB_SET_DESTINATION:
+ String lat = Float.toString(msg.getData().getFloat("lat"));
+ String lon = Float.toString(msg.getData().getFloat("lon"));
+ String q = msg.getData().getString(("q"));
+ CallbackMessageChannel(3, lat + "#" + lon + "#" + q);
+ break;
+ case CLB_SET_DISPLAY_DESTINATION:
+ int x = msg.arg1;
+ int y = msg.arg2;
+ CallbackMessageChannel(4, "" + x + "#" + y);
+ break;
+ case CLB_CALL_CMD:
+ String cmd = msg.getData().getString(("cmd"));
+ CallbackMessageChannel(5, cmd);
+ break;
+ case CLB_BUTTON_UP:
+ ButtonCallback(ButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // up
+ break;
+ case CLB_BUTTON_DOWN:
+ // down
+ ButtonCallback(ButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y"));
+ break;
+ case CLB_COUNTRY_CHOOSER:
+ break;
+ case CLB_LOAD_MAP:
+ CallbackMessageChannel(6, msg.getData().getString(("title")));
+ break;
+ case CLB_DELETE_MAP:
+ File toDelete = new File(msg.getData().getString(("title")));
+ toDelete.delete();
+ //fallthrough
+ case CLB_UNLOAD_MAP:
+ CallbackMessageChannel(7, msg.getData().getString(("title")));
+ break;
}
}
};
public native void SizeChangedCallback(int id, int x, int y);
+
public native void PaddingChangedCallback(int id, int left, int right, int top, int bottom);
+
public native void KeypressCallback(int id, String s);
+
public native int CallbackMessageChannel(int i, String s);
+
public native void ButtonCallback(int id, int pressed, int button, int x, int y);
+
public native void MotionCallback(int id, int x, int y);
+
public native String GetDefaultCountry(int id, String s);
+
public static native String[][] GetAllCountries();
+
private Canvas draw_canvas;
private Bitmap draw_bitmap;
- private int SizeChangedCallbackID, PaddingChangedCallbackID, ButtonCallbackID, MotionCallbackID, KeypressCallbackID;
+ private int SizeChangedCallbackID;
+ private int PaddingChangedCallbackID;
+ private int ButtonCallbackID;
+ private int MotionCallbackID;
+ private int KeypressCallbackID;
/**
* @brief Adjust views used to tint navigation and status bars.
@@ -668,9 +690,9 @@ public class NavitGraphics {
private void adjustSystemBarsTintingViews() {
/* frameLayout is only created on platforms supporting navigation and status bar tinting */
- if (frameLayout == null)
+ if (frameLayout == null) {
return;
-
+ }
if (activity == null) {
Log.w(TAG, "Main Activity is not a Navit instance, cannot update padding");
return;
@@ -695,19 +717,21 @@ public class NavitGraphics {
/*
* Determine where the navigation bar would be displayed.
* Logic is taken from AOSP RenderSessionImpl.findNavigationBar()
- * (platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java)
+ * platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
*/
- final Boolean isLandscape = (navit.getResources().getConfiguration().orientation ==
- Configuration.ORIENTATION_LANDSCAPE);
- final Boolean isNavAtBottom = (!isLandscape) || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
+ final Boolean isLandscape = (navit.getResources().getConfiguration().orientation
+ == Configuration.ORIENTATION_LANDSCAPE);
+ final Boolean isNavAtBottom = (!isLandscape)
+ || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
Log.d(TAG, String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
- isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
+ isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
int left = 0;
int top = isStatusShowing ? Navit.status_bar_height : 0;
int right = (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0;
final int bottom = (!(isNavShowing
- && isNavAtBottom)) ? 0 : isLandscape ? Navit.navigation_bar_height_landscape : Navit.navigation_bar_height;
+ && isNavAtBottom)) ? 0 : (
+ isLandscape ? Navit.navigation_bar_height_landscape : Navit.navigation_bar_height);
/* hide tint bars during update to prevent ugly effects */
statusTintView.setVisibility(View.GONE);
@@ -721,18 +745,19 @@ public class NavitGraphics {
Navit.status_bar_height, Gravity.TOP);
/* Prevent tint views from overlapping when navigation is on the right */
- statusLayoutParams.setMargins(0, 0, (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0, 0);
+ statusLayoutParams.setMargins(0, 0,
+ (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0, 0);
statusTintView.setLayoutParams(statusLayoutParams);
Log.d(TAG, String.format("statusTintView: width=%d height=%d",
- statusTintView.getWidth(), statusTintView.getHeight()));
+ statusTintView.getWidth(), statusTintView.getHeight()));
navigationTintView.setVisibility(isNavShowing ? View.VISIBLE : View.GONE);
LayoutParams navigationLayoutParams = new FrameLayout.LayoutParams(
- isNavAtBottom ? LayoutParams.MATCH_PARENT : Navit.navigation_bar_width, // X
- isNavAtBottom ? bottom : LayoutParams.MATCH_PARENT, // Y
- Gravity.BOTTOM | Gravity.RIGHT);
+ isNavAtBottom ? LayoutParams.MATCH_PARENT : Navit.navigation_bar_width, // X
+ isNavAtBottom ? bottom : LayoutParams.MATCH_PARENT, // Y
+ Gravity.BOTTOM | Gravity.RIGHT);
navigationTintView.setLayoutParams(navigationLayoutParams);
Log.d(TAG, String.format("navigationTintView: width=%d height=%d",
- navigationTintView.getWidth(), navigationTintView.getHeight()));
+ navigationTintView.getWidth(), navigationTintView.getHeight()));
}
});
@@ -749,9 +774,9 @@ public class NavitGraphics {
*
*/
public void handleResize(int w, int h) {
- if (this.parent_graphics != null)
+ if (this.parent_graphics != null) {
this.parent_graphics.handleResize(w, h);
- else {
+ } else {
Log.d(TAG, String.format("handleResize w=%d h=%d", w, h));
adjustSystemBarsTintingViews();
@@ -778,26 +803,32 @@ public class NavitGraphics {
* this method will still return `false`.
*/
public boolean hasMenuButton() {
- if (Build.VERSION.SDK_INT <= 10)
+ if (Build.VERSION.SDK_INT <= 10) {
return true;
- else if (Build.VERSION.SDK_INT <= 13)
- return false;
- else
- return ViewConfiguration.get(activity.getApplication()).hasPermanentMenuKey();
+ } else {
+ if (Build.VERSION.SDK_INT <= 13) {
+ return false;
+ } else {
+ return ViewConfiguration.get(activity.getApplication()).hasPermanentMenuKey();
+ }
+ }
}
public void setSizeChangedCallback(int id) {
SizeChangedCallbackID = id;
}
+
public void setPaddingChangedCallback(int id) {
PaddingChangedCallbackID = id;
}
+
public void setButtonCallback(int id) {
ButtonCallbackID = id;
}
+
public void setMotionCallback(int id) {
MotionCallbackID = id;
- if(activity != null) {
+ if (activity != null) {
activity.setMotionCallback(id, this);
}
}
@@ -805,34 +836,35 @@ public class NavitGraphics {
public void setKeypressCallback(int id) {
KeypressCallbackID = id;
// set callback id also in main intent (for menus)
- if(activity != null) {
+ if (activity != null) {
activity.setKeypressCallback(id, this);
}
}
protected void draw_polyline(Paint paint, int[] c) {
- int i, ndashes;
- float [] intervals;
paint.setStrokeWidth(c[0]);
paint.setARGB(c[1],c[2],c[3],c[4]);
paint.setStyle(Paint.Style.STROKE);
//paint.setAntiAlias(true);
//paint.setStrokeWidth(0);
- ndashes=c[5];
- intervals=new float[ndashes+(ndashes%2)];
- for (i = 0; i < ndashes; i++)
- intervals[i]=c[6+i];
+ int ndashes = c[5];
+ float[] intervals = new float[ndashes + (ndashes % 2)];
+ for (int i = 0; i < ndashes; i++) {
+ intervals[i] = c[6 + i];
+ }
- if((ndashes%2)==1)
- intervals[ndashes]=intervals[ndashes-1];
+ if ((ndashes % 2) == 1) {
+ intervals[ndashes] = intervals[ndashes - 1];
+ }
- if(ndashes>0)
+ if (ndashes > 0) {
paint.setPathEffect(new android.graphics.DashPathEffect(intervals,0.0f));
+ }
Path path = new Path();
- path.moveTo(c[6+ndashes], c[7+ndashes]);
- for (i = 8+ndashes; i < c.length; i += 2) {
+ path.moveTo(c[6 + ndashes], c[7 + ndashes]);
+ for (int i = 8 + ndashes; i < c.length; i += 2) {
path.lineTo(c[i], c[i + 1]);
}
//global_path.close();
@@ -869,8 +901,8 @@ public class NavitGraphics {
}
protected void draw_text(Paint paint, int x, int y, String text, int size, int dx, int dy, int bgcolor) {
- int oldcolor=paint.getColor();
- Path path=null;
+ int oldcolor = paint.getColor();
+ Path path = null;
paint.setTextSize(size / 15);
paint.setStyle(Paint.Style.FILL);
@@ -882,11 +914,11 @@ public class NavitGraphics {
paint.setTextAlign(android.graphics.Paint.Align.LEFT);
}
- if(bgcolor!=0) {
+ if (bgcolor != 0) {
paint.setStrokeWidth(3);
paint.setColor(bgcolor);
paint.setStyle(Paint.Style.STROKE);
- if(path==null) {
+ if (path == null) {
draw_canvas.drawText(text, x, y, paint);
} else {
draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
@@ -895,13 +927,14 @@ public class NavitGraphics {
paint.setColor(oldcolor);
}
- if(path==null) {
+ if (path == null) {
draw_canvas.drawText(text, x, y, paint);
} else {
draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
}
paint.clearShadowLayer();
}
+
protected void draw_image(Paint paint, int x, int y, Bitmap bitmap) {
draw_canvas.drawBitmap(bitmap, x, y, null);
}
@@ -924,7 +957,7 @@ public class NavitGraphics {
* TODO make it work with rectangular tiles as well ?
*/
protected void draw_image_warp(Paint paint, int count, int p0x, int p0y, int p1x, int p1y, int p2x, int p2y,
- Bitmap bitmap) {
+ Bitmap bitmap) {
float width;
float scale;
@@ -964,15 +997,18 @@ public class NavitGraphics {
}
}
+
protected void draw_drag(int x, int y) {
pos_x = x;
pos_y = y;
}
+
protected void overlay_disable(int disable) {
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);
+ if (parent_graphics == null) {
+ in_map = (disable == 0);
+ }
if (overlay_disabled != disable) {
overlay_disabled = disable;
if (parent_graphics != null) {
diff --git a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
index a8ee7f98c..c2c40fe2e 100644
--- a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
+++ b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
@@ -49,425 +49,436 @@ public class NavitMapDownloader extends Thread {
//
public static final osm_map_values[] osm_maps = {
new osm_map_values(Navit.getInstance().getTstring(R.string.whole_planet), "-180", "-90", "180", "90",
- 23992258630L, 0),
+ 23992258630L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.africa), "-30.89", "-36.17", "61.68",
- "38.40", 2070076339L, 0),
+ "38.40", 2070076339L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.angola), "11.4", "-18.1", "24.2", "-5.3",
- 127557789L, 1),
+ 127557789L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.burundi), "28.9", "-4.5", "30.9", "-2.2",
- 124049667L, 1),
+ 124049667L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.canary_islands), "-18.69", "26.52", "-12.79",
- "29.99", 133565815L, 1),
+ "29.99", 133565815L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.congo), "11.7",
- "-13.6", "31.5", "5.7", 244228485L, 1),
+ "-13.6", "31.5", "5.7", 244228485L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.ethiopia), "32.89", "3.33", "48.07", "14.97",
- 153067406L, 1),
+ 153067406L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.guinea), "-15.47", "7.12", "-7.58", "12.74",
- 188047126L, 1),
+ 188047126L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.cotedivoire), "-8.72", "4.09", "-2.43",
- "10.80", 132187496L, 1),
+ "10.80", 132187496L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.kenya), "33.8", "-5.2", "42.4", "4.9",
- 190073089L, 1),
+ 190073089L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.lesotho), "26.9", "-30.7", "29.6", "-28.4",
- 196189429L, 1),
+ 196189429L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.liberia), "-15.00", "-0.73", "-7.20", "8.65",
- 156257253L, 1),
+ 156257253L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.libya), "9.32", "19.40", "25.54", "33.63",
- 126046917L, 1),
+ 126046917L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.madagascar), "42.25", "-26.63", "51.20",
- "-11.31", 145210721L, 1),
+ "-11.31", 145210721L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.namibia) + "+" + Navit.getInstance().getTstring(R.string.botswana),
- "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
+ Navit.getInstance().getTstring(R.string.namibia) + "+"
+ + Navit.getInstance().getTstring(R.string.botswana),
+ "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.reunion), "55.2", "-21.4", "55.9", "-20.9",
- 126008774L, 1),
+ 126008774L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.rwanda), "28.8", "-2.9", "30.9", "-1.0",
- 128267595L, 1),
+ 128267595L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.south_africa) + "+" + Navit.getInstance().getTstring(R.string.lesotho),
- "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
+ Navit.getInstance().getTstring(R.string.south_africa) + "+"
+ + Navit.getInstance().getTstring(R.string.lesotho),
+ "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.tanzania), "29.19",
- "-11.87", "40.74", "-0.88", 253621029L, 1),
+ "-11.87", "40.74", "-0.88", 253621029L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.uganda), "29.3", "-1.6", "35.1", "4.3",
- 179134521L, 1),
+ 179134521L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.asia), "23.8", "0.1", "195.0", "82.4",
- 5113673780L, 0),
+ 5113673780L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.azerbaijan), "44.74", "38.34", "51.69",
- "42.37", 138346406L, 1),
+ "42.37", 138346406L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.china), "67.3", "5.3", "135.0", "54.5",
- 1718108758L, 1),
+ 1718108758L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.cyprus), "32.0", "34.5", "34.9", "35.8",
- 118472448L, 1),
+ 118472448L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.india) + "+" + Navit.getInstance().getTstring(R.string.nepal), "67.9",
- "5.5", "89.6", "36.0", 601877877L, 1),
+ Navit.getInstance().getTstring(R.string.india) + "+"
+ + Navit.getInstance().getTstring(R.string.nepal), "67.9",
+ "5.5", "89.6", "36.0", 601877877L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.indonesia), "93.7", "-17.3", "155.5", "7.6",
- 420741405L, 1),
+ 420741405L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.iran), "43.5", "24.4",
- "63.6", "40.4", 242016066L, 1),
+ "63.6", "40.4", 242016066L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.iraq), "38.7", "28.5", "49.2", "37.4",
- 160751805L, 1),
+ 160751805L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.israel), "33.99", "29.8", "35.95", "33.4",
- 155685778L, 1),
+ 155685778L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.japan) + "+" + Navit.getInstance().getTstring(R.string.korea), "123.6",
- "25.2", "151.3", "47.1", 1029080156L, 1),
+ Navit.getInstance().getTstring(R.string.japan) + "+"
+ + Navit.getInstance().getTstring(R.string.korea), "123.6",
+ "25.2", "151.3", "47.1", 1029080156L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.kazakhstan), "46.44", "40.89", "87.36",
- "55.45", 407633007L, 1),
+ "55.45", 407633007L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.kyrgyzsyan), "69.23", "39.13", "80.33",
- "43.29", 147997835L, 1),
+ "43.29", 147997835L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.malaysia) + "+" + Navit.getInstance().getTstring(R.string.singapore),
- "94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
+ Navit.getInstance().getTstring(R.string.malaysia) + "+"
+ + Navit.getInstance().getTstring(R.string.singapore),
+ "94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.mongolia), "87.5", "41.4", "120.3", "52.7",
- 153534851L, 1),
+ 153534851L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.pakistan), "60.83", "23.28", "77.89",
- "37.15", 217644321L, 1),
+ "37.15", 217644321L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.philippines), "115.58", "4.47", "127.85",
- "21.60", 281428307L, 1),
+ "21.60", 281428307L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.saudi_arabia), "33.2", "16.1", "55.9",
- "33.5", 242648303L, 1),
+ "33.5", 242648303L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.taiwan), "119.1", "21.5", "122.5", "25.2",
- 1029080156L, 1),
+ 1029080156L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.thailand), "97.5", "5.7", "105.2", "19.7",
- 185135492L, 1),
+ 185135492L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.turkey), "25.1", "35.8", "46.4", "42.8",
- 331087441L, 1),
+ 331087441L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.turkmenistan), "51.78", "35.07", "66.76",
- "42.91", 131045087L, 1),
+ "42.91", 131045087L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.uae_other), "51.5", "22.6", "56.7", "26.5",
- 128934674L, 1),
+ 128934674L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.australia) + "+" + Navit.getInstance().getTstring(R.string.oceania),
- "89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
+ Navit.getInstance().getTstring(R.string.australia) + "+"
+ + Navit.getInstance().getTstring(R.string.oceania),
+ "89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.australia), "110.5", "-44.2", "154.9",
- "-9.2", 348652900L, 0),
+ "-9.2", 348652900L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.tasmania), "144.0", "-45.1", "155.3",
- "-24.8", 253231890L, 1),
+ "-24.8", 253231890L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.victoria) + " + " + Navit.getInstance()
- .getTstring(R.string.new_south_wales), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
+ .getTstring(R.string.new_south_wales), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.new_caledonia), "157.85", "-25.05", "174.15",
- "-16.85", 115512336L, 1),
+ "-16.85", 115512336L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.newzealand), "165.2", "-47.6", "179.1",
- "-33.7", 239264192L, 1),
+ "-33.7", 239264192L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.europe), "-12.97", "33.59", "34.15", "72.10",
- 11984126789L, 0),
+ 11984126789L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.western_europe), "-17.6", "34.5", "42.9",
- "70.9", 12648810717L, 1),
+ "70.9", 12648810717L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.austria), "9.4", "46.32", "17.21", "49.1",
- 898273634L, 1),
+ 898273634L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.azores), "-31.62", "36.63", "-24.67",
- "40.13", 112687225L, 1),
+ "40.13", 112687225L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.belgium), "2.3", "49.5", "6.5", "51.6",
- 733035524L, 1),
+ 733035524L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.benelux), "2.08", "48.87", "7.78", "54.52",
- 1771971595L, 1),
+ 1771971595L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.netherlands), "3.07", "50.75", "7.23",
- "53.73", 1191828033L, 1),
+ "53.73", 1191828033L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.denmark), "7.65", "54.32", "15.58", "58.07",
- 365606979L, 1),
+ 365606979L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.faroe_islands), "-7.8", "61.3", "-6.1",
- "62.5", 109377568L, 1),
+ "62.5", 109377568L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.france), "-5.45", "42.00", "8.44", "51.68",
- 3907969744L, 1),
+ 3907969744L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.alsace), "6.79", "47.27", "8.48", "49.17",
- 354249349L, 2),
+ 354249349L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.aquitaine), "-2.27", "42.44", "1.50",
- "45.76", 443715019L, 2),
+ "45.76", 443715019L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.auvergne), "2.01", "44.57", "4.54", "46.85",
- 287663213L, 2),
+ 287663213L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.basse_normandie), "-2.09", "48.13", "1.03",
- "49.98", 262352354L, 2),
+ "49.98", 262352354L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.bourgogne), "2.80", "46.11", "5.58", "48.45",
- 298868796L, 2),
+ 298868796L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.bretagne), "-5.58", "46.95", "-0.96",
- "48.99", 382770794L, 2),
+ "48.99", 382770794L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.centre), "0.01", "46.29", "3.18", "48.99",
- 474224721L, 2),
+ 474224721L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.champagne_ardenne), "3.34", "47.53", "5.94",
- "50.28", 269947824L, 2),
+ "50.28", 269947824L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.corse), "8.12", "41.32", "9.95", "43.28",
- 129902146L, 2),
+ 129902146L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.franche_comte), "5.20", "46.21", "7.83",
- "48.07", 324476070L, 2),
+ "48.07", 324476070L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.haute_normandie), "-0.15", "48.62", "1.85",
- "50.18", 202782876L, 2),
+ "50.18", 202782876L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.ile_de_france), "1.40", "48.07", "3.61",
- "49.29", 311052699L, 2),
+ "49.29", 311052699L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.languedoc_roussillon), "1.53", "42.25",
- "4.89", "45.02", 380145667L, 2),
+ "4.89", "45.02", 380145667L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.limousin), "0.58", "44.87", "2.66", "46.50",
- 206696539L, 2),
+ 206696539L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.lorraine), "4.84", "47.77", "7.72", "49.73",
- 330777318L, 2),
+ 330777318L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.midi_pyrenees), "-0.37", "42.18", "3.50",
- "45.10", 462618363L, 2),
+ "45.10", 462618363L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.nord_pas_de_calais), "1.42", "49.92", "4.49",
- "51.31", 368467511L, 2),
+ "51.31", 368467511L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.pays_de_la_loire), "-2.88", "46.20", "0.97",
- "48.62", 499471143L, 2),
+ "48.62", 499471143L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.picardie), "1.25", "48.79", "4.31", "50.43",
- 374308041L, 2),
+ 374308041L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.poitou_charentes), "-1.69", "45.04", "1.26",
- "47.23", 342125526L, 2),
+ "47.23", 342125526L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.provence_alpes_cote_d_azur), "4.21", "42.91",
- "7.99", "45.18", 390306134L, 2),
+ "7.99", "45.18", 390306134L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.rhone_alpes), "3.65", "44.07", "7.88",
- "46.64", 510797942L, 2),
+ "46.64", 510797942L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.luxembourg), "5.7", "49.4", "6.5", "50.2",
- 1771971595L, 1),
+ 1771971595L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.germany), "5.18", "46.84", "15.47", "55.64",
- 3521359466L, 1),
+ 3521359466L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.baden_wuerttemberg), "7.32", "47.14",
- "10.57", "49.85", 674361124L, 2),
+ "10.57", "49.85", 674361124L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.bayern), "8.92", "47.22", "13.90", "50.62",
- 860161150L, 2),
+ 860161150L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.mittelfranken), "9.86", "48.78", "11.65",
- "49.84", 203055195L, 2),
+ "49.84", 203055195L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.niederbayern), "11.55", "47.75", "14.12",
- "49.42", 312924770L, 2),
+ "49.42", 312924770L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oberbayern), "10.67", "47.05", "13.57",
- "49.14", 382734883L, 2),
+ "49.14", 382734883L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oberfranken), "10.31", "49.54", "12.49",
- "50.95", 235258691L, 2),
+ "50.95", 235258691L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oberpfalz), "11.14", "48.71", "13.47",
- "50.43", 264536012L, 2),
+ "50.43", 264536012L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.schwaben), "9.27", "47.10", "11.36", "49.09",
- 321141607L, 2),
+ 321141607L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.unterfranken), "8.59", "49.16", "10.93",
- "50.67", 303720890L, 2),
+ "50.67", 303720890L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.berlin), "13.03", "52.28", "13.81", "52.73",
- 169019946L, 2),
+ 169019946L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.brandenburg), "11.17", "51.30", "14.83",
- "53.63", 323497599L, 2),
+ "53.63", 323497599L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.bremen), "8.43", "52.96", "9.04", "53.66",
- 150963608L, 2),
+ 150963608L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.hamburg), "9.56", "53.34", "10.39", "53.80",
- 156284421L, 2),
+ 156284421L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.hessen), "7.72", "49.34", "10.29", "51.71",
- 432279328L, 2),
+ 432279328L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.mecklenburg_vorpommern), "10.54", "53.05",
- "14.48", "55.05", 213183908L, 2),
+ "14.48", "55.05", 213183908L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.niedersachsen), "6.40", "51.24", "11.69",
- "54.22", 819766939L, 2),
+ "54.22", 819766939L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.nordrhein_westfalen), "5.46", "50.26",
- "9.52", "52.59", 967053517L, 2),
+ "9.52", "52.59", 967053517L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.rheinland_pfalz), "6.06", "48.91", "8.56",
- "51.00", 442868899L, 2),
+ "51.00", 442868899L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.saarland), "6.30", "49.06", "7.46", "49.69",
- 157721162L, 2),
+ 157721162L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.sachsen_anhalt), "10.50", "50.88", "13.26",
- "53.11", 287785088L, 2),
+ "53.11", 287785088L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.sachsen), "11.82", "50.11", "15.10", "51.73",
- 342620834L, 2),
+ 342620834L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.schleswig_holstein), "7.41", "53.30",
- "11.98", "55.20", 280293910L, 2),
+ "11.98", "55.20", 280293910L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.thueringen), "9.81", "50.15", "12.72",
- "51.70", 269428239L, 2),
+ "51.70", 269428239L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.iceland), "-25.3", "62.8", "-11.4", "67.5",
- 124837162L, 1),
+ 124837162L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.ireland), "-11.17", "51.25", "-5.23", "55.9",
- 234750271L, 1),
+ 234750271L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.italy), "6.52", "36.38", "18.96", "47.19",
- 1610171395L, 1),
+ 1610171395L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.spain) + "+" + Navit.getInstance().getTstring(R.string.portugal),
- "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
+ Navit.getInstance().getTstring(R.string.spain) + "+"
+ + Navit.getInstance().getTstring(R.string.portugal),
+ "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.mallorca), "2.2", "38.8", "4.7", "40.2",
- 137200636L, 2),
+ 137200636L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.galicia), "-10.0", "41.7", "-6.3", "44.1",
- 174549553L, 2),
+ 174549553L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.scandinavia), "4.0", "54.4", "32.1", "71.5",
- 1398661090L, 1),
+ 1398661090L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.finland), "18.6", "59.2", "32.3", "70.3",
- 460997178L, 1),
+ 460997178L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.denmark), "7.49", "54.33", "13.05", "57.88",
- 321870414L, 1),
+ 321870414L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.switzerland), "5.79", "45.74", "10.59",
- "47.84", 552565332L, 1),
+ "47.84", 552565332L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.united_kingdom), "-9.7", "49.6", "2.2",
- "61.2", 901724648L, 1),
+ "61.2", 901724648L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.england), "-7.80", "48.93", "2.41", "56.14",
- 937728414L, 1),
+ 937728414L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.buckinghamshire), "-1.19", "51.44", "-0.43",
- "52.25", 142256978L, 2),
+ "52.25", 142256978L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.cambridgeshire), "-0.55", "51.96", "0.56",
- "52.79", 142334001L, 2),
+ "52.79", 142334001L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.cumbria), "-3.96", "53.85", "-2.11", "55.24",
- 144422460L, 2),
+ 144422460L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.east_yorkshire_with_hull), "-1.16", "53.50",
- "0.54", "54.26", 141518744L, 2),
+ "0.54", "54.26", 141518744L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.essex), "-0.07", "51.40", "1.36", "52.14",
- 162542730L, 2),
+ 162542730L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.herefordshire), "-3.19", "51.78", "-2.29",
- "52.45", 129368660L, 2),
+ "52.45", 129368660L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.kent), "-0.02", "50.81", "1.65", "51.53",
- 145482562L, 2),
+ 145482562L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.lancashire), "-3.20", "53.43", "-2.00",
- "54.29", 148964975L, 2),
+ "54.29", 148964975L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.leicestershire), "-1.65", "52.34", "-0.61",
- "53.03", 154199956L, 2),
+ "53.03", 154199956L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.norfolk), "0.10", "52.30", "2.04", "53.41",
- 146017009L, 2),
+ 146017009L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.nottinghamshire), "-1.39", "52.73", "-0.62",
- "53.55", 147986548L, 2),
+ "53.55", 147986548L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oxfordshire), "-1.77", "51.41", "-0.82",
- "52.22", 142240992L, 2),
+ "52.22", 142240992L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.shropshire), "-3.29", "52.26", "-2.18",
- "53.05", 136909363L, 2),
+ "53.05", 136909363L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.somerset), "-3.89", "50.77", "-2.20",
- "51.40", 145186096L, 2),
+ "51.40", 145186096L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.south_yorkshire), "-1.88", "53.25", "-0.80",
- "53.71", 145902650L, 2),
+ "53.71", 145902650L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.suffolk), "0.29", "51.88", "1.81", "52.60",
- 143799697L, 2),
+ 143799697L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.surrey), "-0.90", "51.02", "0.10", "51.52",
- 157987139L, 2),
+ 157987139L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.wiltshire), "-2.41", "50.90", "-1.44",
- "51.76", 138652346L, 2),
+ "51.76", 138652346L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.scotland), "-8.13", "54.49", "-0.15",
- "61.40", 258853845L, 2),
+ "61.40", 258853845L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.wales), "-5.56", "51.28", "-2.60", "53.60",
- 193593409L, 2),
+ 193593409L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.albania), "19.09", "39.55", "21.12", "42.72",
- 146199817L, 1),
+ 146199817L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.belarus), "23.12", "51.21", "32.87", "56.23",
- 324470696L, 1),
+ 324470696L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.russian_federation), "27.9", "41.5", "190.4",
- "77.6", 2148314279L, 1),
+ "77.6", 2148314279L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.bulgaria), "24.7", "42.1", "24.8", "42.1",
- 109869373L, 1),
+ 109869373L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.bosnia_and_herzegovina), "15.69", "42.52",
- "19.67", "45.32", 187122485L, 1),
+ "19.67", "45.32", 187122485L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.czech_republic), "11.91", "48.48", "19.02",
- "51.17", 904838442L, 1),
+ "51.17", 904838442L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.croatia), "13.4", "42.1", "19.4", "46.9",
- 460854751L, 1),
+ 460854751L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.estonia), "21.5", "57.5", "28.2", "59.6",
- 173378927L, 1),
+ 173378927L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.greece), "28.9", "37.8", "29.0", "37.8",
- 109435051L, 1),
+ 109435051L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.crete), "23.3", "34.5", "26.8", "36.0",
- 115985063L, 1),
+ 115985063L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.hungary), "16.08", "45.57", "23.03", "48.39",
- 350318541L, 1),
+ 350318541L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.latvia), "20.7", "55.6", "28.3", "58.1",
- 188188140L, 1),
+ 188188140L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.lithuania), "20.9", "53.8", "26.9", "56.5",
- 217852597L, 1),
+ 217852597L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.poland), "13.6", "48.8", "24.5", "55.0",
- 1464968657L, 1),
+ 1464968657L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.romania), "20.3", "43.5", "29.9", "48.4",
- 347931565L, 1),
+ 347931565L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.slovakia), "16.8", "47.7", "22.6", "49.7",
- 420533039L, 1),
+ 420533039L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.ukraine), "22.0", "44.3", "40.4", "52.4",
- 793611912L, 1),
+ 793611912L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.north_america), "-178.1", "6.5", "-10.4",
- "84.0", 5601866516L, 0),
+ "84.0", 5601866516L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.alaska), "-179.5", "49.5", "-129", "71.6",
- 207746039L, 1),
+ 207746039L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.canada), "-141.3", "41.5", "-52.2", "70.2",
- 2635719651L, 1),
+ 2635719651L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.hawaii), "-161.07", "18.49", "-154.45",
- "22.85", 115016656L, 1),
+ "22.85", 115016656L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.usa) + Navit.getInstance()
- .getTstring(R.string.except_alaska_and_hawaii), "-125.4", "24.3", "-66.5", "49.3",
- 4060487198L, 1),
+ .getTstring(R.string.except_alaska_and_hawaii), "-125.4", "24.3", "-66.5", "49.3",
+ 4060487198L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.midwest), "-104.11", "35.92", "-80.46",
- "49.46", 1145596450L, 2),
+ "49.46", 1145596450L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.michigan), "-90.47", "41.64", "-79.00",
- "49.37", 538247019L, 2),
+ "49.37", 538247019L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.ohio), "-84.87", "38.05", "-79.85", "43.53",
- 277022336L, 2),
+ 277022336L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.northeast), "-80.58", "38.72", "-66.83",
- "47.53", 1017160709L, 2),
+ "47.53", 1017160709L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.massachusetts), "-73.56", "40.78", "-68.67",
- "42.94", 340055487L, 2),
+ "42.94", 340055487L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.vermont), "-73.49", "42.68", "-71.41",
- "45.07", 139626067L, 2),
+ "45.07", 139626067L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.pacific), "-180.05", "15.87", "-129.75",
- "73.04", 207090640L, 2),
+ "73.04", 207090640L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.south), "-106.70", "23.98", "-71.46",
- "40.70", 1747935356L, 2),
+ "40.70", 1747935356L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.arkansas), "-94.67", "32.95", "-89.59",
- "36.60", 155658661L, 2),
+ "36.60", 155658661L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.district_of_columbia), "-77.17", "38.74",
- "-76.86", "39.05", 129235755L, 2),
+ "-76.86", "39.05", 129235755L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.florida), "-88.75", "23.63", "-77.67",
- "31.05", 224022108L, 2),
+ "31.05", 224022108L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.louisiana), "-94.09", "28.09", "-88.62",
- "33.07", 210120605L, 2),
+ "33.07", 210120605L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.maryland), "-79.54", "37.83", "-74.99",
- "40.22", 276462622L, 2),
+ "40.22", 276462622L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.mississippi), "-91.71", "29.99", "-88.04",
- "35.05", 177858031L, 2),
+ "35.05", 177858031L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oklahoma), "-103.41", "33.56", "-94.38",
- "37.38", 200061473L, 2),
+ "37.38", 200061473L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.texas), "-106.96", "25.62", "-92.97",
- "36.58", 430089141L, 2),
+ "36.58", 430089141L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.virginia), "-83.73", "36.49", "-74.25",
- "39.52", 384187569L, 2),
+ "39.52", 384187569L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.west_virginia), "-82.70", "37.15", "-77.66",
- "40.97", 220552071L, 2),
+ "40.97", 220552071L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.west), "-133.11", "31.28", "-101.99",
- "49.51", 1152909162L, 2),
+ "49.51", 1152909162L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.arizona), "-114.88", "30.01", "-108.99",
- "37.06", 182826833L, 2),
+ "37.06", 182826833L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.california), "-125.94", "32.43", "-114.08",
- "42.07", 586923326L, 2),
+ "42.07", 586923326L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.colorado), "-109.11", "36.52", "-100.41",
- "41.05", 228623724L, 2),
+ "41.05", 228623724L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.idaho), "-117.30", "41.93", "-110.99",
- "49.18", 170684507L, 2),
+ "49.18", 170684507L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.montana), "-116.10", "44.31", "-102.64",
- "49.74", 176229800L, 2),
+ "49.74", 176229800L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.new_mexico), "-109.10", "26.98", "-96.07",
- "37.05", 361793070L, 2),
+ "37.05", 361793070L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.nevada), "-120.2", "35.0", "-113.8", "42.1",
- 200614482L, 2),
+ 200614482L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.oregon), "-124.8", "41.8", "-116.3", "46.3",
- 211462685L, 2),
+ 211462685L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.utah), "-114.11", "36.95", "-108.99",
- "42.05", 151590197L, 2),
+ "42.05", 151590197L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.washington_state), "-125.0", "45.5",
- "-116.9", "49.0", 222553768L, 2),
+ "-116.9", "49.0", 222553768L, 2),
new osm_map_values(Navit.getInstance().getTstring(R.string.south_middle_america), "-83.5", "-56.3",
- "-30.8", "13.7", 958895383L, 0),
+ "-30.8", "13.7", 958895383L, 0),
new osm_map_values(Navit.getInstance().getTstring(R.string.argentina), "-73.9", "-57.3", "-51.6",
- "-21.0", 376857648L, 1),
+ "-21.0", 376857648L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.argentina) + "+" + Navit.getInstance().getTstring(R.string.chile),
- "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
+ Navit.getInstance().getTstring(R.string.argentina) + "+"
+ + Navit.getInstance().getTstring(R.string.chile),
+ "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.bolivia), "-70.5", "-23.1", "-57.3", "-9.3",
- 175937824L, 1),
+ 175937824L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.brazil), "-71.4", "-34.7", "-32.8", "5.4",
- 664872975L, 1),
+ 664872975L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.chile), "-81.77", "-58.50", "-65.46",
- "-17.41", 241657330L, 1),
+ "-17.41", 241657330L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.cuba), "-85.3", "19.6", "-74.0", "23.6",
- 129043575L, 1),
+ 129043575L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.colombia), "-79.1", "-4.0", "-66.7", "12.6",
- 212016580L, 1),
+ 212016580L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.ecuador), "-82.6", "-5.4", "-74.4", "2.3",
- 158857591L, 1),
+ 158857591L, 1),
new osm_map_values(
- Navit.getInstance().getTstring(R.string.guyana) + "+" + Navit.getInstance().getTstring(R.string.suriname) + "+"
- + Navit.getInstance().getTstring(R.string.guyane_francaise), "-62.0", "1.0", "-51.2",
- "8.9", 123000072L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.haiti) + "+" + Navit.getInstance().getTstring(R.string.dominican_republic), "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1),
+ Navit.getInstance().getTstring(R.string.guyana) + "+"
+ + Navit.getInstance().getTstring(R.string.suriname) + "+"
+ + Navit.getInstance().getTstring(R.string.guyane_francaise), "-62.0", "1.0", "-51.2",
+ "8.9", 123000072L, 1),
+ new osm_map_values(Navit.getInstance().getTstring(R.string.haiti) + "+"
+ + Navit.getInstance().getTstring(R.string.dominican_republic), "-74.8", "17.3", "-68.2", "20.1",
+ 149925689L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.jamaica), "-78.6", "17.4", "-75.9", "18.9",
- 113961998L, 1),
+ 113961998L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.mexico), "-117.6", "14.1", "-86.4", "32.8",
- 551307973L, 1),
+ 551307973L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.paraguay), "-63.8", "-28.1", "-53.6",
- "-18.8", 159498397L, 1),
+ "-18.8", 159498397L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.peru), "-82.4", "-18.1", "-67.5", "0.4",
- 212490557L, 1),
+ 212490557L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.uruguay), "-59.2", "-36.5", "-51.7", "-29.7",
- 157482719L, 1),
+ 157482719L, 1),
new osm_map_values(Navit.getInstance().getTstring(R.string.venezuela), "-73.6", "0.4", "-59.7", "12.8",
- 167295729L, 1)
+ 167295729L, 1)
};
//we should try to resume
private static final int SOCKET_CONNECT_TIMEOUT = 60000; // 60 secs.
@@ -485,6 +496,7 @@ public class NavitMapDownloader extends Thread {
private long uiLastUpdated = -1;
private Boolean retryDownload = false; //Download failed, but
private int retry_counter = 0;
+
NavitMapDownloader(int map_id) {
this.map_values = osm_maps[map_id];
this.map_id = map_id;
@@ -498,6 +510,7 @@ public class NavitMapDownloader extends Thread {
return (filename.endsWith(".bin"));
}
}
+
NavitMap[] maps = new NavitMap[0];
File map_dir = new File(Navit.map_filename_path);
String[] map_file_names = map_dir.list(new filterMaps());
@@ -505,7 +518,7 @@ public class NavitMapDownloader extends Thread {
maps = new NavitMap[map_file_names.length];
for (int map_file_index = 0; map_file_index < map_file_names.length; map_file_index++) {
maps[map_file_index] = new NavitMap(Navit.map_filename_path,
- map_file_names[map_file_index]);
+ map_file_names[map_file_index]);
}
}
return maps;
@@ -517,7 +530,7 @@ public class NavitMapDownloader extends Thread {
Log.v(TAG, "start download " + map_values.map_name);
updateProgress(0, map_values.est_size_bytes,
- Navit.getInstance().getTstring(R.string.map_downloading) + ": " + map_values.map_name);
+ Navit.getInstance().getTstring(R.string.map_downloading) + ": " + map_values.map_name);
boolean success;
do {
@@ -529,9 +542,9 @@ public class NavitMapDownloader extends Thread {
retryDownload = false;
success = download_osm_map();
} while (!success
- && retryDownload
- && retry_counter < MAX_RETRIES
- && !stop_me);
+ && retryDownload
+ && retry_counter < MAX_RETRIES
+ && !stop_me);
if (success) {
toast(map_values.map_name + " " + Navit.getInstance().getTstring(R.string.map_download_ready));
@@ -540,9 +553,8 @@ public class NavitMapDownloader extends Thread {
}
if (success || stop_me) {
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_MAP_DOWNLOAD_FINISHED
- , map_filename_path + map_values.map_name + ".bin", null, -1, success ? 1 : 0,
- map_id);
+ NavitDialogs.sendDialogMessage(NavitDialogs.MSG_MAP_DOWNLOAD_FINISHED,
+ map_filename_path + map_values.map_name + ".bin", null, -1, success ? 1 : 0, map_id);
}
}
@@ -561,14 +573,14 @@ public class NavitMapDownloader extends Thread {
if (free_space < needed_bytes) {
String msg;
Log.e(TAG, "Not enough free space or media not available. Please free at least "
- + needed_bytes / 1024 / 1024 + "Mb.");
+ + needed_bytes / 1024 / 1024 + "Mb.");
if (free_space < 0) {
msg = Navit.getInstance().getTstring(R.string.map_download_medium_unavailable);
} else {
msg = Navit.getInstance().getTstring(R.string.map_download_not_enough_free_space);
}
updateProgress(free_space, needed_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n" + msg);
+ Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n" + msg);
return false;
}
return true;
@@ -578,9 +590,8 @@ public class NavitMapDownloader extends Thread {
File finalOutputFile = getMapFile();
if (finalOutputFile.exists()) {
- Message msg =
- Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
+ Message msg = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
+ NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
Bundle b = new Bundle();
b.putString("title", finalOutputFile.getAbsolutePath());
msg.setData(b);
@@ -635,8 +646,8 @@ public class NavitMapDownloader extends Thread {
}
Log.d(TAG, "size: " + real_size_bytes + ", read: " + already_read + ", timestamp: "
- + fileTime
- + ", Connection ref: " + c.getURL());
+ + fileTime
+ + ", Connection ref: " + c.getURL());
if (checkFreeSpace(real_size_bytes - already_read)
&& downloadData(c, already_read, real_size_bytes, resume, outputFile)) {
@@ -658,8 +669,8 @@ public class NavitMapDownloader extends Thread {
return outputFile;
}
- private boolean downloadData(URLConnection c, long already_read, long real_size_bytes
- , boolean resume, File outputFile) {
+ private boolean downloadData(URLConnection c, long already_read, long real_size_bytes, boolean resume,
+ File outputFile) {
boolean success = false;
BufferedOutputStream buf = getOutputStream(outputFile, resume);
BufferedInputStream bif = getInputStream(c);
@@ -735,7 +746,7 @@ public class NavitMapDownloader extends Thread {
BufferedOutputStream buf;
try {
buf = new BufferedOutputStream(new FileOutputStream(outputFile, resume),
- MAP_WRITE_FILE_BUFFER);
+ MAP_WRITE_FILE_BUFFER);
} catch (FileNotFoundException e) {
Log.e(TAG, "Could not open output file for writing: " + e);
buf = null;
@@ -760,7 +771,7 @@ public class NavitMapDownloader extends Thread {
}
private boolean readData(OutputStream buf, InputStream bif, long already_read,
- long real_size_bytes) {
+ long real_size_bytes) {
long start_timestamp = System.nanoTime();
byte[] buffer = new byte[MAP_WRITE_MEM_BUFFER];
int len1;
@@ -781,12 +792,12 @@ public class NavitMapDownloader extends Thread {
enableRetry();
} else {
updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n"
- + Navit.getInstance().getTstring(R.string.map_download_not_enough_free_space));
+ Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n"
+ + Navit.getInstance().getTstring(R.string.map_download_not_enough_free_space));
}
} else {
updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_error_writing_map));
+ Navit.getInstance().getTstring(R.string.map_download_error_writing_map));
}
return false;
@@ -806,7 +817,7 @@ public class NavitMapDownloader extends Thread {
enableRetry();
updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error));
+ Navit.getInstance().getTstring(R.string.map_download_download_error));
}
return success;
@@ -816,7 +827,7 @@ public class NavitMapDownloader extends Thread {
URL url = null;
try {
ObjectInputStream infoStream = new ObjectInputStream(
- new FileInputStream(getMapInfoFile()));
+ new FileInputStream(getMapInfoFile()));
String resume_proto = infoStream.readUTF();
infoStream.readUTF(); // read the host name (unused for now)
String resume_file = infoStream.readUTF();
@@ -838,8 +849,7 @@ public class NavitMapDownloader extends Thread {
long currentTime = System.nanoTime();
if ((currentTime > uiLastUpdated + UPDATE_PROGRESS_TIME_NS) && startTime != currentTime) {
- float per_second_overall =
- (readBytes - offsetBytes) / ((currentTime - startTime) / 1000000000f);
+ float per_second_overall = (readBytes - offsetBytes) / ((currentTime - startTime) / 1000000000f);
long bytes_remaining = maxBytes - readBytes;
int eta_seconds = (int) (bytes_remaining / per_second_overall);
@@ -849,11 +859,11 @@ public class NavitMapDownloader extends Thread {
} else {
eta_string = eta_seconds + " s";
}
- String info =
- String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s",
- Navit.getInstance().getTstring(R.string.map_downloading)
- , map_values.map_name, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
- per_second_overall / 1024f, Navit.getInstance().getTstring(R.string.map_download_eta), eta_string);
+ String info = String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s",
+ Navit.getInstance().getTstring(R.string.map_downloading),
+ map_values.map_name, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
+ per_second_overall / 1024f, Navit.getInstance().getTstring(R.string.map_download_eta),
+ eta_string);
if (retry_counter > 0) {
info += "\n Retry " + retry_counter + "/" + MAX_RETRIES;
@@ -867,9 +877,9 @@ public class NavitMapDownloader extends Thread {
private void updateProgress(long positionBytes, long maximumBytes, String infoText) {
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_PROGRESS_BAR,
- Navit.getInstance().getTstring(R.string.map_download_title), infoText
- , NavitDialogs.DIALOG_MAPDOWNLOAD, (int) (maximumBytes / 1024),
- (int) (positionBytes / 1024));
+ Navit.getInstance().getTstring(R.string.map_download_title), infoText,
+ NavitDialogs.DIALOG_MAPDOWNLOAD, (int) (maximumBytes / 1024),
+ (int) (positionBytes / 1024));
}
private void writeFileInfo(URLConnection c, long sizeInBytes) {
@@ -883,8 +893,8 @@ public class NavitMapDownloader extends Thread {
infoStream.close();
} catch (Exception e) {
Log.e(TAG,
- "Could not write info file for map download. Resuming will not be possible. ("
- + e.getMessage() + ")");
+ "Could not write info file for map download. Resuming will not be possible. ("
+ + e.getMessage() + ")");
}
}
@@ -905,8 +915,8 @@ public class NavitMapDownloader extends Thread {
private osm_map_values(String mapname, String lon_1, String lat_1, String lon_2,
- String lat_2,
- long bytes_est, int level) {
+ String lat_2,
+ long bytes_est, int level) {
this.map_name = mapname;
this.lon1 = lon_1;
this.lat1 = lat_1;
diff --git a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
index a44ef7b2e..e4c774fb9 100644
--- a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
+++ b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
@@ -44,15 +44,15 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* This is the Directory where all Subdirectories are stored by date */
File backupDir = new File(
- Environment.getExternalStorageDirectory().getPath() + "/navit/backup/"
- + mTimestamp);
+ Environment.getExternalStorageDirectory().getPath() + "/navit/backup/"
+ + mTimestamp);
/* Check if there is a Backup Directory */
if (!backupDir.isDirectory()) {
return mActivity.getTstring(R.string.backup_not_found);
}
- ObjectInputStream preferenceOIS = null;
+ ObjectInputStream preferenceOis = null;
try {
/* Delete all old Files in Home */
mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
@@ -62,19 +62,18 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* Restore Files in home */
mActivity.copyFileIfExists(backupDir.getPath() + "/bookmark.txt",
- Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
+ Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
mActivity.copyFileIfExists(backupDir.getPath() + "/destination.txt",
- Navit.NAVIT_DATA_DIR + "/home/destination.txt");
+ Navit.NAVIT_DATA_DIR + "/home/destination.txt");
mActivity.copyFileIfExists(backupDir.getPath() + "/gui_internal.txt",
- Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
+ Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
/* Restore Shared Preferences */
- preferenceOIS = new ObjectInputStream(
- new FileInputStream(backupDir.getPath() + "/preferences.bak"));
- Map<String, ?> entries = (Map<String, ?>) preferenceOIS.readObject();
+ preferenceOis = new ObjectInputStream(
+ new FileInputStream(backupDir.getPath() + "/preferences.bak"));
+ Map<String, ?> entries = (Map<String, ?>) preferenceOis.readObject();
- Editor prefEditor = mActivity
- .getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE).edit();
+ Editor prefEditor = mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE).edit();
/* Remove all old Preferences */
prefEditor.clear();
@@ -107,14 +106,14 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
} finally {
try {
/* Close Stream to prevent Resource leak */
- if (preferenceOIS != null) {
- preferenceOIS.close();
+ if (preferenceOis != null) {
+ preferenceOis.close();
}
} catch (IOException e) {
-
+ // Catching but ignoring that exception when closing the stream
+ return null;
}
}
-
return null;
}
@@ -133,10 +132,9 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* Navit needs to be restarted. Currently the User has to restart it by himself */
Toast.makeText(mActivity,
- mActivity.getTstring(R.string.restore_successful_please_restart_navit),
- Toast.LENGTH_LONG).show();
- NotificationManager nm = (NotificationManager) mActivity
- .getSystemService(Context.NOTIFICATION_SERVICE);
+ mActivity.getTstring(R.string.restore_successful_please_restart_navit),
+ Toast.LENGTH_LONG).show();
+ NotificationManager nm = (NotificationManager) mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel(R.string.app_name);
NavitVehicle.removeListener();
mActivity.finish();
@@ -146,7 +144,7 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
protected void onCancelled() {
super.onCancelled();
Toast.makeText(mActivity, mActivity.getTstring(R.string.restore_failed), Toast.LENGTH_LONG)
- .show();
+ .show();
mDialog.dismiss();
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitSensors.java b/navit/android/src/org/navitproject/navit/NavitSensors.java
index d4d8abf3e..ad94bdfbe 100644
--- a/navit/android/src/org/navitproject/navit/NavitSensors.java
+++ b/navit/android/src/org/navitproject/navit/NavitSensors.java
@@ -27,23 +27,27 @@ import android.hardware.SensorManager;
public class NavitSensors implements SensorEventListener {
private SensorManager mSensorManager;
private int callbackid;
+
public native void SensorCallback(int id, int sensor, float x, float y, float z);
NavitSensors(Context context, int cbid) {
mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
- mSensorManager.registerListener((SensorEventListener)this, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
+ mSensorManager.registerListener((SensorEventListener)this,
+ mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_NORMAL);
- mSensorManager.registerListener((SensorEventListener)this, mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
+ mSensorManager.registerListener((SensorEventListener)this,
+ mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
SensorManager.SENSOR_DELAY_NORMAL);
- callbackid=cbid;
+ callbackid = cbid;
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent sev) {
- // Log.e("NavitSensor","Type:" + sev.sensor.getType() + " X:" + sev.values[0] + " Y:"+sev.values[1]+" Z:"+sev.values[2]);
+ // Log.e("NavitSensor","Type:" + sev.sensor.getType() + " X:" + sev.values[0] + " Y:"+sev.values[1]+" Z:"
+ // +sev.values[2]);
SensorCallback(callbackid, sev.sensor.getType(), sev.values[0], sev.values[1], sev.values[2]);
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
index 573696698..1bf996dc5 100644
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
@@ -62,19 +62,19 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
// missing data, ask to install it
AlertDialog.Builder builder = new AlertDialog.Builder(navit);
builder
- .setTitle(navit.getTstring(R.string.TTS_title_data_missing))
- .setMessage(navit.getTstring(R.string.TTS_qery_install_data))
- .setPositiveButton(navit.getTstring(R.string.yes),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent installIntent = new Intent();
- installIntent.setAction(
- TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
- navit.startActivity(installIntent);
- }
- })
+ .setTitle(navit.getTstring(R.string.TTS_title_data_missing))
+ .setMessage(navit.getTstring(R.string.TTS_qery_install_data))
+ .setPositiveButton(navit.getTstring(R.string.yes),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ Intent installIntent = new Intent();
+ installIntent.setAction(
+ TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
+ navit.startActivity(installIntent);
+ }
+ })
.setNegativeButton(navit.getTstring(R.string.no), null)
- .show();
+ .show();
}
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitTimeout.java b/navit/android/src/org/navitproject/navit/NavitTimeout.java
index 011555049..81451ab47 100644
--- a/navit/android/src/org/navitproject/navit/NavitTimeout.java
+++ b/navit/android/src/org/navitproject/navit/NavitTimeout.java
@@ -26,7 +26,7 @@ import android.util.Log;
public class NavitTimeout implements Runnable {
- private static Handler handler =new Handler() {
+ private static Handler handler = new Handler() {
public void handleMessage(Message m) {
Log.e("Navit","Handler received message");
}
@@ -34,14 +34,16 @@ public class NavitTimeout implements Runnable {
private boolean event_multi;
private int event_callbackid;
private int event_timeout;
+
public native void TimeoutCallback(int id);
NavitTimeout(int timeout, boolean multi, int callbackid) {
- event_timeout=timeout;
- event_multi=multi;
- event_callbackid=callbackid;
+ event_timeout = timeout;
+ event_multi = multi;
+ event_callbackid = callbackid;
handler.postDelayed(this, event_timeout);
}
+
public void run() {
// Log.e("Navit","Handle Event");
if (event_multi) {
@@ -49,6 +51,7 @@ public class NavitTimeout implements Runnable {
}
TimeoutCallback(event_callbackid);
}
+
public void remove() {
handler.removeCallbacks(this);
}
diff --git a/navit/android/src/org/navitproject/navit/NavitVehicle.java b/navit/android/src/org/navitproject/navit/NavitVehicle.java
index 46ffd3562..200fc3eec 100644
--- a/navit/android/src/org/navitproject/navit/NavitVehicle.java
+++ b/navit/android/src/org/navitproject/navit/NavitVehicle.java
@@ -56,11 +56,14 @@ public class NavitVehicle {
private static NavitLocationListener fastLocationListener = null;
public native void VehicleCallback(int id, Location location);
+
public native void VehicleCallback(int id, int satsInView, int satsUsed);
+
public native void VehicleCallback(int id, int enabled);
private class NavitLocationListener extends BroadcastReceiver implements GpsStatus.Listener, LocationListener {
public boolean precise = false;
+
public void onLocationChanged(Location location) {
lastLocation = location;
// Disable the fast provider if still active
@@ -72,14 +75,17 @@ public class NavitVehicle {
VehicleCallback(vehicle_pcbid, location);
VehicleCallback(vehicle_fcbid, 1);
}
+
public void onProviderDisabled(String provider) {}
+
public void onProviderEnabled(String provider) {}
+
public void onStatusChanged(String provider, int status, Bundle extras) {}
/**
* Called when the status of the GPS changes.
*/
- public void onGpsStatusChanged (int event) {
+ public void onGpsStatusChanged(int event) {
if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
@@ -101,10 +107,13 @@ public class NavitVehicle {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(GPS_FIX_CHANGE)) {
- if (intent.getBooleanExtra("enabled", false))
+ if (intent.getBooleanExtra("enabled", false)) {
VehicleCallback(vehicle_fcbid, 1);
- else if (!intent.getBooleanExtra("enabled", true))
- VehicleCallback(vehicle_fcbid, 0);
+ } else {
+ if (!intent.getBooleanExtra("enabled", true)) {
+ VehicleCallback(vehicle_fcbid, 0);
+ }
+ }
}
}
}
@@ -113,12 +122,12 @@ public class NavitVehicle {
* @brief Creates a new {@code NavitVehicle}
*
* @param context
- * @param pcbid The address of the position callback function which will be called when a location update is received
- * @param scbid The address of the status callback function which will be called when a status update is received
- * @param fcbid The address of the fix callback function which will be called when a
+ * @param pcbid The address of the position callback function called when a location update is received
+ * @param scbid The address of the status callback function called when a status update is received
+ * @param fcbid The address of the fix callback function called when a
* {@code android.location.GPS_FIX_CHANGE} is received, indicating a change in GPS fix status
*/
- NavitVehicle (Context context, int pcbid, int scbid, int fcbid) {
+ NavitVehicle(Context context, int pcbid, int scbid, int fcbid) {
if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
@@ -192,7 +201,9 @@ public class NavitVehicle {
sLocationManager.removeGpsStatusListener(preciseLocationListener);
context.unregisterReceiver(preciseLocationListener);
}
- if (fastLocationListener != null) sLocationManager.removeUpdates(fastLocationListener);
+ if (fastLocationListener != null) {
+ sLocationManager.removeUpdates(fastLocationListener);
+ }
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitWatch.java b/navit/android/src/org/navitproject/navit/NavitWatch.java
index 7933d1b0a..5f13c83a3 100644
--- a/navit/android/src/org/navitproject/navit/NavitWatch.java
+++ b/navit/android/src/org/navitproject/navit/NavitWatch.java
@@ -27,7 +27,7 @@ import java.lang.Thread;
public class NavitWatch implements Runnable {
private Thread thread;
- private static Handler handler =new Handler() {
+ private static Handler handler = new Handler() {
public void handleMessage(Message m) {
Log.e("NavitWatch","Handler received message");
}
@@ -39,16 +39,19 @@ public class NavitWatch implements Runnable {
private int watch_callbackid;
private boolean callback_pending;
private Runnable callback_runnable;
+
public native void poll(int func, int fd, int cond);
+
public native void WatchCallback(int id);
NavitWatch(int func, int fd, int cond, int callbackid) {
- // Log.e("NavitWatch","Creating new thread for "+fd+" "+cond+" from current thread " + java.lang.Thread.currentThread().getName());
- watch_func=func;
- watch_fd=fd;
- watch_cond=cond;
- watch_callbackid=callbackid;
- final NavitWatch navitwatch=this;
+ // Log.e("NavitWatch","Creating new thread for "+fd+" "+cond+" from current thread "
+ // + java.lang.Thread.currentThread().getName());
+ watch_func = func;
+ watch_fd = fd;
+ watch_cond = cond;
+ watch_callbackid = callbackid;
+ final NavitWatch navitwatch = this;
callback_runnable = new Runnable() {
public void run() {
navitwatch.callback();
@@ -57,41 +60,49 @@ public class NavitWatch implements Runnable {
thread = new Thread(this, "poll thread");
thread.start();
}
+
public void run() {
for (;;) {
- // Log.e("NavitWatch","Polling "+watch_fd+" "+watch_cond + " from " + java.lang.Thread.currentThread().getName());
+ // Log.e("NavitWatch","Polling "+watch_fd+" "+watch_cond + " from "
+ // + java.lang.Thread.currentThread().getName());
poll(watch_func, watch_fd, watch_cond);
// Log.e("NavitWatch","poll returned");
- if (removed)
+ if (removed) {
break;
- callback_pending=true;
+ }
+ callback_pending = true;
handler.post(callback_runnable);
try {
// Log.e("NavitWatch","wait");
- synchronized(this) {
- if (callback_pending)
+ synchronized (this) {
+ if (callback_pending) {
this.wait();
+ }
}
// Log.e("NavitWatch","wait returned");
} catch (Exception e) {
- Log.e("NavitWatch","Exception "+e.getMessage());
+ Log.e("NavitWatch","Exception " + e.getMessage());
}
- if (removed)
+ if (removed) {
break;
+ }
}
}
+
public void callback() {
// Log.e("NavitWatch","Calling Callback");
- if (!removed)
+ if (!removed) {
WatchCallback(watch_callbackid);
- synchronized(this) {
- callback_pending=false;
+ }
+ synchronized (this) {
+ callback_pending = false;
// Log.e("NavitWatch","Waking up");
this.notify();
}
}
+
public void remove() {
- removed=true;
+ removed = true;
thread.interrupt();
}
}
diff --git a/navit/callback.c b/navit/callback.c
index 271948cc8..c9ce5adea 100644
--- a/navit/callback.c
+++ b/navit/callback.c
@@ -37,15 +37,13 @@ struct callback_list {
GList *list;
};
-struct callback_list *
-callback_list_new(void) {
+struct callback_list * callback_list_new(void) {
struct callback_list *ret=g_new0(struct callback_list, 1);
return ret;
}
-struct callback *
-callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p) {
+struct callback * callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p) {
struct callback *ret;
int i;
@@ -59,8 +57,7 @@ callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p)
return ret;
}
-struct callback *
-callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...) {
+struct callback * callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...) {
int i;
void **p=g_alloca(sizeof(void*)*count);
va_list ap;
@@ -71,13 +68,11 @@ callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...)
return callback_new_attr(func, type, count, p);
}
-struct callback *
-callback_new(void (*func)(void), int pcount, void **p) {
+struct callback * callback_new(void (*func)(void), int pcount, void **p) {
return callback_new_attr(func, attr_none, pcount, p);
}
-struct callback *
-callback_new_args(void (*func)(void), int count, ...) {
+struct callback * callback_new_args(void (*func)(void), int count, ...) {
int i;
void **p=g_alloca(sizeof(void*)*count);
va_list ap;
@@ -103,8 +98,7 @@ void callback_list_add(struct callback_list *l, struct callback *cb) {
}
-struct callback *
-callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p) {
+struct callback * callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p) {
struct callback *ret;
ret=callback_new(func, pcount, p);
diff --git a/navit/coord.c b/navit/coord.c
index 3d2a93ad7..bb16978c8 100644
--- a/navit/coord.c
+++ b/navit/coord.c
@@ -39,15 +39,13 @@
* @returns the coordinate
*/
-struct coord *
-coord_get(unsigned char **p) {
+struct coord * coord_get(unsigned char **p) {
struct coord *ret=(struct coord *)(*p);
*p += sizeof(*ret);
return ret;
}
-struct coord *
-coord_new(int x, int y) {
+struct coord * coord_new(int x, int y) {
struct coord *c=g_new(struct coord, 1);
c->x=x;
@@ -56,8 +54,7 @@ coord_new(int x, int y) {
return c;
}
-struct coord *
-coord_new_from_attrs(struct attr *parent, struct attr **attrs) {
+struct coord * coord_new_from_attrs(struct attr *parent, struct attr **attrs) {
struct attr *x,*y;
x=attr_search(attrs, NULL, attr_x);
y=attr_search(attrs, NULL, attr_y);
@@ -71,8 +68,7 @@ void coord_destroy(struct coord *c) {
g_free(c);
}
-struct coord_rect *
-coord_rect_new(struct coord *lu, struct coord *rl) {
+struct coord_rect * coord_rect_new(struct coord *lu, struct coord *rl) {
struct coord_rect *r=g_new(struct coord_rect, 1);
dbg_assert(lu->x <= rl->x);
@@ -160,9 +156,8 @@ int coord_parse(const char *coord_input, enum projection output_projection, stru
s=strchr(str,' ');
co=strchr(str,':');
if (co && co < s) {
- proj=malloc(co-str+1);
- strncpy(proj, str, co-str);
- proj[co-str]='\0';
+ proj=g_malloc(co-str+1);
+ g_strlcpy(proj, str, 1+co-str);
dbg(lvl_debug,"projection=%s", proj);
str=co+1;
s=strchr(str,' ');
@@ -250,7 +245,7 @@ int coord_parse(const char *coord_input, enum projection output_projection, stru
ret+=str-coord_input;
dbg(lvl_info, "ret=%d delta=%d ret_str='%s'", ret, GPOINTER_TO_INT(str-coord_input), coord_input+ret);
out:
- free(proj);
+ g_free(proj);
return ret;
}
diff --git a/navit/gui/gtk/CMakeLists.txt b/navit/gui/gtk/CMakeLists.txt
index a1dfa173c..1a1ec2a7a 100644
--- a/navit/gui/gtk/CMakeLists.txt
+++ b/navit/gui/gtk/CMakeLists.txt
@@ -1,2 +1,3 @@
-module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk_poi.c)
+module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c
+ gui_gtk_poi.c)
diff --git a/navit/gui/gtk/gui_gtk.h b/navit/gui/gtk/gui_gtk.h
index 10051beaf..c8c3ca1ec 100644
--- a/navit/gui/gtk/gui_gtk.h
+++ b/navit/gui/gtk/gui_gtk.h
@@ -26,37 +26,38 @@ struct callback;
struct statusbar_priv;
struct gui_priv {
- struct navit *nav;
- GtkWidget *win;
- GtkWidget *dialog_win;
- GtkWidget *dialog_entry;
- struct pcoord dialog_coord;
- GtkWidget *vbox;
- GtkWidget *menubar;
- GtkActionGroup *base_group;
- GtkActionGroup *debug_group;
- GtkActionGroup *dyn_group;
- GtkUIManager *ui_manager;
- GSList *layout_group;
- GSList *projection_group;
- GSList *vehicle_group;
- GList *dest_menuitems;
- GList *bookmarks_menuitems;
- GList *vehicle_menuitems;
- GtkUIManager *menu_manager; // old
- struct statusbar_priv *statusbar;
- int menubar_enable;
- int toolbar_enable;
- int statusbar_enable;
- int dyn_counter;
- struct datawindow_priv *datawindow;
+ struct navit *nav;
+ GtkWidget *win;
+ GtkWidget *dialog_win;
+ GtkWidget *dialog_entry;
+ struct pcoord dialog_coord;
+ GtkWidget *vbox;
+ GtkWidget *menubar;
+ GtkActionGroup *base_group;
+ GtkActionGroup *debug_group;
+ GtkActionGroup *dyn_group;
+ GtkUIManager *ui_manager;
+ GSList *layout_group;
+ GSList *projection_group;
+ GSList *vehicle_group;
+ GList *dest_menuitems;
+ GList *bookmarks_menuitems;
+ GList *vehicle_menuitems;
+ GtkUIManager *menu_manager; // old
+ struct statusbar_priv *statusbar;
+ int menubar_enable;
+ int toolbar_enable;
+ int statusbar_enable;
+ int dyn_counter;
+ struct datawindow_priv *datawindow;
};
void gui_gtk_ui_init(struct gui_priv *this);
struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui);
struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
-struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click,
+ struct callback *close, struct datawindow_methods *meth);
void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
index ac2fa2221..503bc321f 100644
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ b/navit/gui/gtk/gui_gtk_poi.c
@@ -35,7 +35,7 @@
#include "attr.h"
#include "util.h"
-#include "navigation.h" /* for KILOMETERS_TO_MILES */
+#include "navigation.h" /* for FEET_PER_METER and other conversion factors. */
static struct gtk_poi_search {
GtkWidget *entry_distance;
@@ -124,14 +124,15 @@ static GtkTreeModel *model_poi (struct gtk_poi_search *search) {
if (imperial == FALSE) {
/* Input is in kilometers */
search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
+ gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in km"));
} else {
/* Input is in miles. */
search_distance_meters=atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)))/METERS_TO_MILES;
+ gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in miles"));
}
cursor_position.x=navit_get_width(search->nav)/2;
cursor_position.y=navit_get_height(search->nav)/2;
- gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center"));
transform_reverse(navit_get_trans(search->nav), &cursor_position, &center);
pc.pro = transform_get_projection(navit_get_trans(search->nav));
@@ -163,7 +164,8 @@ static GtkTreeModel *model_poi (struct gtk_poi_search *search) {
* If the user has selected imperial, translate idist from meters to
* feet. We convert to feet only, and not miles, because the code
* sorts on the numeric value of the distance, so it doesn't like two
- * different units. Possible future enhancement?
+ * different units. Currently, the distance is an int. Can it be made
+ * a float? Possible future enhancement?
*/
if (imperial != FALSE) {
idist = idist * (FEET_PER_METER); /* convert meters to feet. */
@@ -308,9 +310,22 @@ void gtk_gui_poi(struct navit *nav) {
table = gtk_table_new(4, 4, FALSE);
label_category = gtk_label_new(_("Select a category"));
- search->label_distance = gtk_label_new(_("Select a distance to look for (km)"));
label_poi=gtk_label_new(_("Select a POI"));
+ /* Respect the Imperial attribute as we enlighten the user. */
+ struct attr attr;
+ int imperial = FALSE; /* default to using metric measures. */
+ if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL))
+ imperial=attr.u.num;
+
+ if (imperial == FALSE) {
+ /* Input is in kilometers */
+ search->label_distance = gtk_label_new(_("Select a search radius from screen center in km"));
+ } else {
+ /* Input is in miles. */
+ search->label_distance = gtk_label_new(_("Select a search radius from screen center in miles"));
+ }
+
search->entry_distance=gtk_entry_new_with_max_length(2);
gtk_entry_set_text(GTK_ENTRY(search->entry_distance),"10");
@@ -338,8 +353,8 @@ void gtk_gui_poi(struct navit *nav) {
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Direction"), renderer, "text",
0,NULL);
renderer=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance(m)"), renderer,
- "text", 1, NULL);
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance"), renderer, "text",
+ 1, NULL);
renderer=gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Name"), renderer, "text", 2,
NULL);
diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c
index fd2c092f5..782add46f 100644
--- a/navit/gui/gtk/gui_gtk_window.c
+++ b/navit/gui/gtk/gui_gtk_window.c
@@ -338,7 +338,8 @@ static void gui_gtk_del_menu(struct gui_priv *this, struct gui_menu_info *meninf
gtk_ui_manager_remove_ui(this->ui_manager, meninfo->merge_id);
}
-static struct gui_menu_info gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu, struct action_cb_data *data) {
+static struct gui_menu_info gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu,
+ struct action_cb_data *data) {
struct gui_menu_info meninfo;
GtkAction *action;
guint merge_id;
@@ -364,7 +365,8 @@ static void gui_gtk_action_toggled(GtkToggleAction *action, struct action_cb_dat
navit_draw(data->gui->nav);
}
-static void gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, gboolean active) {
+static void gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path,
+ struct action_cb_data *data, gboolean active) {
GtkToggleAction *toggle_action;
guint merge_id;
@@ -382,7 +384,8 @@ static void gui_gtk_action_changed(GtkRadioAction *action, GtkRadioAction *curre
}
}
-static struct gui_menu_info gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, GSList **g) {
+static struct gui_menu_info gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path,
+ struct action_cb_data *data, GSList **g) {
struct gui_menu_info meninfo;
GtkRadioAction *radio_action;
guint merge_id;
diff --git a/navit/gui/internal/CMakeLists.txt b/navit/gui/internal/CMakeLists.txt
index 230e315d6..b758ba7e6 100644
--- a/navit/gui/internal/CMakeLists.txt
+++ b/navit/gui/internal/CMakeLists.txt
@@ -1 +1,3 @@
-module_add_library(gui_internal gui_internal.c gui_internal_bookmark.c gui_internal_command.c gui_internal_gesture.c gui_internal_html.c gui_internal_menu.c gui_internal_poi.c gui_internal_search.c gui_internal_widget.c gui_internal_keyboard.c)
+module_add_library(gui_internal gui_internal.c gui_internal_bookmark.c gui_internal_command.c gui_internal_gesture.c
+ gui_internal_html.c gui_internal_menu.c gui_internal_poi.c gui_internal_search.c gui_internal_widget.c
+ gui_internal_keyboard.c)
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index a3df6c235..39e0b6d18 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -236,7 +236,8 @@ static void gui_internal_button_attr_pressed(struct gui_priv *this, struct widge
}
struct widget *
-gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on, struct attr *off) {
+gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on,
+ struct attr *off) {
struct graphics_image *image=NULL;
struct widget *ret;
if (!on && !off)
@@ -258,7 +259,8 @@ gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum
}
struct widget *
-gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt) {
+gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map,
+ struct attr *on, struct attr *off, int deflt) {
struct graphics_image *image=NULL;
struct widget *ret;
image=image_new_xs(this, "gui_inactive");
@@ -526,7 +528,9 @@ void gui_internal_apply_config(struct gui_priv *this) {
if(this->config.spacing == -1 ) {
this->spacing = current_config->spacing;
} else {
- this->spacing = current_config->spacing;
+ this->spacing = this->config.spacing;
+ dbg(lvl_info, "Overriding default spacing %d with value %d provided in config file", current_config->spacing,
+ this->config.spacing);
}
if (!this->fonts[0]) {
int i,sizes[]= {100,66,50};
@@ -1182,7 +1186,8 @@ static void gui_internal_cmd_delete_waypoint(struct gui_priv *this, struct widge
* 2048: "Show search results on the map"
* TODO define constants for these values
*/
-void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, struct widget *wm, const char *name, int flags) {
+void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in,
+ struct widget *wm, const char *name, int flags) {
struct widget *wb,*w,*wtable,*row,*wc,*wbc,*wclosest=NULL;
struct coord_geo g;
struct pcoord pc;
@@ -2785,7 +2790,8 @@ static int gui_internal_keynav_find_prev(struct widget *wi, struct widget *curre
return NO_RESULT_YET;
}
-static void gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int dy, int *distance, struct widget **result) {
+static void gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int dy, int *distance,
+ struct widget **result) {
GList *l=wi->children;
// Skip hidden elements
if (wi->p.x==0 && wi->p.y==0 && wi->w==0 && wi->h==0)
@@ -3292,7 +3298,8 @@ void gui_internal_populate_route_table(struct gui_priv * this, struct navit * na
//# Comment:
//# Authors: Martin Schaller (04/2008)
//##############################################################################################################
-static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui) {
+static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs,
+ struct gui *gui) {
struct color color_white= {0xffff,0xffff,0xffff,0xffff};
struct color color_black= {0x0,0x0,0x0,0xffff};
struct color back2_color= {0x4141,0x4141,0x4141,0xffff};
diff --git a/navit/gui/internal/gui_internal.h b/navit/gui/internal/gui_internal.h
index 1a5cd13d3..734d31d38 100644
--- a/navit/gui/internal/gui_internal.h
+++ b/navit/gui/internal/gui_internal.h
@@ -15,71 +15,72 @@ struct gui_priv;
#define GESTURE_RINGSIZE 100
enum widget_type {
- widget_box=1,
- widget_button,
- widget_label,
- widget_image,
- widget_table,
- widget_table_row
+ widget_box=1,
+ widget_button,
+ widget_label,
+ widget_image,
+ widget_table,
+ widget_table_row
};
enum flags {
- gravity_none=0x00,
- gravity_left=1,
- gravity_xcenter=2,
- gravity_right=4,
- gravity_top=8,
- gravity_ycenter=16,
- gravity_bottom=32,
- gravity_left_top=gravity_left|gravity_top,
- gravity_top_center=gravity_xcenter|gravity_top,
- gravity_right_top=gravity_right|gravity_top,
- gravity_left_center=gravity_left|gravity_ycenter,
- gravity_center=gravity_xcenter|gravity_ycenter,
- gravity_right_center=gravity_right|gravity_ycenter,
- gravity_left_bottom=gravity_left|gravity_bottom,
- gravity_bottom_center=gravity_xcenter|gravity_bottom,
- gravity_right_bottom=gravity_right|gravity_bottom,
- flags_expand=0x100,
- flags_fill=0x200,
- flags_swap=0x400,
- flags_scrollx=0x800,
- flags_scrolly=0x1000,
- orientation_horizontal=0x10000,
- orientation_vertical=0x20000,
- orientation_horizontal_vertical=0x40000,
+ gravity_none=0x00,
+ gravity_left=1,
+ gravity_xcenter=2,
+ gravity_right=4,
+ gravity_top=8,
+ gravity_ycenter=16,
+ gravity_bottom=32,
+ gravity_left_top=gravity_left|gravity_top,
+ gravity_top_center=gravity_xcenter|gravity_top,
+ gravity_right_top=gravity_right|gravity_top,
+ gravity_left_center=gravity_left|gravity_ycenter,
+ gravity_center=gravity_xcenter|gravity_ycenter,
+ gravity_right_center=gravity_right|gravity_ycenter,
+ gravity_left_bottom=gravity_left|gravity_bottom,
+ gravity_bottom_center=gravity_xcenter|gravity_bottom,
+ gravity_right_bottom=gravity_right|gravity_bottom,
+ flags_expand=0x100,
+ flags_fill=0x200,
+ flags_swap=0x400,
+ flags_scrollx=0x800,
+ flags_scrolly=0x1000,
+ orientation_horizontal=0x10000,
+ orientation_vertical=0x20000,
+ orientation_horizontal_vertical=0x40000,
};
struct gui_internal_methods {
- void (*add_callback)(struct gui_priv *priv, struct callback *cb);
- void (*remove_callback)(struct gui_priv *priv, struct callback *cb);
- void (*menu_render)(struct gui_priv *this);
- struct graphics_image * (*image_new_xs)(struct gui_priv *this, const char *name);
- struct graphics_image * (*image_new_l)(struct gui_priv *this, const char *name);
+ void (*add_callback)(struct gui_priv *priv, struct callback *cb);
+ void (*remove_callback)(struct gui_priv *priv, struct callback *cb);
+ void (*menu_render)(struct gui_priv *this);
+ struct graphics_image * (*image_new_xs)(struct gui_priv *this, const char *name);
+ struct graphics_image * (*image_new_l)(struct gui_priv *this, const char *name);
};
struct gui_internal_widget_methods {
- void (*append)(struct widget *parent, struct widget *child);
- struct widget * (*button_new)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags);
- struct widget * (*button_new_with_callback)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
- struct widget * (*box_new)(struct gui_priv *this, enum flags flags);
- struct widget * (*label_new)(struct gui_priv *this, const char *text);
- struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image);
- struct widget * (*keyboard)(struct gui_priv *this, int mode);
- struct widget * (*menu)(struct gui_priv *this, const char *label);
- enum flags (*get_flags)(struct widget *widget);
- void (*set_flags)(struct widget *widget, enum flags flags);
- int (*get_state)(struct widget *widget);
- void (*set_state)(struct widget *widget, int state);
- void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data));
- void (*set_data)(struct widget *widget, void *data);
- void (*set_default_background)(struct gui_priv *this, struct widget *widget);
+ void (*append)(struct widget *parent, struct widget *child);
+ struct widget * (*button_new)(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags);
+ struct widget * (*button_new_with_callback)(struct gui_priv *this, const char *text, struct graphics_image *image,
+ enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
+ struct widget * (*box_new)(struct gui_priv *this, enum flags flags);
+ struct widget * (*label_new)(struct gui_priv *this, const char *text);
+ struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image);
+ struct widget * (*keyboard)(struct gui_priv *this, int mode);
+ struct widget * (*menu)(struct gui_priv *this, const char *label);
+ enum flags (*get_flags)(struct widget *widget);
+ void (*set_flags)(struct widget *widget, enum flags flags);
+ int (*get_state)(struct widget *widget);
+ void (*set_state)(struct widget *widget, int state);
+ void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data));
+ void (*set_data)(struct widget *widget, void *data);
+ void (*set_default_background)(struct gui_priv *this, struct widget *widget);
};
struct gui_internal_data {
- struct gui_priv *priv;
- struct gui_internal_methods *gui;
- struct gui_internal_widget_methods *widget;
+ struct gui_priv *priv;
+ struct gui_internal_methods *gui;
+ struct gui_internal_widget_methods *widget;
};
diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h
index 9b9039224..b9887c915 100644
--- a/navit/gui/internal/gui_internal_keyboard.h
+++ b/navit/gui/internal/gui_internal_keyboard.h
@@ -2,21 +2,21 @@
* Modes for the on-screen keyboard
*/
enum vkbd_mode {
- /* layouts */
- VKBD_LATIN_UPPER = 0, /*!< Latin uppercase characters */
- VKBD_LATIN_LOWER = 8, /*!< Latin lowercase characters */
- VKBD_NUMERIC = 16, /*!< Numeric keyboard */
- VKBD_UMLAUT_UPPER = 24, /*!< Extended Latin uppercase characters */
- VKBD_UMLAUT_LOWER = 32, /*!< Extended Latin lowercase characters */
- VKBD_CYRILLIC_UPPER = 40, /*!< Cyrillic uppercase characters */
- VKBD_CYRILLIC_LOWER = 48, /*!< Cyrillic lowercase characters */
- VKBD_DEGREE = 56, /*!< Numeric keyboard with extra characters (NESW, degree, minute) for coordinate input */
+ /* layouts */
+ VKBD_LATIN_UPPER = 0, /*!< Latin uppercase characters */
+ VKBD_LATIN_LOWER = 8, /*!< Latin lowercase characters */
+ VKBD_NUMERIC = 16, /*!< Numeric keyboard */
+ VKBD_UMLAUT_UPPER = 24, /*!< Extended Latin uppercase characters */
+ VKBD_UMLAUT_LOWER = 32, /*!< Extended Latin lowercase characters */
+ VKBD_CYRILLIC_UPPER = 40, /*!< Cyrillic uppercase characters */
+ VKBD_CYRILLIC_LOWER = 48, /*!< Cyrillic lowercase characters */
+ VKBD_DEGREE = 56, /*!< Numeric keyboard with extra characters (NESW, degree, minute) for coordinate input */
- /* modifiers and masks */
- VKBD_FLAG_2 = 2, /* FIXME seems to show alpha/num switch (VKBD_NUMERIC and VKBD_LATIN_* only) and switches to lowercase after first character */
- VKBD_MASK_7 = 7, /* FIXME modifiers for layout? */
- VKBD_FLAG_1024 = 1024, /* FIXME what is this for? Seems to have to do something with scroll box visibility */
- VKBD_LAYOUT_MASK = ~7, /* when XORed with the mode, preserves only the layout FIXME document properly */
+ /* modifiers and masks */
+ VKBD_FLAG_2 = 2, /* FIXME seems to show alpha/num switch (VKBD_NUMERIC and VKBD_LATIN_* only) and switches to lowercase after first character */
+ VKBD_MASK_7 = 7, /* FIXME modifiers for layout? */
+ VKBD_FLAG_1024 = 1024, /* FIXME what is this for? Seems to have to do something with scroll box visibility */
+ VKBD_LAYOUT_MASK = ~7, /* when XORed with the mode, preserves only the layout FIXME document properly */
};
/* prototypes */
diff --git a/navit/gui/internal/gui_internal_poi.h b/navit/gui/internal/gui_internal_poi.h
index 4e6bed74b..c2515a1c6 100644
--- a/navit/gui/internal/gui_internal_poi.h
+++ b/navit/gui/internal/gui_internal_poi.h
@@ -6,40 +6,40 @@
struct poi_param {
- /**
- * =1 if selnb is defined, 0 otherwize.
- */
- unsigned char sel;
+ /**
+ * =1 if selnb is defined, 0 otherwize.
+ */
+ unsigned char sel;
- /**
- * Index to struct selector selectors[], shows what type of POIs is defined.
- */
- unsigned char selnb;
- /**
- * Page number to display.
- */
- unsigned char pagenb;
- /**
- * Radius (number of 10-kilometer intervals) to search for POIs.
- */
- unsigned char dist;
- /**
- * Should filter phrase be compared to postal address of the POI.
- * =0 - name filter, =1 - address filter, =2 - address filter, including postal code
- */
- unsigned char AddressFilterType;
- /**
- * Filter string, casefold()ed and divided into substrings at the spaces, which are replaced by ASCII 0*.
- */
- char *filterstr;
- /**
- * list of pointers to individual substrings of filterstr.
- */
- GList *filter;
- /**
- * Number of POIs in this list
- */
- int count;
+ /**
+ * Index to struct selector selectors[], shows what type of POIs is defined.
+ */
+ unsigned char selnb;
+ /**
+ * Page number to display.
+ */
+ unsigned char pagenb;
+ /**
+ * Radius (number of 10-kilometer intervals) to search for POIs.
+ */
+ unsigned char dist;
+ /**
+ * Should filter phrase be compared to postal address of the POI.
+ * =0 - name filter, =1 - address filter, =2 - address filter, including postal code
+ */
+ unsigned char AddressFilterType;
+ /**
+ * Filter string, casefold()ed and divided into substrings at the spaces, which are replaced by ASCII 0*.
+ */
+ char *filterstr;
+ /**
+ * list of pointers to individual substrings of filterstr.
+ */
+ GList *filter;
+ /**
+ * Number of POIs in this list
+ */
+ int count;
};
/* prototypes */
@@ -50,7 +50,8 @@ struct poi_param;
struct widget;
void gui_internal_poi_param_free(void *p);
void gui_internal_poi_param_set_filter(struct poi_param *param, char *text);
-struct widget *gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, struct coord *c, struct route *route, int dist, char *name);
+struct widget *gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item,
+ struct coord *c, struct route *route, int dist, char *name);
char *gui_internal_compose_item_address_string(struct item *item, int prependPostal);
void gui_internal_cmd_pois_filter(struct gui_priv *this, struct widget *wm, void *data);
void gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data);
diff --git a/navit/gui/internal/gui_internal_priv.h b/navit/gui/internal/gui_internal_priv.h
index 66b3e41fe..d28cac649 100644
--- a/navit/gui/internal/gui_internal_priv.h
+++ b/navit/gui/internal/gui_internal_priv.h
@@ -6,33 +6,33 @@
*/
struct gui_config_settings {
- /**
- * The base size (in fractions of a point) to use for text.
- */
- int font_size;
- /**
- * The size (in pixels) that xs style icons should be scaled to.
- * This icon size is typically used in various lists and should be set to value which allows a list row to be easily cliked or dragged.
- */
- int icon_xs;
- /**
- * The size (in pixels) that s style icons (small) should be scaled to, used for the menu top row icons
- */
- int icon_s;
- /**
- * The size (in pixels) that l style icons should be scaled to, used for icons defined in the menu html
- */
- int icon_l;
- /**
- * The default amount of spacing (in pixels) to place between GUI elements.
- */
- int spacing;
+ /**
+ * The base size (in fractions of a point) to use for text.
+ */
+ int font_size;
+ /**
+ * The size (in pixels) that xs style icons should be scaled to.
+ * This icon size is typically used in various lists and should be set to value which allows a list row to be easily cliked or dragged.
+ */
+ int icon_xs;
+ /**
+ * The size (in pixels) that s style icons (small) should be scaled to, used for the menu top row icons
+ */
+ int icon_s;
+ /**
+ * The size (in pixels) that l style icons should be scaled to, used for icons defined in the menu html
+ */
+ int icon_l;
+ /**
+ * The default amount of spacing (in pixels) to place between GUI elements.
+ */
+ int spacing;
};
struct route_data {
- struct widget * route_table;
- int route_showing;
+ struct widget * route_table;
+ int route_showing;
};
/**
@@ -41,136 +41,136 @@ struct route_data {
* @author Martin Schaller (04/2008)
*/
struct gui_priv {
- struct navit *nav;
- struct attr self;
- struct window *win;
- struct graphics *gra;
- struct graphics_gc *background;
- struct graphics_gc *background2;
- struct graphics_gc *highlight_background;
- struct graphics_gc *foreground;
- struct graphics_gc *text_foreground;
- struct graphics_gc *text_background;
- struct color background_color, background2_color, text_foreground_color, text_background_color;
- int spacing;
- int font_size;
- char *font_name;
- int fullscreen;
- struct graphics_font *fonts[3];
- int icon_xs; /**< The size (in pixels) that xs style icons should be scaled to.
+ struct navit *nav;
+ struct attr self;
+ struct window *win;
+ struct graphics *gra;
+ struct graphics_gc *background;
+ struct graphics_gc *background2;
+ struct graphics_gc *highlight_background;
+ struct graphics_gc *foreground;
+ struct graphics_gc *text_foreground;
+ struct graphics_gc *text_background;
+ struct color background_color, background2_color, text_foreground_color, text_background_color;
+ int spacing;
+ int font_size;
+ char *font_name;
+ int fullscreen;
+ struct graphics_font *fonts[3];
+ int icon_xs; /**< The size (in pixels) that xs style icons should be scaled to.
* This icon size can be too small to click it on some devices.
*/
- int icon_s; /**< The size (in pixels) that s style icons (small) should be scaled to */
- int icon_l; /**< The size (in pixels) that l style icons should be scaled to */
- int pressed;
- struct widget *widgets;
- int widgets_count;
- int redraw;
- struct widget root;
- struct widget *highlighted,*editable;
- struct widget *highlighted_menu;
- struct pcoord clickp, vehiclep;
- struct attr *click_coord_geo, *position_coord_geo;
- struct search_list *sl;
- int ignore_button;
- int menu_on_map_click;
- char *on_map_click;
- int signal_on_map_click;
- char *country_iso2;
- int speech;
- int keyboard; /**< Whether the internal GUI keyboard is enabled */
- int keyboard_required; /**< Whether keyboard input is needed. This is only used by the
+ int icon_s; /**< The size (in pixels) that s style icons (small) should be scaled to */
+ int icon_l; /**< The size (in pixels) that l style icons should be scaled to */
+ int pressed;
+ struct widget *widgets;
+ int widgets_count;
+ int redraw;
+ struct widget root;
+ struct widget *highlighted,*editable;
+ struct widget *highlighted_menu;
+ struct pcoord clickp, vehiclep;
+ struct attr *click_coord_geo, *position_coord_geo;
+ struct search_list *sl;
+ int ignore_button;
+ int menu_on_map_click;
+ char *on_map_click;
+ int signal_on_map_click;
+ char *country_iso2;
+ int speech;
+ int keyboard; /**< Whether the internal GUI keyboard is enabled */
+ int keyboard_required; /**< Whether keyboard input is needed. This is only used by the
* HTML menu, text entry dialogs do not use this member.
*/
- struct gui_config_settings config; /**< The setting information read from the configuration file.
+ struct gui_config_settings config; /**< The setting information read from the configuration file.
* values of -1 indicate no value was specified in the config file.
*/
- struct event_idle *idle;
- struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback;
- struct event_timeout *motion_timeout_event;
- struct point current;
+ struct event_idle *idle;
+ struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*window_closed_cb,*idle_cb, *motion_timeout_callback;
+ struct event_timeout *motion_timeout_event;
+ struct point current;
- struct callback * vehicle_cb;
- struct route_data route_data; /**< Stores information about the route. */
+ struct callback * vehicle_cb;
+ struct route_data route_data; /**< Stores information about the route. */
- struct gui_internal_data data;
- struct callback_list *cbl;
- int flags;
- int cols;
- struct attr osd_configuration; /**< The OSD configuration, a set of flags controlling which OSD
+ struct gui_internal_data data;
+ struct callback_list *cbl;
+ int flags;
+ int cols;
+ struct attr osd_configuration; /**< The OSD configuration, a set of flags controlling which OSD
* items will be visible.
*/
- int pitch; /**< The pitch for the 3D map view. */
- int flags_town,flags_street,flags_house_number;
- int radius;
- int mouse_button_clicked_on_map;
-/* html */
- char *html_text;
- int html_depth;
- struct widget *html_container;
- int html_skip;
- char *html_anchor;
- char *href;
- int html_anchor_found;
- struct form *form;
- struct html {
- int skip;
- enum html_tag {
- html_tag_none,
- html_tag_a,
- html_tag_h1,
- html_tag_html,
- html_tag_img,
- html_tag_script,
- html_tag_form,
- html_tag_input,
- html_tag_div,
- } tag;
- char *command;
- char *name;
- char *href;
- char *refresh_cond;
- char *class;
- int font_size;
- struct widget *w;
- struct widget *container;
- } html[10];
+ int pitch; /**< The pitch for the 3D map view. */
+ int flags_town,flags_street,flags_house_number;
+ int radius;
+ int mouse_button_clicked_on_map;
+ /* html */
+ char *html_text;
+ int html_depth;
+ struct widget *html_container;
+ int html_skip;
+ char *html_anchor;
+ char *href;
+ int html_anchor_found;
+ struct form *form;
+ struct html {
+ int skip;
+ enum html_tag {
+ html_tag_none,
+ html_tag_a,
+ html_tag_h1,
+ html_tag_html,
+ html_tag_img,
+ html_tag_script,
+ html_tag_form,
+ html_tag_input,
+ html_tag_div,
+ } tag;
+ char *command;
+ char *name;
+ char *href;
+ char *refresh_cond;
+ char *class;
+ int font_size;
+ struct widget *w;
+ struct widget *container;
+ } html[10];
-/* gestures */
+ /* gestures */
- struct gesture_elem {
- long long msec;
- struct point p;
- } gesture_ring[GESTURE_RINGSIZE];
- int gesture_ring_last, gesture_ring_first;
+ struct gesture_elem {
+ long long msec;
+ struct point p;
+ } gesture_ring[GESTURE_RINGSIZE];
+ int gesture_ring_last, gesture_ring_first;
- int hide_keys; //Flag to set the keyboard mode 1: hide impossible keys on search; 0: highlight them.
- int results_map_population;
+ int hide_keys; //Flag to set the keyboard mode 1: hide impossible keys on search; 0: highlight them.
+ int results_map_population;
};
struct menu_data {
- struct widget *search_list;
- struct widget *keyboard;
- struct widget *button_bar;
- struct widget *menu;
- int keyboard_mode;
- void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
- struct widget *redisplay_widget;
- char *href;
- struct attr refresh_callback_obj,refresh_callback;
+ struct widget *search_list;
+ struct widget *keyboard;
+ struct widget *button_bar;
+ struct widget *menu;
+ int keyboard_mode;
+ void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
+ struct widget *redisplay_widget;
+ char *href;
+ struct attr refresh_callback_obj,refresh_callback;
};
struct heightline {
- struct heightline *next;
- int height;
- struct coord_rect bbox;
- int count;
- struct coord c[0];
+ struct heightline *next;
+ int height;
+ struct coord_rect bbox;
+ int count;
+ struct coord c[0];
};
struct diagram_point {
- struct diagram_point *next;
- struct coord c;
+ struct diagram_point *next;
+ struct coord c;
};
/* prototypes */
enum flags;
@@ -190,18 +190,22 @@ struct widget;
struct graphics_image *image_new_xs(struct gui_priv *this, const char *name);
struct graphics_image *image_new_s(struct gui_priv *this, const char *name);
struct graphics_image *image_new_l(struct gui_priv *this, const char *name);
-struct widget *gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct attr *on, struct attr *off);
-struct widget *gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt);
+struct widget *gui_internal_button_navit_attr_new(struct gui_priv *this, const char *text, enum flags flags,
+ struct attr *on, struct attr *off);
+struct widget *gui_internal_button_map_attr_new(struct gui_priv *this, const char *text, enum flags flags,
+ struct map *map, struct attr *on, struct attr *off, int deflt);
void gui_internal_say(struct gui_priv *this, struct widget *w, int questionmark);
void gui_internal_back(struct gui_priv *this, struct widget *w, void *data);
void gui_internal_cmd_return(struct gui_priv *this, struct widget *wm, void *data);
void gui_internal_cmd_main_menu(struct gui_priv *this, struct widget *wm, void *data);
struct widget *gui_internal_time_help(struct gui_priv *this);
void gui_internal_apply_config(struct gui_priv *this);
-void gui_internal_select_waypoint(struct gui_priv *this, const char *title, const char *hint, struct widget *wm_, void (*cmd)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
+void gui_internal_select_waypoint(struct gui_priv *this, const char *title, const char *hint, struct widget *wm_,
+ void (*cmd)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
void gui_internal_call_linked_on_finish(struct gui_priv *this, struct widget *wm, void *data);
char *removecase(char *s);
-void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, struct widget *wm, const char *name, int flags);
+void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in,
+ struct widget *wm, const char *name, int flags);
void gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data);
void gui_internal_cmd_bookmarks(struct gui_priv *this, struct widget *wm, void *data);
void gui_internal_keypress_do(struct gui_priv *this, char *key);
diff --git a/navit/gui/internal/gui_internal_widget.h b/navit/gui/internal/gui_internal_widget.h
index 33f03e478..c1cc030f8 100644
--- a/navit/gui/internal/gui_internal_widget.h
+++ b/navit/gui/internal/gui_internal_widget.h
@@ -1,7 +1,7 @@
enum gui_internal_reason {
- gui_internal_reason_click=1,
- gui_internal_reason_keypress,
- gui_internal_reason_keypress_finish
+ gui_internal_reason_click=1,
+ gui_internal_reason_keypress,
+ gui_internal_reason_keypress_finish
};
//##############################################################################################################
@@ -10,96 +10,96 @@ enum gui_internal_reason {
//# Authors: Martin Schaller (04/2008)
//##############################################################################################################
struct widget {
- enum widget_type type;
- struct graphics_gc *background,*text_background;
- struct graphics_gc *foreground_frame;
- struct graphics_gc *foreground;
- char *text;
- struct graphics_image *img;
- /**
- * A function to be invoked on actions.
- * @li widget The widget that is receiving the button press.
- *
- */
- void (*func)(struct gui_priv *priv, struct widget *widget, void *data);
- enum gui_internal_reason reason;
- int datai;
- void *data;
- /**
- * @brief A function to deallocate data
- */
- void (*data_free)(void *data);
+ enum widget_type type;
+ struct graphics_gc *background,*text_background;
+ struct graphics_gc *foreground_frame;
+ struct graphics_gc *foreground;
+ char *text;
+ struct graphics_image *img;
+ /**
+ * A function to be invoked on actions.
+ * @li widget The widget that is receiving the button press.
+ *
+ */
+ void (*func)(struct gui_priv *priv, struct widget *widget, void *data);
+ enum gui_internal_reason reason;
+ int datai;
+ void *data;
+ /**
+ * @brief A function to deallocate data
+ */
+ void (*data_free)(void *data);
- /**
- * @brief a function that will be called as the widget is being destroyed.
- * This function can act as a destructor for the widget. It allows for
- * on deallocation actions to be specified on a per widget basis.
- * This function will call g_free on the widget (if required).
- */
- void (*wfree) (struct gui_priv *this_, struct widget * w);
- char *prefix;
- char *name;
- char *speech;
- char *command;
- struct pcoord c;
- struct item item;
- int selection_id;
- int state;
- struct point p;
- int wmin,hmin;
- int w,h;
- int textw,texth;
- int font_idx;
- int bl,br,bt,bb,spx,spy;
- int border;
- int packed;
- /**
- * The number of widgets to layout horizontally when doing
- * a orientation_horizontal_vertical layout
- */
- int cols;
- enum flags flags;
- int flags2;
- void *instance;
- int (*set_attr)(void *, struct attr *);
- int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *);
- void (*remove_cb)(void *, struct callback *cb);
- struct callback *cb;
- struct attr on;
- struct attr off;
- int deflt;
- int is_on;
- int redraw;
- struct menu_data *menu_data;
- struct form *form;
- GList *children;
- struct widget *parent;
- struct scroll_buttons *scroll_buttons;
+ /**
+ * @brief a function that will be called as the widget is being destroyed.
+ * This function can act as a destructor for the widget. It allows for
+ * on deallocation actions to be specified on a per widget basis.
+ * This function will call g_free on the widget (if required).
+ */
+ void (*wfree) (struct gui_priv *this_, struct widget * w);
+ char *prefix;
+ char *name;
+ char *speech;
+ char *command;
+ struct pcoord c;
+ struct item item;
+ int selection_id;
+ int state;
+ struct point p;
+ int wmin,hmin;
+ int w,h;
+ int textw,texth;
+ int font_idx;
+ int bl,br,bt,bb,spx,spy;
+ int border;
+ int packed;
+ /**
+ * The number of widgets to layout horizontally when doing
+ * a orientation_horizontal_vertical layout
+ */
+ int cols;
+ enum flags flags;
+ int flags2;
+ void *instance;
+ int (*set_attr)(void *, struct attr *);
+ int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *);
+ void (*remove_cb)(void *, struct callback *cb);
+ struct callback *cb;
+ struct attr on;
+ struct attr off;
+ int deflt;
+ int is_on;
+ int redraw;
+ struct menu_data *menu_data;
+ struct form *form;
+ GList *children;
+ struct widget *parent;
+ struct scroll_buttons *scroll_buttons;
};
struct scroll_buttons {
- /**
- * Button box should not be displayed if button_box_hide is not zero.
- */
- int button_box_hide;
- /**
- * A container box that is the child of the table widget that contains+groups
- * the next and previous button.
- */
- struct widget * button_box;
- /**
- * A button widget to handle 'next page' requests
- */
- struct widget * next_button;
- /**
- * A button widget to handle 'previous page' requests.
- */
- struct widget * prev_button;
- /**
- * a pointer to the gui context.
- * This is needed by the free function to destroy the buttons.
- */
- struct gui_priv * this;
+ /**
+ * Button box should not be displayed if button_box_hide is not zero.
+ */
+ int button_box_hide;
+ /**
+ * A container box that is the child of the table widget that contains+groups
+ * the next and previous button.
+ */
+ struct widget * button_box;
+ /**
+ * A button widget to handle 'next page' requests
+ */
+ struct widget * next_button;
+ /**
+ * A button widget to handle 'previous page' requests.
+ */
+ struct widget * prev_button;
+ /**
+ * a pointer to the gui context.
+ * This is needed by the free function to destroy the buttons.
+ */
+ struct gui_priv * this;
};
/**
@@ -111,20 +111,19 @@ struct scroll_buttons {
* The table_data structure needs to be freed with data_free along with the widget.
*
*/
-struct table_data
-{
- /**
- * A GList pointer into a widget->children list that indicates the row
- * currently being rendered at the top of the table.
- */
- GList * top_row;
- /**
- * A Glist pointer into a widget->children list that indicates the row
- * currently being rendered at the bottom of the table.
- */
- GList * bottom_row;
+struct table_data {
+ /**
+ * A GList pointer into a widget->children list that indicates the row
+ * currently being rendered at the top of the table.
+ */
+ GList * top_row;
+ /**
+ * A Glist pointer into a widget->children list that indicates the row
+ * currently being rendered at the bottom of the table.
+ */
+ GList * bottom_row;
- struct scroll_buttons scroll_buttons;
+ struct scroll_buttons scroll_buttons;
};
@@ -133,18 +132,17 @@ struct table_data
*
*
*/
-struct table_column_desc
-{
+struct table_column_desc {
- /**
- * The computed height of a cell in the table.
- */
- int height;
+ /**
+ * The computed height of a cell in the table.
+ */
+ int height;
- /**
- * The computed width of a cell in the table.
- */
- int width;
+ /**
+ * The computed width of a cell in the table.
+ */
+ int width;
};
/* prototypes */
enum flags;
@@ -159,9 +157,14 @@ struct widget *gui_internal_label_new_abbrev(struct gui_priv *this, const char *
struct widget *gui_internal_image_new(struct gui_priv *this, struct graphics_image *image);
struct widget *gui_internal_text_font_new(struct gui_priv *this, const char *text, int font, enum flags flags);
struct widget *gui_internal_text_new(struct gui_priv *this, const char *text, enum flags flags);
-struct widget *gui_internal_button_font_new_with_callback(struct gui_priv *this, const char *text, int font, struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
-struct widget *gui_internal_button_new_with_callback(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
-struct widget *gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags);
+struct widget *gui_internal_button_font_new_with_callback(struct gui_priv *this, const char *text, int font,
+ struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data),
+ void *data);
+struct widget *gui_internal_button_new_with_callback(struct gui_priv *this, const char *text,
+ struct graphics_image *image, enum flags flags, void (*func)(struct gui_priv *priv, struct widget *widget, void *data),
+ void *data);
+struct widget *gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image,
+ enum flags flags);
struct widget *gui_internal_find_widget(struct widget *wi, struct point *p, int flags);
void gui_internal_highlight_do(struct gui_priv *this, struct widget *found);
void gui_internal_highlight(struct gui_priv *this);
diff --git a/navit/maps/CMakeLists.txt b/navit/maps/CMakeLists.txt
index 3bd7a8f44..dbda66e2e 100644
--- a/navit/maps/CMakeLists.txt
+++ b/navit/maps/CMakeLists.txt
@@ -2,7 +2,6 @@ if(SAMPLE_MAP)
set(SAMPLE_MAP_NAME osm_bbox_11.3,47.9,11.7,48.2)
set(maptool_args "--attr-debug-level=5")
- GET_TARGET_PROPERTY(MAPTOOL_PATH maptool LOCATION)
add_custom_target(sample_map ALL DEPENDS ${SAMPLE_MAP_NAME}.xml)
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.xml
@@ -25,7 +24,7 @@ if(SAMPLE_MAP)
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin
COMMAND bzcat ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.osm.bz2
- | ${MAPTOOL_PATH} ${maptool_args} ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin
+ | $<TARGET_FILE:maptool> ${maptool_args} ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.bin
VERBATIM
DEPENDS maptool ${CMAKE_CURRENT_BINARY_DIR}/${SAMPLE_MAP_NAME}.osm.bz2
)
diff --git a/navit/script/mapExtract.class.php b/navit/script/mapExtract.class.php
index 8d96ec76f..da6a5a5d4 100644
--- a/navit/script/mapExtract.class.php
+++ b/navit/script/mapExtract.class.php
@@ -13,50 +13,50 @@ class mapExtract {
$formats = array();
$formats['ziphpack'] = "lssssslLLSS";
- $formats['zipheader'] = "l" . "ziplocsig"; # Signature (is always the same)
- $formats['zipheader'] .= "/s" . "zipver"; # zip version needed
- $formats['zipheader'] .= "/s" . "zipgenfld";# type of os that generated the file
- $formats['zipheader'] .= "/s" . "zipmthd"; #
- $formats['zipheader'] .= "/s" . "ziptime"; # time
- $formats['zipheader'] .= "/s" . "zipdate"; # date
- $formats['zipheader'] .= "/l" . "zipcrc"; # crc checksum
- $formats['zipheader'] .= "/L" . "zipsize"; # data size
- $formats['zipheader'] .= "/L" . "zipuncmp"; # uncompressed size
- $formats['zipheader'] .= "/S" . "zipfnln"; # length of filename
- $formats['zipheader'] .= "/S" . "zipxtraln";# length of extra data (always 0)
+ $formats['zipheader'] = "lziplocsig"; # Signature (is always the same)
+ $formats['zipheader'] .= "/szipver"; # zip version needed
+ $formats['zipheader'] .= "/szipgenfld";# type of os that generated the file
+ $formats['zipheader'] .= "/szipmthd"; #
+ $formats['zipheader'] .= "/sziptime"; # time
+ $formats['zipheader'] .= "/szipdate"; # date
+ $formats['zipheader'] .= "/lzipcrc"; # crc checksum
+ $formats['zipheader'] .= "/Lzipsize"; # data size
+ $formats['zipheader'] .= "/Lzipuncmp"; # uncompressed size
+ $formats['zipheader'] .= "/Szipfnln"; # length of filename
+ $formats['zipheader'] .= "/Szipxtraln";# length of extra data (always 0)
$formats['zipcdpack'] = "iccccssssiIISSSSSII";
$formats['zipcd'] = "".
- "i" . "zipcensig/".
- "c" . "zipcver/".
- "c" . "zipcos/".
- "c" . "zipcvxt/".
- "c" . "zipcexos/".
- "s" . "zipcflg/".
- "s" . "zipcmthd/".
- "s" . "ziptim/".
- "s" . "zipdat/".
- "i" . "zipccrc/".
- "I" . "zipcsiz/".
- "I" . "zipcunc/".
- "S" . "zipcfnl/".
- "S" . "zipcxtl/".
- "S" . "zipccml/".
- "S" . "zipdsk/".
- "S" . "zipint/".
- "I" . "zipext/".
- "I" . "zipofst";
+ "izipcensig/".
+ "czipcver/".
+ "czipcos/".
+ "czipcvxt/".
+ "czipcexos/".
+ "szipcflg/".
+ "szipcmthd/".
+ "sziptim/".
+ "szipdat/".
+ "izipccrc/".
+ "Izipcsiz/".
+ "Izipcunc/".
+ "Szipcfnl/".
+ "Szipcxtl/".
+ "Szipccml/".
+ "Szipdsk/".
+ "Szipint/".
+ "Izipext/".
+ "Izipofst";
$formats['zipeocpack'] = "iSSSSIIs";
$formats['zipeoc'] = "".
- "i" . "zipesig/".
- "S" . "zipedsk/".
- "S" . "zipecen/".
- "S" . "zipenum/".
- "S" . "zipecenn/".
- "I" . "zipecsz/".
- "I" . "zipeofst/".
- "s" . "zipecoml/".
+ "izipesig/".
+ "Szipedsk/".
+ "Szipecen/".
+ "Szipenum/".
+ "Szipecenn/".
+ "Izipecsz/".
+ "Izipeofst/".
+ "szipecoml/";
$world_bbox = array();
$world_bbox['l']['x'] = -20000000;
diff --git a/navit/script/mapextract.php b/navit/script/mapextract.php
index 0e114c746..84ca21b22 100644
--- a/navit/script/mapextract.php
+++ b/navit/script/mapextract.php
@@ -41,38 +41,38 @@ $files['output'] = 'myarea.bin';
$formats = array();
$formats['ziphpack'] = "lssssslLLSS";
-$formats['zipheader'] = "l" . "ziplocsig"; # Signature (is always the same)
-$formats['zipheader'] .= "/s" . "zipver"; # zip version needed
-$formats['zipheader'] .= "/s" . "zipgenfld";# type of os that generated the file
-$formats['zipheader'] .= "/s" . "zipmthd"; #
-$formats['zipheader'] .= "/s" . "ziptime"; # time
-$formats['zipheader'] .= "/s" . "zipdate"; # date
-$formats['zipheader'] .= "/l" . "zipcrc"; # crc checksum
-$formats['zipheader'] .= "/L" . "zipsize"; # data size
-$formats['zipheader'] .= "/L" . "zipuncmp"; # uncompressed size
-$formats['zipheader'] .= "/S" . "zipfnln"; # length of filename
-$formats['zipheader'] .= "/S" . "zipxtraln";# length of extra data (always 0)
+$formats['zipheader'] = "lziplocsig"; # Signature (is always the same)
+$formats['zipheader'] .= "/szipver"; # zip version needed
+$formats['zipheader'] .= "/szipgenfld";# type of os that generated the file
+$formats['zipheader'] .= "/szipmthd"; #
+$formats['zipheader'] .= "/sziptime"; # time
+$formats['zipheader'] .= "/szipdate"; # date
+$formats['zipheader'] .= "/lzipcrc"; # crc checksum
+$formats['zipheader'] .= "/Lzipsize"; # data size
+$formats['zipheader'] .= "/Lzipuncmp"; # uncompressed size
+$formats['zipheader'] .= "/Szipfnln"; # length of filename
+$formats['zipheader'] .= "/Szipxtraln";# length of extra data (always 0)
$formats['zipcd'] = "".
- "i" . "zipcensig/".
- "c" . "zipcver/".
- "c" . "zipcos/".
- "c" . "zipcvxt/".
- "c" . "zipcexos/".
- "s" . "zipcflg/".
- "s" . "zipcmthd/".
- "s" . "ziptim/".
- "s" . "zipdat/".
- "i" . "zipccrc/".
- "I" . "zipcsiz/".
- "I" . "zipcunc/".
- "S" . "zipcfnl/".
- "S" . "zipcxtl/".
- "S" . "zipccml/".
- "S" . "zipdsk/".
- "S" . "zipint/".
- "I" . "zipext/".
- "I" . "zipofst/".
+ "izipcensig/".
+ "czipcver/".
+ "czipcos/".
+ "czipcvxt/".
+ "czipcexos/".
+ "szipcflg/".
+ "szipcmthd/".
+ "sziptim/".
+ "szipdat/".
+ "izipccrc/".
+ "Izipcsiz/".
+ "Izipcunc/".
+ "Szipcfnl/".
+ "Szipcxtl/".
+ "Szipccml/".
+ "Szipdsk/".
+ "Szipint/".
+ "Izipext/".
+ "Izipofst/";
$formats['zipcdpack'] = "iccccssssiIISSSSSII";
$formats['zipcontent'] = "i5x/i5y/ii";