… | |
… | |
45 | import java.io.IOException;
|
45 | import java.io.IOException;
|
46 | import java.io.InputStream;
|
46 | import java.io.InputStream;
|
47 | import java.io.ObjectInputStream;
|
47 | import java.io.ObjectInputStream;
|
48 | import java.io.ObjectOutputStream;
|
48 | import java.io.ObjectOutputStream;
|
49 | import java.io.OutputStream;
|
49 | import java.io.OutputStream;
|
|
|
50 | import java.io.OutputStreamWriter;
|
50 | import java.io.Serializable;
|
51 | import java.io.Serializable;
|
51 | import java.net.URLDecoder;
|
52 | import java.net.URLDecoder;
|
52 | import java.nio.channels.FileChannel;
|
53 | import java.nio.channels.FileChannel;
|
53 | import java.util.ArrayList;
|
54 | import java.util.ArrayList;
|
54 | import java.util.HashSet;
|
55 | import java.util.HashSet;
|
… | |
… | |
105 | import android.view.inputmethod.InputMethodManager;
|
106 | import android.view.inputmethod.InputMethodManager;
|
106 | import android.widget.RelativeLayout;
|
107 | import android.widget.RelativeLayout;
|
107 | import android.widget.TextView;
|
108 | import android.widget.TextView;
|
108 | import android.widget.Toast;
|
109 | import android.widget.Toast;
|
109 |
|
110 |
|
110 | import com.casadelgato.widgets.NumberPicker;
|
111 | import com.lamerman.FileDialog;
|
|
|
112 | import com.lamerman.SelectionMode;
|
111 | import com.zoffcc.applications.zanavi.NavitMapDownloader.ProgressThread;
|
113 | import com.zoffcc.applications.zanavi.NavitMapDownloader.ProgressThread;
|
|
|
114 |
|
|
|
115 | import de.oberoner.gpx2navit_txt.MainFrame;
|
112 |
|
116 |
|
113 | public class Navit extends Activity implements Handler.Callback, SensorEventListener
|
117 | public class Navit extends Activity implements Handler.Callback, SensorEventListener
|
114 | {
|
118 | {
|
115 | public static final String VERSION_TEXT_LONG_INC_REV = "1401";
|
119 | public static final String VERSION_TEXT_LONG_INC_REV = "1851";
|
116 | public static String NavitAppVersion = "0";
|
120 | public static String NavitAppVersion = "0";
|
117 | public static String NavitAppVersion_prev = "-1";
|
121 | public static String NavitAppVersion_prev = "-1";
|
118 | public static String NavitAppVersion_string = "0";
|
122 | public static String NavitAppVersion_string = "0";
|
|
|
123 | public final Boolean NAVIT_IS_EMULATOR = false; // when running on emulator set to true!!
|
|
|
124 |
|
|
|
125 | // define graphics here (this is bad, please fix me!)
|
|
|
126 | public static NavitGraphics N_NavitGraphics = null;
|
|
|
127 |
|
|
|
128 | AlertDialog.Builder generic_alert_box = null;
|
|
|
129 |
|
119 | private Boolean xmlconfig_unpack_file = true;
|
130 | private Boolean xmlconfig_unpack_file = true;
|
120 | private Boolean write_new_version_file = true;
|
131 | private Boolean write_new_version_file = true;
|
121 | final static int Navit_Status_COMPLETE_NEW_INSTALL = 1;
|
132 | final static int Navit_Status_COMPLETE_NEW_INSTALL = 1;
|
122 | final static int Navit_Status_UPGRADED_TO_NEW_VERSION = 2;
|
133 | final static int Navit_Status_UPGRADED_TO_NEW_VERSION = 2;
|
123 | final static int Navit_Status_NORMAL_STARTUP = 0;
|
134 | final static int Navit_Status_NORMAL_STARTUP = 0;
|
… | |
… | |
246 | String nextturn_image_filename = "";
|
257 | String nextturn_image_filename = "";
|
247 | Boolean nextturn_image_valid = false;
|
258 | Boolean nextturn_image_valid = false;
|
248 | Bitmap nextturn_image = null;
|
259 | Bitmap nextturn_image = null;
|
249 | Boolean nextturn_distance_valid = false;
|
260 | Boolean nextturn_distance_valid = false;
|
250 | String nextturn_distance = "";
|
261 | String nextturn_distance = "";
|
|
|
262 | String nextturn_streetname = "";
|
|
|
263 | String nextturn_streetname_systematic = "";
|
251 | }
|
264 | }
|
252 |
|
265 |
|
253 | public static final class Navit_OSD_scale
|
266 | public static final class Navit_OSD_scale
|
254 | {
|
267 | {
|
255 | Boolean scale_valid = false;
|
268 | Boolean scale_valid = false;
|
… | |
… | |
299 | public static final int NavitDownloaderPriSelectMap_id = 967;
|
312 | public static final int NavitDownloaderPriSelectMap_id = 967;
|
300 | public static final int NavitDownloaderSecSelectMap_id = 968;
|
313 | public static final int NavitDownloaderSecSelectMap_id = 968;
|
301 | public static final int NavitDeleteSecSelectMap_id = 969;
|
314 | public static final int NavitDeleteSecSelectMap_id = 969;
|
302 | public static final int NavitRecentDest_id = 970;
|
315 | public static final int NavitRecentDest_id = 970;
|
303 | public static final int NavitGeoCoordEnter_id = 971;
|
316 | public static final int NavitGeoCoordEnter_id = 971;
|
|
|
317 | public static final int NavitGPXConvChooser_id = 972;
|
304 | public static int download_map_id = 0;
|
318 | public static int download_map_id = 0;
|
305 | ProgressThread progressThread_pri = null;
|
319 | ProgressThread progressThread_pri = null;
|
306 | ProgressThread progressThread_sec = null;
|
320 | ProgressThread progressThread_sec = null;
|
307 | public static int search_results_towns = 0;
|
321 | public static int search_results_towns = 0;
|
308 | public static int search_results_streets = 0;
|
322 | public static int search_results_streets = 0;
|
… | |
… | |
348 | public static int Navit_last_address_search_country_flags = 3;
|
362 | public static int Navit_last_address_search_country_flags = 3;
|
349 | public static int Navit_last_address_search_country_id = 0;
|
363 | public static int Navit_last_address_search_country_id = 0;
|
350 | public static Boolean Navit_last_address_partial_match = false;
|
364 | public static Boolean Navit_last_address_partial_match = false;
|
351 | public static Geocoder Navit_Geocoder = null;
|
365 | public static Geocoder Navit_Geocoder = null;
|
352 | public static String UserAgentString = null;
|
366 | public static String UserAgentString = null;
|
|
|
367 | public static String UserAgentString_bind = null;
|
353 | public static Boolean first_ever_startup = false;
|
368 | public static Boolean first_ever_startup = false;
|
354 |
|
369 |
|
355 | public static Boolean Navit_Announcer = true;
|
370 | public static Boolean Navit_Announcer = true;
|
356 |
|
371 |
|
357 | public static final int MAP_NUM_SECONDARY = 12;
|
372 | public static final int MAP_NUM_SECONDARY = 12;
|
… | |
… | |
361 | static final String NAVIT_DATA_DIR = "/data/data/com.zoffcc.applications.zanavi";
|
376 | static final String NAVIT_DATA_DIR = "/data/data/com.zoffcc.applications.zanavi";
|
362 | static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
|
377 | static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
|
363 | static final String FIRST_STARTUP_FILE = NAVIT_DATA_SHARE_DIR + "/has_run_once.txt";
|
378 | static final String FIRST_STARTUP_FILE = NAVIT_DATA_SHARE_DIR + "/has_run_once.txt";
|
364 | static final String VERSION_FILE = NAVIT_DATA_SHARE_DIR + "/version.txt";
|
379 | static final String VERSION_FILE = NAVIT_DATA_SHARE_DIR + "/version.txt";
|
365 | static final String Navit_DEST_FILENAME = "destinations.dat";
|
380 | static final String Navit_DEST_FILENAME = "destinations.dat";
|
|
|
381 |
|
|
|
382 | static boolean PREF_use_fast_provider;
|
|
|
383 | static boolean PREF_follow_gps;
|
|
|
384 | static boolean PREF_use_compass_heading_base;
|
|
|
385 | static boolean PREF_use_compass_heading_always;
|
|
|
386 | static boolean PREF_allow_gui_internal;
|
|
|
387 | static boolean PREF_show_vehicle_in_center;
|
|
|
388 | static boolean PREF_use_imperial;
|
|
|
389 | static boolean PREF_use_compass_heading_fast;
|
|
|
390 | static boolean PREF_use_anti_aliasing;
|
|
|
391 | static boolean PREF_gui_oneway_arrows;
|
|
|
392 | static boolean PREF_show_debug_messages;
|
|
|
393 | static boolean PREF_show_3d_map;
|
|
|
394 | static boolean PREF_use_lock_on_roads;
|
|
|
395 | static boolean PREF_use_route_highways;
|
|
|
396 | static boolean PREF_save_zoomlevel;
|
|
|
397 | static boolean PREF_show_sat_status;
|
|
|
398 | static boolean PREF_use_agps;
|
|
|
399 | static boolean PREF_enable_debug_functions;
|
|
|
400 | static boolean PREF_speak_street_names;
|
|
|
401 | static int PREF_search_country = 1; // default=*ALL*
|
|
|
402 | static int PREF_zoomlevel_num = 2 * 2 * 2 * 2 * 2;
|
|
|
403 | static boolean PREF_use_custom_font = true;
|
|
|
404 | static int PREF_map_font_size = 2; // 1 -> small, 2 -> normal, 3 -> large, 4-> extra large, 4-> mega large
|
|
|
405 | static int PREF_cancel_map_drawing_timeout = 1; // 0 -> short, 1-> normal, 2-> long, 3-> almost unlimited
|
|
|
406 | static boolean PREF_draw_polyline_circles = true; // true -> yes (default) false -> no
|
|
|
407 | static int PREF_mapcache = 10 * 1024; // in kbytes
|
|
|
408 | static String PREF_navit_lang;
|
|
|
409 | static int PREF_drawatorder = 1;
|
|
|
410 | static String PREF_streetsearch_r = "1"; // street search radius factor (multiplier)
|
|
|
411 | static String PREF_route_style = "1"; // 1 -> under green 2 -> on top blue
|
366 |
|
412 |
|
367 | static Resources res_ = null;
|
413 | static Resources res_ = null;
|
368 |
|
414 |
|
369 | public static String get_text(String in)
|
415 | public static String get_text(String in)
|
370 | {
|
416 | {
|
… | |
… | |
482 |
|
528 |
|
483 | getBaseContext_ = getBaseContext();
|
529 | getBaseContext_ = getBaseContext();
|
484 |
|
530 |
|
485 | res_ = getResources();
|
531 | res_ = getResources();
|
486 |
|
532 |
|
|
|
533 | String font_file_name = "Roboto-Regular.ttf"; // "LiberationSans-Regular.ttf";
|
487 | NavitStreetnameFont = Typeface.createFromAsset(getBaseContext().getAssets(), "Soutane Regular.ttf");
|
534 | NavitStreetnameFont = Typeface.createFromAsset(getBaseContext().getAssets(), font_file_name);
|
488 |
|
535 |
|
489 | Navit_maps_loaded = false;
|
536 | Navit_maps_loaded = false;
|
490 |
|
537 |
|
491 | // only take arguments here, onResume gets called all the time (e.g. when screenblanks, etc.)
|
538 | // only take arguments here, onResume gets called all the time (e.g. when screenblanks, etc.)
|
492 | Navit.startup_intent = this.getIntent();
|
539 | Navit.startup_intent = this.getIntent();
|
… | |
… | |
512 |
|
559 |
|
513 | // get map data dir and set it -----------------------------
|
560 | // get map data dir and set it -----------------------------
|
514 | getPrefs_mapdir();
|
561 | getPrefs_mapdir();
|
515 | activatePrefs_mapdir(true);
|
562 | activatePrefs_mapdir(true);
|
516 | // get map data dir and set it -----------------------------
|
563 | // get map data dir and set it -----------------------------
|
|
|
564 |
|
|
|
565 | // make sure the new path for the navitmap.bin file(s) exist!!
|
|
|
566 | File navit_maps_dir = new File(MAP_FILENAME_PATH);
|
|
|
567 | navit_maps_dir.mkdirs();
|
|
|
568 | // create nomedia files
|
|
|
569 | File nomedia_file = new File(MAP_FILENAME_PATH + ".nomedia");
|
|
|
570 | try
|
|
|
571 | {
|
|
|
572 | nomedia_file.createNewFile();
|
|
|
573 | }
|
|
|
574 | catch (IOException e1)
|
|
|
575 | {
|
|
|
576 | e1.printStackTrace();
|
|
|
577 | }
|
|
|
578 | // create nomedia files
|
|
|
579 |
|
|
|
580 | // check if we already have a borders.bin file (if not, then extract the included simplified one)
|
|
|
581 | File b_ = new File(MAP_FILENAME_PATH + "/borders.bin");
|
|
|
582 | try
|
|
|
583 | {
|
|
|
584 | if (!b_.exists())
|
|
|
585 | {
|
|
|
586 | try
|
|
|
587 | {
|
|
|
588 | File c_ = new File(MAPMD5_FILENAME_PATH + "/borders.bin.md5");
|
|
|
589 | c_.delete();
|
|
|
590 | }
|
|
|
591 | catch (Exception e2)
|
|
|
592 | {
|
|
|
593 |
|
|
|
594 | }
|
|
|
595 | Log.e("Navit", "trying to extract borders simple resource to:" + MAP_FILENAME_PATH + "/borders.bin");
|
|
|
596 | if (!extractRes("borders_simple", MAP_FILENAME_PATH + "/borders.bin"))
|
|
|
597 | {
|
|
|
598 | Log.e("Navit", "Failed to extract borders simple resource to:" + MAP_FILENAME_PATH + "/borders.bin");
|
|
|
599 | }
|
|
|
600 | }
|
|
|
601 | }
|
|
|
602 | catch (Exception e)
|
|
|
603 | {
|
|
|
604 |
|
|
|
605 | }
|
|
|
606 | // check if we already have a borders.bin file
|
517 |
|
607 |
|
518 | // get the local language -------------
|
608 | // get the local language -------------
|
519 | Locale locale = java.util.Locale.getDefault();
|
609 | Locale locale = java.util.Locale.getDefault();
|
520 | String lang = locale.getLanguage();
|
610 | String lang = locale.getLanguage();
|
521 | String langu = lang;
|
611 | String langu = lang;
|
… | |
… | |
545 | // get the local language -------------
|
635 | // get the local language -------------
|
546 |
|
636 |
|
547 | // make sure the new path for config files exist
|
637 | // make sure the new path for config files exist
|
548 | File navit_cfg_dir = new File(CFG_FILENAME_PATH);
|
638 | File navit_cfg_dir = new File(CFG_FILENAME_PATH);
|
549 | navit_cfg_dir.mkdirs();
|
639 | navit_cfg_dir.mkdirs();
|
550 |
|
|
|
551 | // make sure the new path for the navitmap.bin file(s) exist!!
|
|
|
552 | File navit_maps_dir = new File(MAP_FILENAME_PATH);
|
|
|
553 | navit_maps_dir.mkdirs();
|
|
|
554 |
|
640 |
|
555 | // make sure the new path for the navitmap.bin file(s) exist!!
|
641 | // make sure the new path for the navitmap.bin file(s) exist!!
|
556 | File navit_mapsmd5_dir = new File(MAPMD5_FILENAME_PATH);
|
642 | File navit_mapsmd5_dir = new File(MAPMD5_FILENAME_PATH);
|
557 | navit_mapsmd5_dir.mkdirs();
|
643 | navit_mapsmd5_dir.mkdirs();
|
558 |
|
644 |
|
… | |
… | |
796 |
|
882 |
|
797 | String android_rom_name = DISPLAY;
|
883 | String android_rom_name = DISPLAY;
|
798 | if (Navit_DonateVersion_Installed == false)
|
884 | if (Navit_DonateVersion_Installed == false)
|
799 | {
|
885 | {
|
800 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "Z" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
886 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "Z" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
|
|
887 | UserAgentString_bind = "Mozilla/5.0 @__THREAD__@ (Linux; U; " + "Z" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
801 | }
|
888 | }
|
802 | else
|
889 | else
|
803 | {
|
890 | {
|
804 | if (Navit_Largemap_DonateVersion_Installed == false)
|
891 | if (Navit_Largemap_DonateVersion_Installed == false)
|
805 | {
|
892 | {
|
806 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "donateZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
893 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "donateZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
|
|
894 | UserAgentString_bind = "Mozilla/5.0 @__THREAD__@ (Linux; U; " + "donateZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
807 | }
|
895 | }
|
808 | else
|
896 | else
|
809 | {
|
897 | {
|
810 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "LMdonateLMZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
898 | UserAgentString = "Mozilla/5.0 (Linux; U; " + "LMdonateLMZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
|
|
899 | UserAgentString_bind = "Mozilla/5.0 @__THREAD__@ (Linux; U; " + "LMdonateLMZ" + NavitAppVersion + "; " + android_version + "; " + android_device + " " + android_rom_name + ")";
|
811 | }
|
900 | }
|
812 | }
|
901 | }
|
813 | // System.out.println("UA=" + UserAgentString);
|
902 | // System.out.println("UA=" + UserAgentString);
|
814 |
|
903 |
|
815 | unsupported = false;
|
904 | unsupported = false;
|
… | |
… | |
837 | }
|
926 | }
|
838 |
|
927 |
|
839 | try
|
928 | try
|
840 | {
|
929 | {
|
841 | // this hangs the emulator, if emulator < 2.3 (only works in emulator >= 2.3)!!
|
930 | // this hangs the emulator, if emulator < 2.3 (only works in emulator >= 2.3)!!
|
|
|
931 | if (!NAVIT_IS_EMULATOR)
|
|
|
932 | {
|
842 | sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
|
933 | sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
|
|
|
934 | }
|
843 | }
|
935 | }
|
844 | catch (Exception e3)
|
936 | catch (Exception e3)
|
845 | {
|
937 | {
|
846 | e3.printStackTrace();
|
938 | e3.printStackTrace();
|
847 | }
|
939 | }
|
… | |
… | |
854 | // {
|
946 | // {
|
855 | // e.printStackTrace();
|
947 | // e.printStackTrace();
|
856 | // }
|
948 | // }
|
857 | //sensorManager_ = sensorManager;
|
949 | //sensorManager_ = sensorManager;
|
858 |
|
950 |
|
|
|
951 | generic_alert_box = new AlertDialog.Builder(this);
|
859 | /*
|
952 | /*
|
860 | * show info box for first time users
|
953 | * show info box for first time users
|
861 | */
|
954 | */
|
862 | AlertDialog.Builder infobox = new AlertDialog.Builder(this);
|
955 | AlertDialog.Builder infobox = new AlertDialog.Builder(this);
|
863 | //. english text: Welcome to ZANavi
|
956 | //. english text: Welcome to ZANavi
|
… | |
… | |
1222 | try
|
1315 | try
|
1223 | {
|
1316 | {
|
1224 | NavitGraphics.debug_line_1 = texta;
|
1317 | NavitGraphics.debug_line_1 = texta;
|
1225 | NavitGraphics.debug_line_2 = textb;
|
1318 | NavitGraphics.debug_line_2 = textb;
|
1226 | NavitGraphics.debug_line_3 = textc;
|
1319 | NavitGraphics.debug_line_3 = textc;
|
1227 | NavitGraphics.NavitMsgTv_.setMaxLines(3);
|
1320 | NavitGraphics.NavitMsgTv_.setMaxLines(4);
|
1228 | NavitGraphics.NavitMsgTv_.setLines(3);
|
1321 | NavitGraphics.NavitMsgTv_.setLines(4);
|
1229 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3);
|
1322 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3 + "\n " + NavitGraphics.debug_line_4);
|
1230 | NavitGraphics.NavitMsgTv_.invalidate();
|
1323 | NavitGraphics.NavitMsgTv_.invalidate();
|
1231 | }
|
1324 | }
|
1232 | catch (Exception e)
|
1325 | catch (Exception e)
|
1233 | {
|
1326 | {
|
1234 | e.printStackTrace();
|
1327 | e.printStackTrace();
|
… | |
… | |
1238 | public static void set_debug_messages1(String text)
|
1331 | public static void set_debug_messages1(String text)
|
1239 | {
|
1332 | {
|
1240 | try
|
1333 | try
|
1241 | {
|
1334 | {
|
1242 | NavitGraphics.debug_line_1 = text;
|
1335 | NavitGraphics.debug_line_1 = text;
|
1243 | NavitGraphics.NavitMsgTv_.setMaxLines(3);
|
1336 | NavitGraphics.NavitMsgTv_.setMaxLines(4);
|
1244 | NavitGraphics.NavitMsgTv_.setLines(3);
|
1337 | NavitGraphics.NavitMsgTv_.setLines(4);
|
1245 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3);
|
1338 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3 + "\n " + NavitGraphics.debug_line_4);
|
1246 | NavitGraphics.NavitMsgTv_.invalidate();
|
1339 | NavitGraphics.NavitMsgTv_.invalidate();
|
1247 | }
|
1340 | }
|
1248 | catch (Exception e)
|
1341 | catch (Exception e)
|
1249 | {
|
1342 | {
|
1250 | e.printStackTrace();
|
1343 | e.printStackTrace();
|
… | |
… | |
1254 | public static void set_debug_messages2(String text)
|
1347 | public static void set_debug_messages2(String text)
|
1255 | {
|
1348 | {
|
1256 | try
|
1349 | try
|
1257 | {
|
1350 | {
|
1258 | NavitGraphics.debug_line_2 = text;
|
1351 | NavitGraphics.debug_line_2 = text;
|
1259 | NavitGraphics.NavitMsgTv_.setMaxLines(3);
|
1352 | NavitGraphics.NavitMsgTv_.setMaxLines(4);
|
1260 | NavitGraphics.NavitMsgTv_.setLines(3);
|
1353 | NavitGraphics.NavitMsgTv_.setLines(4);
|
1261 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3);
|
1354 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3 + "\n " + NavitGraphics.debug_line_4);
|
1262 | NavitGraphics.NavitMsgTv_.invalidate();
|
1355 | NavitGraphics.NavitMsgTv_.invalidate();
|
1263 | }
|
1356 | }
|
1264 | catch (Exception e)
|
1357 | catch (Exception e)
|
1265 | {
|
1358 | {
|
1266 | e.printStackTrace();
|
1359 | e.printStackTrace();
|
… | |
… | |
1270 | public static void set_debug_messages3(String text)
|
1363 | public static void set_debug_messages3(String text)
|
1271 | {
|
1364 | {
|
1272 | try
|
1365 | try
|
1273 | {
|
1366 | {
|
1274 | NavitGraphics.debug_line_3 = text;
|
1367 | NavitGraphics.debug_line_3 = text;
|
1275 | NavitGraphics.NavitMsgTv_.setMaxLines(3);
|
1368 | NavitGraphics.NavitMsgTv_.setMaxLines(4);
|
1276 | NavitGraphics.NavitMsgTv_.setLines(3);
|
1369 | NavitGraphics.NavitMsgTv_.setLines(4);
|
1277 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3);
|
1370 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3 + "\n " + NavitGraphics.debug_line_4);
|
|
|
1371 | NavitGraphics.NavitMsgTv_.invalidate();
|
|
|
1372 | }
|
|
|
1373 | catch (Exception e)
|
|
|
1374 | {
|
|
|
1375 | e.printStackTrace();
|
|
|
1376 | }
|
|
|
1377 | }
|
|
|
1378 |
|
|
|
1379 | public static void set_debug_messages4(String text)
|
|
|
1380 | {
|
|
|
1381 | try
|
|
|
1382 | {
|
|
|
1383 | NavitGraphics.debug_line_4 = text;
|
|
|
1384 | NavitGraphics.NavitMsgTv_.setMaxLines(4);
|
|
|
1385 | NavitGraphics.NavitMsgTv_.setLines(4);
|
|
|
1386 | NavitGraphics.NavitMsgTv_.setText(" " + NavitGraphics.debug_line_1 + "\n " + NavitGraphics.debug_line_2 + "\n " + NavitGraphics.debug_line_3 + "\n " + NavitGraphics.debug_line_4);
|
1278 | NavitGraphics.NavitMsgTv_.invalidate();
|
1387 | NavitGraphics.NavitMsgTv_.invalidate();
|
1279 | }
|
1388 | }
|
1280 | catch (Exception e)
|
1389 | catch (Exception e)
|
1281 | {
|
1390 | {
|
1282 | e.printStackTrace();
|
1391 | e.printStackTrace();
|
… | |
… | |
1405 | if ((intent_data != null) && (intent_data.substring(0, 18).equals("google.navigation:")))
|
1514 | if ((intent_data != null) && (intent_data.substring(0, 18).equals("google.navigation:")))
|
1406 | {
|
1515 | {
|
1407 | // better use regex later, but for now to test this feature its ok :-)
|
1516 | // better use regex later, but for now to test this feature its ok :-)
|
1408 | // better use regex later, but for now to test this feature its ok :-)
|
1517 | // better use regex later, but for now to test this feature its ok :-)
|
1409 |
|
1518 |
|
|
|
1519 | // g: google.navigation:///?ll=49.4086,17.4855&entry=w&opt=
|
1410 | // d: google.navigation:q=blabla-strasse # (this happens when you are offline, or from contacts)
|
1520 | // d: google.navigation:q=blabla-strasse # (this happens when you are offline, or from contacts)
|
1411 | // b: google.navigation:q=48.25676,16.643
|
1521 | // b: google.navigation:q=48.25676,16.643
|
1412 | // a: google.navigation:ll=48.25676,16.643&q=blabla-strasse
|
1522 | // a: google.navigation:ll=48.25676,16.643&q=blabla-strasse
|
1413 | // e: google.navigation:ll=48.25676,16.643&title=blabla-strasse
|
1523 | // e: google.navigation:ll=48.25676,16.643&title=blabla-strasse
|
1414 | // sample: -> google.navigation:ll=48.026096,16.023993&title=N%C3%B6stach+43%2C+2571+N%C3%B6stach&entry=w
|
1524 | // sample: -> google.navigation:ll=48.026096,16.023993&title=N%C3%B6stach+43%2C+2571+N%C3%B6stach&entry=w
|
… | |
… | |
1476 | // if b: then remodel the input string to look like a:
|
1586 | // if b: then remodel the input string to look like a:
|
1477 | else if (intent_data.substring(0, 20).equals("google.navigation:q="))
|
1587 | else if (intent_data.substring(0, 20).equals("google.navigation:q="))
|
1478 | {
|
1588 | {
|
1479 | intent_data = "ll=" + intent_data.split("q=", -1)[1] + "&q=Target";
|
1589 | intent_data = "ll=" + intent_data.split("q=", -1)[1] + "&q=Target";
|
1480 | Log.e("Navit", "target found (b): " + intent_data);
|
1590 | Log.e("Navit", "target found (b): " + intent_data);
|
|
|
1591 | parsable = true;
|
|
|
1592 | }
|
|
|
1593 | // if g: [google.navigation:///?ll=49.4086,17.4855&...] then remodel the input string to look like a:
|
|
|
1594 | else if (intent_data.substring(0, 25).equals("google.navigation:///?ll="))
|
|
|
1595 | {
|
|
|
1596 | intent_data = "google.navigation:ll=" + intent_data.split("ll=", -1)[1].split("&", -1)[0] + "&q=Target";
|
|
|
1597 | Log.e("Navit", "target found (g): " + intent_data);
|
1481 | parsable = true;
|
1598 | parsable = true;
|
1482 | }
|
1599 | }
|
1483 | // if e: then remodel the input string to look like a:
|
1600 | // if e: then remodel the input string to look like a:
|
1484 | else if ((intent_data.substring(0, 21).equals("google.navigation:ll=")) && (intent_data.split("&").length > 1) && (intent_data.split("&")[1].substring(0, 1).toLowerCase().equals("f")))
|
1601 | else if ((intent_data.substring(0, 21).equals("google.navigation:ll=")) && (intent_data.split("&").length > 1) && (intent_data.split("&")[1].substring(0, 1).toLowerCase().equals("f")))
|
1485 | {
|
1602 | {
|
… | |
… | |
1676 | }
|
1793 | }
|
1677 | }
|
1794 | }
|
1678 | }
|
1795 | }
|
1679 |
|
1796 |
|
1680 | }
|
1797 | }
|
|
|
1798 | else if ((intent_data != null) && (intent_data.substring(0, 4).equals("geo:")))
|
|
|
1799 | {
|
|
|
1800 | // g: geo:16.8,46.3?z=15
|
|
|
1801 |
|
|
|
1802 | boolean parsable = false;
|
|
|
1803 | boolean unparsable_info_box = true;
|
|
|
1804 |
|
|
|
1805 | String tmp1;
|
|
|
1806 | String tmp2;
|
|
|
1807 | String tmp3;
|
|
|
1808 | float lat1 = 0;
|
|
|
1809 | float lon1 = 0;
|
|
|
1810 | int zoom1 = 15;
|
|
|
1811 |
|
|
|
1812 | try
|
|
|
1813 | {
|
|
|
1814 | intent_data = java.net.URLDecoder.decode(intent_data, "UTF-8");
|
|
|
1815 | }
|
|
|
1816 | catch (Exception e1)
|
|
|
1817 | {
|
|
|
1818 | e1.printStackTrace();
|
|
|
1819 | }
|
|
|
1820 |
|
|
|
1821 | if (!Navit.NavitStartupAlreadySearching)
|
|
|
1822 | {
|
|
|
1823 | try
|
|
|
1824 | {
|
|
|
1825 | tmp1 = intent_data.split(":", 2)[1];
|
|
|
1826 | tmp2 = tmp1.split("\\?", 2)[0];
|
|
|
1827 | tmp3 = tmp1.split("\\?", 2)[1];
|
|
|
1828 | lat1 = Float.parseFloat(tmp2.split(",", 2)[0]);
|
|
|
1829 | lon1 = Float.parseFloat(tmp2.split(",", 2)[1]);
|
|
|
1830 | zoom1 = Integer.parseInt(tmp3.split("z=", 2)[1]);
|
|
|
1831 | parsable = true;
|
|
|
1832 | }
|
|
|
1833 | catch (Exception e4)
|
|
|
1834 | {
|
|
|
1835 | e4.printStackTrace();
|
|
|
1836 | }
|
|
|
1837 | }
|
|
|
1838 |
|
|
|
1839 | if (parsable)
|
|
|
1840 | {
|
|
|
1841 | // geo: intent -> only show destination on map!
|
|
|
1842 |
|
|
|
1843 | // set zoomlevel before we show destination
|
|
|
1844 | int zoom_want = zoom1;
|
|
|
1845 | //
|
|
|
1846 | Message msg = new Message();
|
|
|
1847 | Bundle b = new Bundle();
|
|
|
1848 | b.putInt("Callback", 33);
|
|
|
1849 | b.putString("s", Integer.toString(zoom_want));
|
|
|
1850 | msg.setData(b);
|
|
|
1851 | try
|
|
|
1852 | {
|
|
|
1853 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
1854 | Navit.GlobalScaleLevel = Navit_SHOW_DEST_ON_MAP_ZOOMLEVEL;
|
|
|
1855 | if ((zoom_want > 8) && (zoom_want < 17))
|
|
|
1856 | {
|
|
|
1857 | Navit.GlobalScaleLevel = (int) (Math.pow(2, (18 - zoom_want)));
|
|
|
1858 | System.out.println("GlobalScaleLevel=" + Navit.GlobalScaleLevel);
|
|
|
1859 | }
|
|
|
1860 | }
|
|
|
1861 | catch (Exception e)
|
|
|
1862 | {
|
|
|
1863 | e.printStackTrace();
|
|
|
1864 | }
|
|
|
1865 | if (PREF_save_zoomlevel)
|
|
|
1866 | {
|
|
|
1867 | setPrefs_zoomlevel();
|
|
|
1868 | }
|
|
|
1869 | // set nice zoomlevel before we show destination
|
|
|
1870 |
|
|
|
1871 | try
|
|
|
1872 | {
|
|
|
1873 | Navit.follow_button_off();
|
|
|
1874 | }
|
|
|
1875 | catch (Exception e2)
|
|
|
1876 | {
|
|
|
1877 | e2.printStackTrace();
|
|
|
1878 | }
|
|
|
1879 |
|
|
|
1880 | show_geo_on_screen(lat1, lon1);
|
|
|
1881 | }
|
|
|
1882 | }
|
|
|
1883 |
|
|
|
1884 | // hold all map drawing -----------
|
|
|
1885 | Message msg = new Message();
|
|
|
1886 | Bundle b = new Bundle();
|
|
|
1887 | b.putInt("Callback", 69);
|
|
|
1888 | msg.setData(b);
|
|
|
1889 | try
|
|
|
1890 | {
|
|
|
1891 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
1892 | }
|
|
|
1893 | catch (Exception e)
|
|
|
1894 | {
|
|
|
1895 | }
|
|
|
1896 | // hold all map drawing -----------
|
1681 |
|
1897 |
|
1682 | getPrefs();
|
1898 | getPrefs();
|
1683 | activatePrefs();
|
1899 | activatePrefs();
|
1684 | // activate gps AFTER 3g-location
|
1900 | // activate gps AFTER 3g-location
|
1685 | NavitVehicle.turn_on_precise_provider();
|
1901 | NavitVehicle.turn_on_precise_provider();
|
|
|
1902 |
|
|
|
1903 | // allow all map drawing -----------
|
|
|
1904 | msg = new Message();
|
|
|
1905 | b = new Bundle();
|
|
|
1906 | b.putInt("Callback", 70);
|
|
|
1907 | msg.setData(b);
|
|
|
1908 | try
|
|
|
1909 | {
|
|
|
1910 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
1911 | }
|
|
|
1912 | catch (Exception e)
|
|
|
1913 | {
|
|
|
1914 | }
|
|
|
1915 | // allow all map drawing -----------
|
|
|
1916 |
|
1686 | NavitVehicle.set_last_known_pos_fast_provider();
|
1917 | NavitVehicle.set_last_known_pos_fast_provider();
|
1687 |
|
1918 |
|
1688 | try
|
1919 | try
|
1689 | {
|
1920 | {
|
1690 | //Simulate = new SimGPS(NavitVehicle.vehicle_handler_);
|
1921 | //Simulate = new SimGPS(NavitVehicle.vehicle_handler_);
|
… | |
… | |
1707 | }
|
1938 | }
|
1708 |
|
1939 |
|
1709 | @Override
|
1940 | @Override
|
1710 | public void onPause()
|
1941 | public void onPause()
|
1711 | {
|
1942 | {
|
|
|
1943 | System.out.println("@@ onPause @@");
|
1712 | try
|
1944 | try
|
1713 | {
|
1945 | {
|
1714 | setPrefs_zoomlevel();
|
1946 | setPrefs_zoomlevel();
|
1715 | }
|
1947 | }
|
1716 | catch (Exception e)
|
1948 | catch (Exception e)
|
… | |
… | |
1832 | //. TRANSLATORS: text to translate is: exit ZANavi
|
2064 | //. TRANSLATORS: text to translate is: exit ZANavi
|
1833 | menu.add(1, 99, 480, get_text("exit navit")); //TRANS
|
2065 | menu.add(1, 99, 480, get_text("exit navit")); //TRANS
|
1834 | menu.add(1, 5, 485, get_text("toggle POI")); //TRANS
|
2066 | menu.add(1, 5, 485, get_text("toggle POI")); //TRANS
|
1835 | menu.add(1, 10, 490, get_text("Settings")); //TRANS
|
2067 | menu.add(1, 10, 490, get_text("Settings")); //TRANS
|
1836 |
|
2068 |
|
|
|
2069 | //menu.add(1, 18, 491, get_text("Coord Dialog 2")); //TRANS
|
|
|
2070 | menu.add(1, 19, 492, get_text("Coord Dialog")); //TRANS
|
|
|
2071 |
|
1837 | if (Navit_Announcer == true)
|
2072 | if (Navit_Announcer == true)
|
1838 | {
|
2073 | {
|
1839 | menu.add(1, 12, 496, get_text("Announcer Off")); //TRANS
|
2074 | menu.add(1, 12, 496, get_text("Announcer Off")); //TRANS
|
1840 | }
|
2075 | }
|
1841 | else
|
2076 | else
|
1842 | {
|
2077 | {
|
1843 | menu.add(1, 13, 495, get_text("Announcer On")); //TRANS
|
2078 | menu.add(1, 13, 495, get_text("Announcer On")); //TRANS
|
1844 | }
|
2079 | }
|
1845 |
|
2080 |
|
1846 | menu.add(1, 14, 498, get_text("Recent destinations")); //TRANS
|
2081 | menu.add(1, 14, 497, get_text("Recent destinations")); //TRANS
|
|
|
2082 | menu.add(1, 21, 498, get_text("add Traffic block")); //TRANS
|
|
|
2083 | menu.add(1, 22, 499, get_text("clear Traffic blocks")); //TRANS
|
1847 | menu.add(1, 3, 500, get_text("download maps")); //TRANS
|
2084 | menu.add(1, 3, 500, get_text("download maps")); //TRANS
|
1848 | menu.add(1, 8, 505, get_text("delete maps")); //TRANS
|
2085 | menu.add(1, 8, 505, get_text("delete maps")); //TRANS
|
|
|
2086 | menu.add(1, 17, 508, get_text("show Maps age")); //TRANS
|
|
|
2087 | menu.add(1, 20, 510, get_text("convert GPX file")); //TRANS
|
|
|
2088 | menu.add(1, 23, 511, get_text("clear GPX map")); //TRANS
|
1849 |
|
2089 |
|
1850 | if (PREF_enable_debug_functions)
|
2090 | if (PREF_enable_debug_functions)
|
1851 | {
|
2091 | {
|
1852 | menu.add(1, 88, 9001, "--");
|
2092 | menu.add(1, 88, 9001, "--");
|
1853 | menu.add(1, 601, 9001, get_text("Demo Vehicle")); //TRANS
|
2093 | menu.add(1, 601, 9001, get_text("Demo Vehicle") + " [normal]"); //TRANS
|
|
|
2094 | menu.add(1, 604, 9002, get_text("Demo Vehicle") + " [fast]"); //TRANS
|
1854 | menu.add(1, 602, 9002, get_text("Speech Texts")); //TRANS
|
2095 | menu.add(1, 602, 9003, get_text("Speech Texts")); //TRANS
|
1855 | menu.add(1, 603, 9003, get_text("Nav. Commands")); //TRANS
|
2096 | menu.add(1, 603, 9004, get_text("Nav. Commands")); //TRANS
|
1856 | }
|
2097 | }
|
1857 |
|
2098 |
|
1858 | menu.add(1, 88, 11000, "--");
|
2099 | menu.add(1, 88, 11000, "--");
|
1859 | menu.add(1, 16, 11001, get_text("online Help")); //TRANS
|
2100 | menu.add(1, 16, 11001, get_text("online Help")); //TRANS
|
1860 |
|
2101 |
|
1861 | // menu.add(1, 88, 800, "--");
|
2102 | // menu.add(1, 88, 800, "--");
|
1862 | return true;
|
2103 | return true;
|
1863 | }
|
2104 | }
|
1864 |
|
2105 |
|
1865 | // define graphics here
|
|
|
1866 | public static NavitGraphics N_NavitGraphics = null;
|
|
|
1867 |
|
|
|
1868 | // callback id gets set here when called from NavitGraphics
|
2106 | // callback id gets set here when called from NavitGraphics
|
|
|
2107 | /*
|
1869 | public static void setKeypressCallback(int kp_cb_id, NavitGraphics ng)
|
2108 | * public static void setKeypressCallback(int kp_cb_id, NavitGraphics ng)
|
1870 | {
|
2109 | * {
|
1871 | //Log.e("Navit", "setKeypressCallback -> id1=" + kp_cb_id);
|
2110 | * //Log.e("Navit", "setKeypressCallback -> id1=" + kp_cb_id);
|
1872 | //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
|
2111 | * //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
|
1873 | //N_KeypressCallbackID = kp_cb_id;
|
2112 | * //N_KeypressCallbackID = kp_cb_id;
|
1874 | N_NavitGraphics = ng;
|
2113 | * N_NavitGraphics = ng;
|
1875 | }
|
2114 | * }
|
|
|
2115 | */
|
1876 |
|
2116 |
|
|
|
2117 | /*
|
1877 | public static void setMotionCallback(int mo_cb_id, NavitGraphics ng)
|
2118 | * public static void setMotionCallback(int mo_cb_id, NavitGraphics ng)
|
1878 | {
|
2119 | * {
|
1879 | //Log.e("Navit", "setKeypressCallback -> id2=" + mo_cb_id);
|
2120 | * //Log.e("Navit", "setKeypressCallback -> id2=" + mo_cb_id);
|
1880 | //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
|
2121 | * //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
|
1881 | //N_MotionCallbackID = mo_cb_id;
|
2122 | * //N_MotionCallbackID = mo_cb_id;
|
1882 | N_NavitGraphics = ng;
|
2123 | * N_NavitGraphics = ng;
|
1883 | }
|
2124 | * }
|
|
|
2125 | */
|
1884 |
|
2126 |
|
1885 | //public native void KeypressCallback(int id, String s);
|
2127 | //public native void KeypressCallback(int id, String s);
|
1886 |
|
2128 |
|
1887 | public void start_targetsearch_from_intent(String target_address)
|
2129 | public void start_targetsearch_from_intent(String target_address)
|
1888 | {
|
2130 | {
|
… | |
… | |
1993 | // map download menu
|
2235 | // map download menu
|
1994 | Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
|
2236 | Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
|
1995 | this.startActivityForResult(map_download_list_activity, Navit.NavitDownloaderPriSelectMap_id);
|
2237 | this.startActivityForResult(map_download_list_activity, Navit.NavitDownloaderPriSelectMap_id);
|
1996 | break;
|
2238 | break;
|
1997 | case 5:
|
2239 | case 5:
|
1998 | // GeoCoordEnterDialog
|
|
|
1999 | // DEBUG - // Intent it001 = new Intent(this, GeoCoordEnterDialog.class);
|
|
|
2000 | // DEBUG - // this.startActivityForResult(it001, Navit.NavitGeoCoordEnter_id);
|
|
|
2001 |
|
|
|
2002 | // toggle the normal POI layers (to avoid double POIs)
|
2240 | // toggle the normal POI layers (to avoid double POIs)
|
2003 | msg = new Message();
|
2241 | msg = new Message();
|
2004 | b = new Bundle();
|
2242 | b = new Bundle();
|
2005 | b.putInt("Callback", 5);
|
2243 | b.putInt("Callback", 5);
|
2006 | b.putString("cmd", "toggle_layer(\"POI Symbols\");");
|
2244 | b.putString("cmd", "toggle_layer(\"POI Symbols\");");
|
… | |
… | |
2125 |
|
2363 |
|
2126 | Intent i = new Intent(Intent.ACTION_VIEW);
|
2364 | Intent i = new Intent(Intent.ACTION_VIEW);
|
2127 | i.setData(Uri.parse(url));
|
2365 | i.setData(Uri.parse(url));
|
2128 | startActivity(i);
|
2366 | startActivity(i);
|
2129 | break;
|
2367 | break;
|
|
|
2368 | case 17:
|
|
|
2369 | // show age of maps (online)
|
|
|
2370 | Intent i3 = new Intent(Intent.ACTION_VIEW);
|
|
|
2371 | i3.setData(Uri.parse(NavitMapDownloader.ZANAVI_MAPS_AGE_URL));
|
|
|
2372 | startActivity(i3);
|
|
|
2373 | break;
|
|
|
2374 | case 18:
|
|
|
2375 | Intent intent_latlon = new Intent(Intent.ACTION_MAIN);
|
|
|
2376 | //intent_latlon.setAction("android.intent.action.POINTPICK");
|
|
|
2377 | intent_latlon.setPackage("com.cruthu.latlongcalc1");
|
|
|
2378 | intent_latlon.setClassName("com.cruthu.latlongcalc1", "com.cruthu.latlongcalc1.LatLongMain");
|
|
|
2379 | //intent_latlon.setClassName("com.cruthu.latlongcalc1", "com.cruthu.latlongcalc1.LatLongPointPick");
|
|
|
2380 | try
|
|
|
2381 | {
|
|
|
2382 | startActivity(intent_latlon);
|
|
|
2383 | }
|
|
|
2384 | catch (Exception e88)
|
|
|
2385 | {
|
|
|
2386 | e88.printStackTrace();
|
|
|
2387 | // show install page
|
|
|
2388 | try
|
|
|
2389 | {
|
|
|
2390 | // String urlx = "http://market.android.com/details?id=com.cruthu.latlongcalc1";
|
|
|
2391 | String urlx = "market://details?id=com.cruthu.latlongcalc1";
|
|
|
2392 | Intent ix = new Intent(Intent.ACTION_VIEW);
|
|
|
2393 | ix.setData(Uri.parse(urlx));
|
|
|
2394 | startActivity(ix);
|
|
|
2395 | }
|
|
|
2396 | catch (Exception ex)
|
|
|
2397 | {
|
|
|
2398 | ex.printStackTrace();
|
|
|
2399 | }
|
|
|
2400 | }
|
|
|
2401 | break;
|
|
|
2402 | case 19:
|
|
|
2403 | // GeoCoordEnterDialog
|
|
|
2404 | Intent it001 = new Intent(this, GeoCoordEnterDialog.class);
|
|
|
2405 | this.startActivityForResult(it001, Navit.NavitGeoCoordEnter_id);
|
|
|
2406 | break;
|
|
|
2407 | case 20:
|
|
|
2408 | // convert GPX file
|
|
|
2409 | Intent intent77 = new Intent(getBaseContext(), FileDialog.class);
|
|
|
2410 | File a = new File(MAP_FILENAME_PATH + "/../");
|
|
|
2411 | try
|
|
|
2412 | {
|
|
|
2413 | // convert the "/../" in the path to normal absolut dir
|
|
|
2414 | intent77.putExtra(FileDialog.START_PATH, a.getCanonicalPath());
|
|
|
2415 | //can user select directories or not
|
|
|
2416 | intent77.putExtra(FileDialog.CAN_SELECT_DIR, false);
|
|
|
2417 | // disable the "new" button
|
|
|
2418 | intent77.putExtra(FileDialog.SELECTION_MODE, SelectionMode.MODE_OPEN);
|
|
|
2419 | //alternatively you can set file filter
|
|
|
2420 | //intent.putExtra(FileDialog.FORMAT_FILTER, new String[] { "gpx" });
|
|
|
2421 | startActivityForResult(intent77, Navit.NavitGPXConvChooser_id);
|
|
|
2422 | }
|
|
|
2423 | catch (IOException e1)
|
|
|
2424 | {
|
|
|
2425 | e1.printStackTrace();
|
|
|
2426 | }
|
|
|
2427 | break;
|
|
|
2428 | case 21:
|
|
|
2429 | // add traffic block (like blocked road, or construction site) at current location of crosshair
|
|
|
2430 | try
|
|
|
2431 | {
|
|
|
2432 | String traffic = NavitGraphics.CallbackGeoCalc(7, (int) (NavitGraphics.mCanvasWidth / 2), (int) (NavitGraphics.mCanvasHeight / 2));
|
|
|
2433 | // System.out.println("traffic=" + traffic);
|
|
|
2434 | File traffic_file_dir = new File(MAP_FILENAME_PATH);
|
|
|
2435 | traffic_file_dir.mkdirs();
|
|
|
2436 | File traffic_file = new File(MAP_FILENAME_PATH + "/traffic.txt");
|
|
|
2437 | FileOutputStream fOut = null;
|
|
|
2438 | OutputStreamWriter osw = null;
|
|
|
2439 | try
|
|
|
2440 | {
|
|
|
2441 | fOut = new FileOutputStream(traffic_file, true);
|
|
|
2442 | osw = new OutputStreamWriter(fOut);
|
|
|
2443 | osw.write("type=traffic_distortion maxspeed=0" + "\n"); // item header
|
|
|
2444 | osw.write(traffic); // item coordinates
|
|
|
2445 | osw.close();
|
|
|
2446 | fOut.close();
|
|
|
2447 | }
|
|
|
2448 | catch (Exception ef)
|
|
|
2449 | {
|
|
|
2450 | ef.printStackTrace();
|
|
|
2451 | }
|
|
|
2452 |
|
|
|
2453 | // update route, if a route is set
|
|
|
2454 | msg = new Message();
|
|
|
2455 | b = new Bundle();
|
|
|
2456 | b.putInt("Callback", 73);
|
|
|
2457 | msg.setData(b);
|
|
|
2458 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2459 |
|
|
|
2460 | // draw map async
|
|
|
2461 | msg = new Message();
|
|
|
2462 | b = new Bundle();
|
|
|
2463 | b.putInt("Callback", 65);
|
|
|
2464 | msg.setData(b);
|
|
|
2465 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2466 | }
|
|
|
2467 | catch (Exception e)
|
|
|
2468 | {
|
|
|
2469 | e.printStackTrace();
|
|
|
2470 | }
|
|
|
2471 | break;
|
|
|
2472 | case 22:
|
|
|
2473 | // clear all traffic blocks
|
|
|
2474 | try
|
|
|
2475 | {
|
|
|
2476 | File traffic_file = new File(MAP_FILENAME_PATH + "/traffic.txt");
|
|
|
2477 | traffic_file.delete();
|
|
|
2478 |
|
|
|
2479 | // update route, if a route is set
|
|
|
2480 | msg = new Message();
|
|
|
2481 | b = new Bundle();
|
|
|
2482 | b.putInt("Callback", 73);
|
|
|
2483 | msg.setData(b);
|
|
|
2484 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2485 |
|
|
|
2486 | // draw map async
|
|
|
2487 | msg = new Message();
|
|
|
2488 | b = new Bundle();
|
|
|
2489 | b.putInt("Callback", 65);
|
|
|
2490 | msg.setData(b);
|
|
|
2491 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2492 | }
|
|
|
2493 | catch (Exception e)
|
|
|
2494 | {
|
|
|
2495 |
|
|
|
2496 | }
|
|
|
2497 | break;
|
|
|
2498 | case 23:
|
|
|
2499 | // clear all GPX maps
|
|
|
2500 | try
|
|
|
2501 | {
|
|
|
2502 | File gpx_file = new File(MAP_FILENAME_PATH + "/gpxtracks.txt");
|
|
|
2503 | gpx_file.delete();
|
|
|
2504 |
|
|
|
2505 | // draw map async
|
|
|
2506 | msg = new Message();
|
|
|
2507 | b = new Bundle();
|
|
|
2508 | b.putInt("Callback", 65);
|
|
|
2509 | msg.setData(b);
|
|
|
2510 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2511 | }
|
|
|
2512 | catch (Exception e)
|
|
|
2513 | {
|
|
|
2514 |
|
|
|
2515 | }
|
|
|
2516 | break;
|
2130 | case 88:
|
2517 | case 88:
|
2131 | // dummy entry, just to make "breaks" in the menu
|
2518 | // dummy entry, just to make "breaks" in the menu
|
2132 | break;
|
2519 | break;
|
2133 | case 601:
|
2520 | case 601:
|
2134 | // DEBUG: activate demo vehicle and set position to position 20px-x, 20px-y on screen
|
2521 | // DEBUG: activate demo vehicle and set position to position 20px-x, 20px-y on screen
|
… | |
… | |
2136 | Navit.DemoVehicle = true;
|
2523 | Navit.DemoVehicle = true;
|
2137 |
|
2524 |
|
2138 | msg = new Message();
|
2525 | msg = new Message();
|
2139 | b = new Bundle();
|
2526 | b = new Bundle();
|
2140 | b.putInt("Callback", 52);
|
2527 | b.putInt("Callback", 52);
|
|
|
2528 | b.putString("s", "45"); // speed in km/h of Demo-Vehicle
|
2141 | msg.setData(b);
|
2529 | msg.setData(b);
|
2142 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
2530 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
2143 |
|
2531 |
|
2144 | msg = new Message();
|
2532 | msg = new Message();
|
2145 | b = new Bundle();
|
2533 | b = new Bundle();
|
… | |
… | |
2172 | break;
|
2560 | break;
|
2173 | case 603:
|
2561 | case 603:
|
2174 | // DEBUG: show all possible navigation commands (also translated)
|
2562 | // DEBUG: show all possible navigation commands (also translated)
|
2175 | NavitGraphics.generate_all_speech_commands();
|
2563 | NavitGraphics.generate_all_speech_commands();
|
2176 | break;
|
2564 | break;
|
|
|
2565 | case 604:
|
|
|
2566 | // DEBUG: activate FAST driving demo vehicle and set position to position 20px-x, 20px-y on screen
|
|
|
2567 |
|
|
|
2568 | Navit.DemoVehicle = true;
|
|
|
2569 |
|
|
|
2570 | msg = new Message();
|
|
|
2571 | b = new Bundle();
|
|
|
2572 | b.putInt("Callback", 52);
|
|
|
2573 | b.putString("s", "800"); // speed in ~km/h of Demo-Vehicle
|
|
|
2574 | msg.setData(b);
|
|
|
2575 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2576 |
|
|
|
2577 | msg = new Message();
|
|
|
2578 | b = new Bundle();
|
|
|
2579 | b.putInt("Callback", 51);
|
|
|
2580 | b.putInt("x", 20);
|
|
|
2581 | b.putInt("y", 20);
|
|
|
2582 | msg.setData(b);
|
|
|
2583 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2584 |
|
|
|
2585 | break;
|
2177 | case 99:
|
2586 | case 99:
|
2178 | // exit
|
2587 | // exit
|
|
|
2588 | this.onPause();
|
2179 | this.onStop();
|
2589 | this.onStop();
|
2180 | this.exit();
|
2590 | this.exit();
|
2181 | //msg = new Message();
|
2591 | //msg = new Message();
|
2182 | //b = new Bundle();
|
2592 | //b = new Bundle();
|
2183 | //b.putInt("Callback", 5);
|
2593 | //b.putInt("Callback", 5);
|
… | |
… | |
2187 | break;
|
2597 | break;
|
2188 | }
|
2598 | }
|
2189 | return true;
|
2599 | return true;
|
2190 | }
|
2600 | }
|
2191 |
|
2601 |
|
2192 | private class PickerListener implements NumberPicker.ValueChangeListener
|
2602 | //private class PickerListener implements NumberPicker.ValueChangeListener
|
2193 | {
|
2603 | //{
|
2194 | @Override
|
2604 | // @Override
|
2195 | public void onNumberPickerValueChange(NumberPicker picker, int value)
|
2605 | // public void onNumberPickerValueChange(NumberPicker picker, int value)
|
2196 | {
|
2606 | // {
|
2197 | //if (picker.getId() == R.id.SpinRate)
|
2607 | //if (picker.getId() == R.id.SpinRate)
|
2198 | //{
|
2608 | //{
|
2199 | // mBeatsPerMin = value;
|
2609 | // mBeatsPerMin = value;
|
2200 | //}
|
2610 | //}
|
2201 | return;
|
2611 | // return;
|
2202 | }
|
2612 | // }
|
2203 | }
|
2613 | //}
|
2204 |
|
2614 |
|
2205 | protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
2615 | protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
2206 | {
|
2616 | {
|
2207 | Log.e("Navit", "onActivityResult");
|
2617 | //Log.e("Navit", "onActivityResult");
|
2208 | switch (requestCode)
|
2618 | switch (requestCode)
|
2209 | {
|
2619 | {
|
|
|
2620 | case Navit.NavitGPXConvChooser_id:
|
|
|
2621 | try
|
|
|
2622 | {
|
|
|
2623 | if (resultCode == Activity.RESULT_OK)
|
|
|
2624 | {
|
|
|
2625 | String in_ = data.getStringExtra(FileDialog.RESULT_PATH);
|
|
|
2626 | String out_ = MAP_FILENAME_PATH + "/gpxtracks.txt";
|
|
|
2627 | MainFrame.do_conversion(in_, out_);
|
|
|
2628 |
|
|
|
2629 | // draw map async
|
|
|
2630 | Message msg = new Message();
|
|
|
2631 | Bundle b = new Bundle();
|
|
|
2632 | b.putInt("Callback", 65);
|
|
|
2633 | msg.setData(b);
|
|
|
2634 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
2635 | }
|
|
|
2636 | }
|
|
|
2637 | catch (Exception e77)
|
|
|
2638 | {
|
|
|
2639 | e77.printStackTrace();
|
|
|
2640 | }
|
|
|
2641 | break;
|
2210 | case Navit.NavitDeleteSecSelectMap_id:
|
2642 | case Navit.NavitDeleteSecSelectMap_id:
|
2211 | try
|
2643 | try
|
2212 | {
|
2644 | {
|
2213 | if (resultCode == Activity.RESULT_OK)
|
2645 | if (resultCode == Activity.RESULT_OK)
|
2214 | {
|
2646 | {
|
… | |
… | |
2639 | try
|
3071 | try
|
2640 | {
|
3072 | {
|
2641 | if (resultCode == Activity.RESULT_OK)
|
3073 | if (resultCode == Activity.RESULT_OK)
|
2642 | {
|
3074 | {
|
2643 | // lat lon enter activitiy result
|
3075 | // lat lon enter activitiy result
|
|
|
3076 |
|
|
|
3077 | try
|
|
|
3078 | {
|
|
|
3079 | if (data.getStringExtra("what").equals("view"))
|
|
|
3080 | {
|
|
|
3081 | // get the coords for the destination
|
|
|
3082 | float lat = Float.parseFloat(data.getStringExtra("lat"));
|
|
|
3083 | float lon = Float.parseFloat(data.getStringExtra("lon"));
|
|
|
3084 |
|
|
|
3085 | Log.d("Navit", "coord picker: " + lat);
|
|
|
3086 | Log.d("Navit", "coord picker: " + lon);
|
|
|
3087 |
|
|
|
3088 | // set nice zoomlevel before we show destination
|
|
|
3089 | int zoom_want = Navit_SHOW_DEST_ON_MAP_ZOOMLEVEL;
|
|
|
3090 | //
|
|
|
3091 | Message msg = new Message();
|
|
|
3092 | Bundle b = new Bundle();
|
|
|
3093 | b.putInt("Callback", 33);
|
|
|
3094 | b.putString("s", Integer.toString(zoom_want));
|
|
|
3095 | msg.setData(b);
|
|
|
3096 | try
|
|
|
3097 | {
|
|
|
3098 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
3099 | Navit.GlobalScaleLevel = zoom_want;
|
|
|
3100 | }
|
|
|
3101 | catch (Exception e)
|
|
|
3102 | {
|
|
|
3103 | e.printStackTrace();
|
|
|
3104 | }
|
|
|
3105 | if (PREF_save_zoomlevel)
|
|
|
3106 | {
|
|
|
3107 | setPrefs_zoomlevel();
|
|
|
3108 | }
|
|
|
3109 | // set nice zoomlevel before we show destination
|
|
|
3110 |
|
|
|
3111 | try
|
|
|
3112 | {
|
|
|
3113 | Navit.follow_button_off();
|
|
|
3114 | }
|
|
|
3115 | catch (Exception e2)
|
|
|
3116 | {
|
|
|
3117 | e2.printStackTrace();
|
|
|
3118 | }
|
|
|
3119 |
|
|
|
3120 | show_geo_on_screen(lat, lon);
|
|
|
3121 | }
|
|
|
3122 | else
|
|
|
3123 | {
|
|
|
3124 | // get the coords for the destination
|
|
|
3125 | float lat = Float.parseFloat(data.getStringExtra("lat"));
|
|
|
3126 | float lon = Float.parseFloat(data.getStringExtra("lat"));
|
|
|
3127 | String dest_name = "manual coordinates";
|
|
|
3128 |
|
|
|
3129 | // ok now set target
|
|
|
3130 | try
|
|
|
3131 | {
|
|
|
3132 | dest_name = NavitGraphics.CallbackGeoCalc(6, lat, lon);
|
|
|
3133 | if ((dest_name.equals(" ")) || (dest_name == null))
|
|
|
3134 | {
|
|
|
3135 | dest_name = "manual coordinates";
|
|
|
3136 | }
|
|
|
3137 | Navit.remember_destination(dest_name, lat, lon);
|
|
|
3138 | // save points
|
|
|
3139 | write_map_points();
|
|
|
3140 | }
|
|
|
3141 | catch (Exception e)
|
|
|
3142 | {
|
|
|
3143 | e.printStackTrace();
|
|
|
3144 | }
|
|
|
3145 |
|
|
|
3146 | if (NavitGraphics.navit_route_status == 0)
|
|
|
3147 | {
|
|
|
3148 | Navit.destination_set();
|
|
|
3149 |
|
|
|
3150 | Message msg = new Message();
|
|
|
3151 | Bundle b = new Bundle();
|
|
|
3152 | b.putInt("Callback", 3);
|
|
|
3153 | b.putString("lat", String.valueOf(lat));
|
|
|
3154 | b.putString("lon", String.valueOf(lon));
|
|
|
3155 | b.putString("q", dest_name);
|
|
|
3156 | msg.setData(b);
|
|
|
3157 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
3158 | }
|
|
|
3159 | else
|
|
|
3160 | {
|
|
|
3161 | Message msg = new Message();
|
|
|
3162 | Bundle b = new Bundle();
|
|
|
3163 | b.putInt("Callback", 48);
|
|
|
3164 | b.putString("lat", String.valueOf(lat));
|
|
|
3165 | b.putString("lon", String.valueOf(lon));
|
|
|
3166 | b.putString("q", dest_name);
|
|
|
3167 | msg.setData(b);
|
|
|
3168 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
3169 | }
|
|
|
3170 |
|
|
|
3171 | // zoom_to_route();
|
|
|
3172 | try
|
|
|
3173 | {
|
|
|
3174 | Thread.sleep(400);
|
|
|
3175 | }
|
|
|
3176 | catch (InterruptedException e)
|
|
|
3177 | {
|
|
|
3178 | }
|
|
|
3179 |
|
|
|
3180 | try
|
|
|
3181 | {
|
|
|
3182 | Navit.follow_button_on();
|
|
|
3183 | }
|
|
|
3184 | catch (Exception e2)
|
|
|
3185 | {
|
|
|
3186 | e2.printStackTrace();
|
|
|
3187 | }
|
|
|
3188 |
|
|
|
3189 | show_geo_on_screen(lat, lon);
|
|
|
3190 | }
|
|
|
3191 | }
|
|
|
3192 | catch (NumberFormatException e)
|
|
|
3193 | {
|
|
|
3194 | Log.d("Navit", "NumberFormatException selected_id");
|
|
|
3195 | }
|
|
|
3196 | catch (Exception e)
|
|
|
3197 | {
|
|
|
3198 |
|
|
|
3199 | }
|
2644 | }
|
3200 | }
|
2645 | }
|
3201 | }
|
2646 | catch (Exception e)
|
3202 | catch (Exception e)
|
2647 | {
|
3203 | {
|
2648 | e.printStackTrace();
|
3204 | e.printStackTrace();
|
… | |
… | |
3213 | catch (Exception e)
|
3769 | catch (Exception e)
|
3214 | {
|
3770 | {
|
3215 | e.printStackTrace();
|
3771 | e.printStackTrace();
|
3216 | }
|
3772 | }
|
3217 | break;
|
3773 | break;
|
|
|
3774 | case 17:
|
|
|
3775 | try
|
|
|
3776 | {
|
|
|
3777 |
|
|
|
3778 | generic_alert_box.setMessage(Navit.get_text("Possibly not enough space on your device!")).setPositiveButton(Navit.get_text("Ok"), new DialogInterface.OnClickListener() // TRANS
|
|
|
3779 | {
|
|
|
3780 | public void onClick(DialogInterface dialog, int id)
|
|
|
3781 | {
|
|
|
3782 | // Handle Ok
|
|
|
3783 | }
|
|
|
3784 | }).create();
|
|
|
3785 | generic_alert_box.setCancelable(false);
|
|
|
3786 | generic_alert_box.setTitle(Navit.get_text("device space")); // TRANS
|
|
|
3787 | generic_alert_box.show();
|
|
|
3788 | }
|
|
|
3789 | catch (Exception e)
|
|
|
3790 | {
|
|
|
3791 | e.printStackTrace();
|
|
|
3792 | }
|
|
|
3793 | break;
|
3218 | case 99:
|
3794 | case 99:
|
3219 | // dismiss dialog, remove dialog - generic
|
3795 | // dismiss dialog, remove dialog - generic
|
3220 | try
|
3796 | try
|
3221 | {
|
3797 | {
|
3222 | Log.e("Navit", "99: dismiss dialog num " + msg.getData().getInt("dialog_num"));
|
3798 | Log.e("Navit", "99: dismiss dialog num " + msg.getData().getInt("dialog_num"));
|
… | |
… | |
3395 |
|
3971 |
|
3396 | public void disableSuspend()
|
3972 | public void disableSuspend()
|
3397 | {
|
3973 | {
|
3398 | wl.acquire();
|
3974 | wl.acquire();
|
3399 | wl.release();
|
3975 | wl.release();
|
|
|
3976 |
|
|
|
3977 | }
|
|
|
3978 |
|
|
|
3979 | public void exit2()
|
|
|
3980 | {
|
|
|
3981 | System.out.println("in exit2");
|
3400 | }
|
3982 | }
|
3401 |
|
3983 |
|
3402 | public void exit()
|
3984 | public void exit()
|
3403 | {
|
3985 | {
|
3404 | NavitVehicle.turn_off_all_providers();
|
3986 | NavitVehicle.turn_off_all_providers();
|
|
|
3987 | //try
|
|
|
3988 | //{
|
|
|
3989 | // NavitSpeech.stop_me();
|
|
|
3990 | //}
|
|
|
3991 | //catch (Exception s)
|
|
|
3992 | //{
|
|
|
3993 | // s.printStackTrace();
|
|
|
3994 | //}
|
|
|
3995 |
|
3405 | try
|
3996 | try
|
3406 | {
|
3997 | {
|
3407 | NavitSpeech.stop_me();
|
3998 | NavitSpeech2.stop_me();
|
3408 | }
|
3999 | }
|
3409 | catch (Exception s)
|
4000 | catch (Exception s)
|
3410 | {
|
4001 | {
|
3411 | s.printStackTrace();
|
4002 | s.printStackTrace();
|
3412 | }
|
4003 | }
|
3413 | try
|
|
|
3414 | {
|
|
|
3415 | NavitSpeech2.stop_me();
|
|
|
3416 | }
|
|
|
3417 | catch (Exception s)
|
|
|
3418 | {
|
|
|
3419 | s.printStackTrace();
|
|
|
3420 | }
|
|
|
3421 | //Intent resultIntent = new Intent();
|
|
|
3422 | //resultIntent.putExtra("exitcode", String.valueOf(exitcode));
|
|
|
3423 | //setResult(Activity.RESULT_OK, resultIntent);
|
|
|
3424 | Log.e("Navit", "1***************** exit called ****************");
|
4004 | Log.e("Navit", "1***************** exit called ****************");
|
3425 | Log.e("Navit", "2***************** exit called ****************");
|
4005 | Log.e("Navit", "2***************** exit called ****************");
|
3426 | Log.e("Navit", "3***************** exit called ****************");
|
4006 | Log.e("Navit", "3***************** exit called ****************");
|
3427 | Log.e("Navit", "4***************** exit called ****************");
|
4007 | Log.e("Navit", "4***************** exit called ****************");
|
3428 | Log.e("Navit", "5***************** exit called ****************");
|
4008 | Log.e("Navit", "5***************** exit called ****************");
|
3429 | Log.e("Navit", "6***************** exit called ****************");
|
4009 | Log.e("Navit", "6***************** exit called ****************");
|
3430 | Log.e("Navit", "7***************** exit called ****************");
|
4010 | Log.e("Navit", "7***************** exit called ****************");
|
3431 | Log.e("Navit", "8***************** exit called ****************");
|
4011 | Log.e("Navit", "8***************** exit called ****************");
|
3432 | System.gc();
|
4012 | System.gc();
|
3433 | NavitActivity(-4);
|
4013 | NavitActivity(-4);
|
|
|
4014 | Log.e("Navit", "XX1***************** exit called ****************");
|
3434 | finish();
|
4015 | finish();
|
|
|
4016 | Log.e("Navit", "XX2***************** exit called ****************");
|
|
|
4017 | System.runFinalizersOnExit(true);
|
|
|
4018 | Log.e("Navit", "XX3***************** exit called ****************");
|
|
|
4019 | System.exit(0);
|
|
|
4020 | Log.e("Navit", "XX4***************** exit called ****************");
|
3435 | }
|
4021 | }
|
3436 |
|
4022 |
|
3437 | public boolean handleMessage(Message m)
|
4023 | public boolean handleMessage(Message m)
|
3438 | {
|
4024 | {
|
3439 | //Log.e("Navit", "Handler received message");
|
4025 | //Log.e("Navit", "Handler received message");
|
… | |
… | |
3455 | SharedPreferences.Editor editor = prefs.edit();
|
4041 | SharedPreferences.Editor editor = prefs.edit();
|
3456 | Navit.follow_current = Navit.follow_on;
|
4042 | Navit.follow_current = Navit.follow_on;
|
3457 | PREF_follow_gps = true;
|
4043 | PREF_follow_gps = true;
|
3458 | editor.putBoolean("follow_gps", PREF_follow_gps);
|
4044 | editor.putBoolean("follow_gps", PREF_follow_gps);
|
3459 | editor.commit();
|
4045 | editor.commit();
|
|
|
4046 |
|
|
|
4047 | // hold all map drawing -----------
|
|
|
4048 | Message msg = new Message();
|
|
|
4049 | Bundle b = new Bundle();
|
|
|
4050 | b.putInt("Callback", 69);
|
|
|
4051 | msg.setData(b);
|
|
|
4052 | try
|
|
|
4053 | {
|
|
|
4054 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
4055 | }
|
|
|
4056 | catch (Exception e)
|
|
|
4057 | {
|
|
|
4058 | }
|
|
|
4059 | // hold all map drawing -----------
|
|
|
4060 |
|
3460 | getPrefs();
|
4061 | getPrefs();
|
3461 | activatePrefs(1);
|
4062 | activatePrefs(1);
|
|
|
4063 |
|
|
|
4064 | // allow all map drawing -----------
|
|
|
4065 | msg = new Message();
|
|
|
4066 | b = new Bundle();
|
|
|
4067 | b.putInt("Callback", 70);
|
|
|
4068 | msg.setData(b);
|
|
|
4069 | try
|
|
|
4070 | {
|
|
|
4071 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
4072 | }
|
|
|
4073 | catch (Exception e)
|
|
|
4074 | {
|
|
|
4075 | }
|
|
|
4076 | // allow all map drawing -----------
|
|
|
4077 |
|
3462 | NavitVehicle.set_last_known_pos_fast_provider();
|
4078 | NavitVehicle.set_last_known_pos_fast_provider();
|
3463 | }
|
4079 | }
|
3464 |
|
4080 |
|
3465 | public static void follow_button_off()
|
4081 | public static void follow_button_off()
|
3466 | {
|
4082 | {
|
… | |
… | |
3474 | activatePrefs(1);
|
4090 | activatePrefs(1);
|
3475 | }
|
4091 | }
|
3476 |
|
4092 |
|
3477 | public static void toggle_follow_button()
|
4093 | public static void toggle_follow_button()
|
3478 | {
|
4094 | {
|
|
|
4095 | // the red needle OSD call this function only!!
|
3479 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
4096 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
3480 | SharedPreferences.Editor editor = prefs.edit();
|
4097 | SharedPreferences.Editor editor = prefs.edit();
|
3481 | if (PREF_follow_gps)
|
4098 | if (PREF_follow_gps)
|
3482 | {
|
4099 | {
|
3483 | Navit.follow_current = Navit.follow_off;
|
4100 | Navit.follow_current = Navit.follow_off;
|
… | |
… | |
3498 | //if (!PREF_use_compass_heading_base)
|
4115 | //if (!PREF_use_compass_heading_base)
|
3499 | //{
|
4116 | //{
|
3500 | // // child is always "false" when parent is "false" !!
|
4117 | // // child is always "false" when parent is "false" !!
|
3501 | // PREF_use_compass_heading_always = false;
|
4118 | // PREF_use_compass_heading_always = false;
|
3502 | //}
|
4119 | //}
|
|
|
4120 |
|
|
|
4121 | // hold all map drawing -----------
|
|
|
4122 | Message msg = new Message();
|
|
|
4123 | Bundle b = new Bundle();
|
|
|
4124 | b.putInt("Callback", 69);
|
|
|
4125 | msg.setData(b);
|
|
|
4126 | try
|
|
|
4127 | {
|
|
|
4128 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
4129 | }
|
|
|
4130 | catch (Exception e)
|
|
|
4131 | {
|
|
|
4132 | }
|
|
|
4133 | // hold all map drawing -----------
|
|
|
4134 |
|
3503 | getPrefs();
|
4135 | getPrefs();
|
3504 | activatePrefs(1);
|
4136 | activatePrefs(1);
|
|
|
4137 |
|
|
|
4138 | // allow all map drawing -----------
|
|
|
4139 | msg = new Message();
|
|
|
4140 | b = new Bundle();
|
|
|
4141 | b.putInt("Callback", 70);
|
|
|
4142 | msg.setData(b);
|
|
|
4143 | try
|
|
|
4144 | {
|
|
|
4145 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
|
|
4146 | }
|
|
|
4147 | catch (Exception e)
|
|
|
4148 | {
|
|
|
4149 | }
|
|
|
4150 | // allow all map drawing -----------
|
|
|
4151 |
|
3505 | NavitVehicle.set_last_known_pos_fast_provider();
|
4152 | NavitVehicle.set_last_known_pos_fast_provider();
|
3506 | }
|
4153 | }
|
3507 |
|
|
|
3508 | static boolean PREF_use_fast_provider;
|
|
|
3509 | static boolean PREF_follow_gps;
|
|
|
3510 | static boolean PREF_use_compass_heading_base;
|
|
|
3511 | static boolean PREF_use_compass_heading_always;
|
|
|
3512 | static boolean PREF_allow_gui_internal;
|
|
|
3513 | static boolean PREF_show_vehicle_in_center;
|
|
|
3514 | static boolean PREF_use_imperial;
|
|
|
3515 | static boolean PREF_use_compass_heading_fast;
|
|
|
3516 | static boolean PREF_use_anti_aliasing;
|
|
|
3517 | static boolean PREF_gui_oneway_arrows;
|
|
|
3518 | static boolean PREF_show_debug_messages;
|
|
|
3519 | static boolean PREF_show_3d_map;
|
|
|
3520 | static boolean PREF_use_lock_on_roads;
|
|
|
3521 | static boolean PREF_use_route_highways;
|
|
|
3522 | static boolean PREF_save_zoomlevel;
|
|
|
3523 | static boolean PREF_show_sat_status;
|
|
|
3524 | static boolean PREF_use_agps;
|
|
|
3525 | static boolean PREF_enable_debug_functions;
|
|
|
3526 | static boolean PREF_speak_street_names;
|
|
|
3527 | static int PREF_search_country = 1; // default=*ALL*
|
|
|
3528 | static int PREF_zoomlevel_num = 2 * 2 * 2 * 2 * 2;
|
|
|
3529 | static boolean PREF_use_custom_font = false;
|
|
|
3530 | static int PREF_map_font_size = 2; // 1 -> small, 2 -> normal, 3 -> large, 4-> extra large, 4-> mega large
|
|
|
3531 | static int PREF_cancel_map_drawing_timeout = 1; // 0 -> short, 1-> normal, 2-> long, 3-> almost unlimited
|
|
|
3532 | static boolean PREF_draw_polyline_circles = true; // true -> yes (default) false -> no
|
|
|
3533 | static int PREF_mapcache = 10 * 1024; // in kbytes
|
|
|
3534 | static String PREF_navit_lang;
|
|
|
3535 | static int PREF_drawatorder = 1;
|
|
|
3536 | static String PREF_streetsearch_r = "1"; // street search radius factor (multiplier)
|
|
|
3537 |
|
4154 |
|
3538 | public static void setPrefs_search_country()
|
4155 | public static void setPrefs_search_country()
|
3539 | {
|
4156 | {
|
3540 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
4157 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
3541 | SharedPreferences.Editor editor = prefs.edit();
|
4158 | SharedPreferences.Editor editor = prefs.edit();
|
… | |
… | |
3543 | editor.commit();
|
4160 | editor.commit();
|
3544 | }
|
4161 | }
|
3545 |
|
4162 |
|
3546 | public static void setPrefs_zoomlevel()
|
4163 | public static void setPrefs_zoomlevel()
|
3547 | {
|
4164 | {
|
3548 | //System.out.println("1 save zoom level: " + Navit.GlobalScaleLevel);
|
4165 | System.out.println("1 save zoom level: " + Navit.GlobalScaleLevel);
|
3549 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
4166 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
3550 | SharedPreferences.Editor editor = prefs.edit();
|
4167 | SharedPreferences.Editor editor = prefs.edit();
|
3551 | editor.putInt("zoomlevel_num", Navit.GlobalScaleLevel);
|
4168 | editor.putInt("zoomlevel_num", Navit.GlobalScaleLevel);
|
3552 | editor.commit();
|
4169 | editor.commit();
|
3553 | //System.out.println("2 save zoom level: " + Navit.GlobalScaleLevel);
|
4170 | System.out.println("2 save zoom level: " + Navit.GlobalScaleLevel);
|
3554 | }
|
4171 | }
|
3555 |
|
4172 |
|
3556 | private static void getPrefs()
|
4173 | private static void getPrefs()
|
3557 | {
|
4174 | {
|
3558 | // Get the xml/preferences.xml preferences
|
4175 | // Get the xml/preferences.xml preferences
|
3559 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
4176 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
|
3560 | PREF_use_fast_provider = prefs.getBoolean("use_fast_provider", false);
|
4177 | PREF_use_fast_provider = prefs.getBoolean("use_fast_provider", true);
|
3561 | PREF_allow_gui_internal = prefs.getBoolean("allow_gui_internal", false);
|
4178 | PREF_allow_gui_internal = prefs.getBoolean("allow_gui_internal", false);
|
3562 | PREF_follow_gps = prefs.getBoolean("follow_gps", true);
|
4179 | PREF_follow_gps = prefs.getBoolean("follow_gps", true);
|
3563 | PREF_use_compass_heading_base = prefs.getBoolean("use_compass_heading_base", false);
|
4180 | PREF_use_compass_heading_base = prefs.getBoolean("use_compass_heading_base", false);
|
3564 | PREF_use_compass_heading_always = prefs.getBoolean("use_compass_heading_always", false);
|
4181 | PREF_use_compass_heading_always = prefs.getBoolean("use_compass_heading_always", false);
|
3565 | PREF_use_compass_heading_fast = prefs.getBoolean("use_compass_heading_fast", false);
|
4182 | PREF_use_compass_heading_fast = prefs.getBoolean("use_compass_heading_fast", false);
|
3566 | PREF_use_anti_aliasing = prefs.getBoolean("use_anti_aliasing", true);
|
4183 | PREF_use_anti_aliasing = prefs.getBoolean("use_anti_aliasing", true);
|
3567 | PREF_gui_oneway_arrows = prefs.getBoolean("gui_oneway_arrows", false);
|
4184 | PREF_gui_oneway_arrows = prefs.getBoolean("gui_oneway_arrows", true);
|
3568 | PREF_show_debug_messages = prefs.getBoolean("show_debug_messages", false);
|
4185 | PREF_show_debug_messages = prefs.getBoolean("show_debug_messages", false);
|
3569 | PREF_show_3d_map = prefs.getBoolean("show_3d_map", false);
|
4186 | PREF_show_3d_map = prefs.getBoolean("show_3d_map", false);
|
3570 | PREF_use_lock_on_roads = prefs.getBoolean("use_lock_on_roads", true);
|
4187 | PREF_use_lock_on_roads = prefs.getBoolean("use_lock_on_roads", true);
|
3571 | PREF_use_route_highways = prefs.getBoolean("use_route_highways", true);
|
4188 | PREF_use_route_highways = prefs.getBoolean("use_route_highways", true);
|
3572 | PREF_save_zoomlevel = prefs.getBoolean("save_zoomlevel", true);
|
4189 | PREF_save_zoomlevel = prefs.getBoolean("save_zoomlevel", true);
|
3573 | PREF_search_country = prefs.getInt("search_country_id", 1); // default=*ALL*
|
4190 | PREF_search_country = prefs.getInt("search_country_id", 1); // default=*ALL*
|
3574 | PREF_zoomlevel_num = prefs.getInt("zoomlevel_num", 2 * 2 * 2 * 2 * 2);
|
4191 | PREF_zoomlevel_num = prefs.getInt("zoomlevel_num", 2 * 2 * 2 * 2 * 2);
|
3575 | PREF_show_sat_status = prefs.getBoolean("show_sat_status", false);
|
4192 | PREF_show_sat_status = prefs.getBoolean("show_sat_status", false);
|
3576 | PREF_use_agps = prefs.getBoolean("use_agps", false);
|
4193 | PREF_use_agps = prefs.getBoolean("use_agps", true);
|
3577 | PREF_enable_debug_functions = prefs.getBoolean("enable_debug_functions", false);
|
4194 | PREF_enable_debug_functions = prefs.getBoolean("enable_debug_functions", false);
|
3578 | PREF_speak_street_names = prefs.getBoolean("speak_street_names", true);
|
4195 | PREF_speak_street_names = prefs.getBoolean("speak_street_names", true);
|
3579 | PREF_use_custom_font = prefs.getBoolean("use_custom_font", false);
|
4196 | PREF_use_custom_font = prefs.getBoolean("use_custom_font", true);
|
3580 | PREF_draw_polyline_circles = prefs.getBoolean("draw_polyline_circles", true);
|
4197 | PREF_draw_polyline_circles = prefs.getBoolean("draw_polyline_circles", true);
|
3581 | PREF_streetsearch_r = prefs.getString("streetsearch_r", "1");
|
4198 | PREF_streetsearch_r = prefs.getString("streetsearch_r", "2");
|
|
|
4199 | PREF_route_style = prefs.getString("route_style", "2");
|
3582 |
|
4200 |
|
3583 | try
|
4201 | try
|
3584 | {
|
4202 | {
|
3585 | PREF_drawatorder = Integer.parseInt(prefs.getString("drawatorder", "0"));
|
4203 | PREF_drawatorder = Integer.parseInt(prefs.getString("drawatorder", "0"));
|
3586 | }
|
4204 | }
|
… | |
… | |
3636 | }
|
4254 | }
|
3637 |
|
4255 |
|
3638 | private static void activatePrefs()
|
4256 | private static void activatePrefs()
|
3639 | {
|
4257 | {
|
3640 | activatePrefs(1);
|
4258 | activatePrefs(1);
|
|
|
4259 |
|
3641 | if (PREF_save_zoomlevel)
|
4260 | if (PREF_save_zoomlevel)
|
3642 | {
|
4261 | {
|
3643 | // only if really started, but NOT if returning from our own child activities!!
|
4262 | // only if really started, but NOT if returning from our own child activities!!
|
3644 |
|
4263 |
|
3645 | //System.out.println("3 restore zoom level: " + Navit.GlobalScaleLevel);
|
4264 | System.out.println("3 restore zoom level: " + Navit.GlobalScaleLevel);
|
3646 | //System.out.println("4 restore zoom level: " + PREF_zoomlevel_num);
|
4265 | System.out.println("4 restore zoom level: " + PREF_zoomlevel_num);
|
3647 |
|
4266 |
|
3648 | Message msg = new Message();
|
4267 | Message msg = new Message();
|
3649 | Bundle b = new Bundle();
|
4268 | Bundle b = new Bundle();
|
3650 | b.putInt("Callback", 33);
|
4269 | b.putInt("Callback", 33);
|
3651 | b.putString("s", Integer.toString(PREF_zoomlevel_num));
|
4270 | b.putString("s", Integer.toString(PREF_zoomlevel_num));
|
3652 | msg.setData(b);
|
4271 | msg.setData(b);
|
3653 | try
|
4272 | try
|
3654 | {
|
4273 | {
|
3655 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
4274 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
3656 | Navit.GlobalScaleLevel = PREF_zoomlevel_num;
|
4275 | Navit.GlobalScaleLevel = PREF_zoomlevel_num;
|
3657 | //System.out.println("5 restore zoom level: " + PREF_zoomlevel_num);
|
4276 | System.out.println("5 restore zoom level: " + PREF_zoomlevel_num);
|
3658 | }
|
4277 | }
|
3659 | catch (Exception e)
|
4278 | catch (Exception e)
|
3660 | {
|
4279 | {
|
3661 | }
|
4280 | }
|
3662 | }
|
4281 | }
|
… | |
… | |
4017 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
4636 | N_NavitGraphics.callback_handler.sendMessage(msg);
|
4018 | }
|
4637 | }
|
4019 | catch (Exception e)
|
4638 | catch (Exception e)
|
4020 | {
|
4639 | {
|
4021 | }
|
4640 | }
|
|
|
4641 |
|
4022 | }
|
4642 | }
|
4023 |
|
4643 |
|
4024 | try
|
4644 | try
|
4025 | {
|
4645 | {
|
4026 | NavitGraphics.OverlayDrawThread_cancel_drawing_timeout = NavitGraphics.OverlayDrawThread_cancel_drawing_timeout__options[PREF_cancel_map_drawing_timeout];
|
4646 | NavitGraphics.OverlayDrawThread_cancel_drawing_timeout = NavitGraphics.OverlayDrawThread_cancel_drawing_timeout__options[PREF_cancel_map_drawing_timeout];
|
… | |
… | |
4029 | }
|
4649 | }
|
4030 | catch (Exception e)
|
4650 | catch (Exception e)
|
4031 | {
|
4651 | {
|
4032 |
|
4652 |
|
4033 | }
|
4653 | }
|
|
|
4654 |
|
|
|
4655 | // route variant
|
|
|
4656 | Message msg67 = new Message();
|
|
|
4657 | Bundle b67 = new Bundle();
|
|
|
4658 | // turn off 1
|
|
|
4659 | b67.putInt("Callback", 60);
|
|
|
4660 | b67.putString("s", "route_001");
|
|
|
4661 | msg67.setData(b67);
|
|
|
4662 | try
|
|
|
4663 | {
|
|
|
4664 | N_NavitGraphics.callback_handler.sendMessage(msg67);
|
|
|
4665 | }
|
|
|
4666 | catch (Exception e)
|
|
|
4667 | {
|
|
|
4668 | }
|
|
|
4669 | // turn off 2
|
|
|
4670 | msg67 = new Message();
|
|
|
4671 | b67 = new Bundle();
|
|
|
4672 | b67.putInt("Callback", 60);
|
|
|
4673 | b67.putString("s", "route_002");
|
|
|
4674 | msg67.setData(b67);
|
|
|
4675 | try
|
|
|
4676 | {
|
|
|
4677 | N_NavitGraphics.callback_handler.sendMessage(msg67);
|
|
|
4678 | }
|
|
|
4679 | catch (Exception e)
|
|
|
4680 | {
|
|
|
4681 | }
|
|
|
4682 |
|
|
|
4683 | // turn on the wanted route style
|
|
|
4684 | msg67 = new Message();
|
|
|
4685 | b67 = new Bundle();
|
|
|
4686 | b67.putInt("Callback", 59);
|
|
|
4687 | b67.putString("s", "route_00" + PREF_route_style);
|
|
|
4688 | msg67.setData(b67);
|
|
|
4689 | try
|
|
|
4690 | {
|
|
|
4691 | N_NavitGraphics.callback_handler.sendMessage(msg67);
|
|
|
4692 | }
|
|
|
4693 | catch (Exception e)
|
|
|
4694 | {
|
|
|
4695 | }
|
|
|
4696 | // route variant
|
4034 |
|
4697 |
|
4035 | // set vars for mapdir change (only really takes effect after restart!)
|
4698 | // set vars for mapdir change (only really takes effect after restart!)
|
4036 | getPrefs_mapdir();
|
4699 | getPrefs_mapdir();
|
4037 | }
|
4700 | }
|
4038 |
|
4701 |
|
… | |
… | |
4280 | }
|
4943 | }
|
4281 | }
|
4944 | }
|
4282 |
|
4945 |
|
4283 | public void onSensorChanged(SensorEvent event)
|
4946 | public void onSensorChanged(SensorEvent event)
|
4284 | {
|
4947 | {
|
|
|
4948 |
|
4285 | if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
|
4949 | if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
|
4286 | {
|
4950 | {
|
4287 | // System.out.println("Sensor.TYPE_MAGNETIC_FIELD");
|
4951 | // System.out.println("Sensor.TYPE_MAGNETIC_FIELD");
|
4288 | return;
|
4952 | return;
|
4289 | }
|
4953 | }
|