List of usage examples for android.os Message setData
public void setData(Bundle data)
From source file:com.zoffcc.applications.zanavi.Navit.java
private static void activatePrefs_mapcache() { // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); Handler h_temp2 = null;/* w w w. j a v a 2 s .c om*/ h_temp2 = NavitGraphics.callback_handler_s; System.out.println("activatePrefs_mapcache " + NavitGraphics.callback_handler_s); Message msg7 = new Message(); Bundle b7 = new Bundle(); b7.putInt("Callback", 55); b7.putString("s", String.valueOf(p.PREF_mapcache * 1024)); msg7.setData(b7); h_temp2.sendMessage(msg7); // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); }
From source file:com.zoffcc.applications.zanavi.Navit.java
private static void activatePrefs_mapdir(Boolean at_startup) { // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); // activate the new directory NavitDataDirectory_Maps = sanity_check_maps_dir(NavitDataDirectory_Maps); MAP_FILENAME_PATH = NavitDataDirectory_Maps; MAPMD5_FILENAME_PATH = NavitDataDirectory_Maps + "/../md5/"; CFG_FILENAME_PATH = NavitDataDirectory_Maps + "/../"; NAVIT_DATA_DEBUG_DIR = CFG_FILENAME_PATH + "../debug/"; //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); //System.out.println("xxxxxxxx************XXXXXXXXXXX"); Handler h_temp = null;//w ww.ja va 2 s. c om h_temp = NavitGraphics.callback_handler_s; //System.out.println("handler 1=" + h_temp.toString()); Message msg1 = new Message(); Bundle b1 = new Bundle(); b1.putInt("Callback", 47); b1.putString("s", MAP_FILENAME_PATH); msg1.setData(b1); h_temp.sendMessage(msg1); if (!at_startup) { Message msg2 = new Message(); Bundle b2 = new Bundle(); b2.putInt("Callback", 18); msg2.setData(b2); h_temp.sendMessage(msg2); } // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void long_toast(String msg) { try {/*from w ww.jav a 2s .c o m*/ Message msg7 = Navit_progress_h.obtainMessage(); Bundle b7 = new Bundle(); msg7.what = 2; // long Toast message b7.putString("text", msg); msg7.setData(b7); Navit_progress_h.sendMessage(msg7); } catch (Exception e) { } }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void short_toast(String msg) { try {//from ww w .j ava 2 s .com Message msg7 = Navit_progress_h.obtainMessage(); Bundle b7 = new Bundle(); msg7.what = 3; // short Toast message b7.putString("text", msg); msg7.setData(b7); Navit_progress_h.sendMessage(msg7); } catch (Exception e) { } }
From source file:com.zoffcc.applications.zanavi.Navit.java
public static void toggle_follow_button() { // the "red needle" OSD calls this function only!! //Log.e("NavitVehicle", "toggle_follow_button"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_); SharedPreferences.Editor editor = prefs.edit(); if (p.PREF_follow_gps) { Navit.follow_current = Navit.follow_off; p.PREF_follow_gps = false;/* ww w . j a va2 s . c o m*/ // follow mode OFF ----------- Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 75); msg.setData(b); try { NavitGraphics.callback_handler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } // follow mode OFF ----------- } else { Navit.follow_current = Navit.follow_on; p.PREF_follow_gps = true; // follow mode ON ----------- Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 74); msg.setData(b); try { NavitGraphics.callback_handler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } // follow mode ON ----------- } editor.putBoolean("follow_gps", p.PREF_follow_gps); editor.commit(); //if (!PREF_follow_gps) //{ // // no compass turning without follow mode! // PREF_use_compass_heading_base = false; //} //if (!PREF_use_compass_heading_base) //{ // // child is always "false" when parent is "false" !! // PREF_use_compass_heading_always = false; //} Message msg = Navit_progress_h.obtainMessage(); Bundle b = new Bundle(); msg.what = 32; try { Navit_progress_h.sendMessage(msg); } catch (Exception e) { } // hold all map drawing ----------- msg = new Message(); b = new Bundle(); b.putInt("Callback", 69); msg.setData(b); try { NavitGraphics.callback_handler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } // hold all map drawing ----------- getPrefs(); activatePrefs(1); // allow all map drawing ----------- msg = new Message(); b = new Bundle(); b.putInt("Callback", 70); msg.setData(b); try { NavitGraphics.callback_handler.sendMessage(msg); } catch (Exception e) { } // allow all map drawing ----------- NavitVehicle.set_last_known_pos_fast_provider(); // JB fix //NavitGraphics.NavitAOSDJava_.postInvalidate(); //System.out.println("xx paint 14 xx"); NavitGraphics.OSD_new.postInvalidate(); NavitGraphics.NavitAOverlay_s.postInvalidate(); }
From source file:com.zoffcc.applications.zanavi.Navit.java
private static void activatePrefs() { // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); activatePrefs(1);/* w ww. j ava 2s . c om*/ if (p.PREF_save_zoomlevel) { // only if really started, but NOT if returning from our own child activities!! //System.out.println("3 restore zoom level: " + Navit.GlobalScaleLevel); //System.out.println("4 restore zoom level: " + PREF_zoomlevel_num); Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 33); b.putString("s", Integer.toString(p.PREF_zoomlevel_num)); msg.setData(b); try { NavitGraphics.callback_handler.sendMessage(msg); Navit.GlobalScaleLevel = p.PREF_zoomlevel_num; //System.out.println("5 restore zoom level: " + PREF_zoomlevel_num); } catch (Exception e) { } } else { p.PREF_zoomlevel_num = Navit.GlobalScaleLevel; } // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void executeSearch_with_values(String street, String town, String hn, boolean offline, boolean index, boolean partialmatch, boolean hide_dupl) { Intent search_intent = new Intent(Global_Navit_Object, NavitAddressSearchActivity.class); search_intent.putExtra("title", Navit.get_text("Enter: City and Street")); //TRANS String addr1 = ""; String addr2 = ""; if ((town != null) && (street != null)) { if (index) { search_intent.putExtra("address_string", street + " " + town); addr1 = street + " " + town; addr2 = street + " " + town; } else {/* www . j av a2s .c o m*/ search_intent.putExtra("address_string", town + " " + street); addr1 = town + " " + street; addr2 = town + " " + street; } } else if (town != null) { search_intent.putExtra("address_string", town); addr1 = town; addr2 = town; } else if (street != null) { search_intent.putExtra("address_string", street); addr1 = street; addr2 = street; } if (hn != null) { search_intent.putExtra("hn_string", hn); } if (offline) { search_intent.putExtra("type", "offline"); } else { search_intent.putExtra("type", "online"); } String pm_temp = "0"; if (partialmatch) { pm_temp = "1"; } search_intent.putExtra("partial_match", pm_temp); if (index) { Navit_last_address_partial_match = partialmatch; Navit_last_address_search_string = addr2; Navit_last_address_hn_string = hn; Navit_last_address_full_file_search = false; search_hide_duplicates = hide_dupl; Global_Navit_Object.startActivityForResult(search_intent, NavitAddressSearch_id_offline); } else { Navit_last_address_partial_match = partialmatch; Navit_last_address_search_string = addr1; Navit_last_address_hn_string = hn; Navit_last_address_full_file_search = false; search_hide_duplicates = hide_dupl; // only from offline mask! // { "*A", "*AA", "*ALL*" } Navit_last_address_search_country_iso2_string = "*A"; Navit_last_address_search_country_flags = 3; Navit_last_address_search_country_id = 1; // default=*ALL* p.PREF_search_country = Navit_last_address_search_country_id; setPrefs_search_country(); // show duplicates in search ------------ Message msg2 = new Message(); Bundle b2 = new Bundle(); b2.putInt("Callback", 44); msg2.setData(b2); NavitGraphics.callback_handler.sendMessage(msg2); // show duplicates in search ------------ if (hide_dupl) { search_hide_duplicates = true; // hide duplicates when searching // hide duplicates when searching Message msg22 = new Message(); Bundle b22 = new Bundle(); b22.putInt("Callback", 45); msg22.setData(b22); NavitGraphics.callback_handler.sendMessage(msg22); // hide duplicates when searching // hide duplicates when searching } System.out.println("dialog -- 11:001"); Message msg = Navit_progress_h.obtainMessage(); Bundle b = new Bundle(); msg.what = 11; b.putInt("dialog_num", Navit.SEARCHRESULTS_WAIT_DIALOG_OFFLINE); msg.setData(b); Navit_progress_h.sendMessage(msg); } }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void static_show_route_graph(int v) { // DEBUG: toggle Routgraph on/off try {/*from ww w . ja va 2 s. c o m*/ if (v == 1) { Navit.Routgraph_enabled = 1; Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 71); b.putString("s", "" + Navit.Routgraph_enabled); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); } else if (v == 0) { Navit.Routgraph_enabled = 0; Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 71); b.putString("s", "" + Navit.Routgraph_enabled); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); } else { Navit.Routgraph_enabled = 0; Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 71); b.putString("s", "" + Navit.Routgraph_enabled); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); Thread.sleep(350); System.out.println("static_show_route_graph:v=" + v); msg = new Message(); b = new Bundle(); b.putInt("Callback", 71); b.putString("s", "" + v); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); } } catch (Exception e) { } }
From source file:com.zoffcc.applications.zanavi.Navit.java
public static void route_offline_ZANavi(String addr, float lat_start, float lon_start, boolean start_coords_valid, double lat_end, double lon_end, boolean remember_dest) { if (remember_dest) { try {/*from w w w. ja va 2 s .c om*/ Navit.remember_destination(addr, "" + lat_end, "" + lon_end); // save points write_map_points(); } catch (Exception e) { e.printStackTrace(); } } // DEBUG: clear route rectangle list NavitGraphics.route_rects.clear(); if (NavitGraphics.navit_route_status == 0) { short_toast(Navit.get_text("setting destination to") + "\n" + addr); Navit.destination_set(); Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 3); b.putString("lat", "" + lat_end); b.putString("lon", "" + lon_end); b.putString("q", addr); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); } else { short_toast(Navit.get_text("new Waypoint") + "\n" + addr); Message msg = new Message(); Bundle b = new Bundle(); b.putInt("Callback", 48); b.putString("lat", "" + lat_end); b.putString("lon", "" + lon_end); b.putString("q", addr); msg.setData(b); NavitGraphics.callback_handler.sendMessage(msg); } }
From source file:com.zoffcc.applications.zanavi.Navit.java
private static void getPrefs() { // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); // save old pref values --------------- ZANaviPrefs.deep_copy(p, p_old);/*from w ww . j a v a 2s.c om*/ // save old pref values --------------- // Get the xml/preferences.xml preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_); p.PREF_use_fast_provider = prefs.getBoolean("use_fast_provider", true); p.PREF_allow_gui_internal = prefs.getBoolean("allow_gui_internal", false); p.PREF_follow_gps = prefs.getBoolean("follow_gps", true); p.PREF_use_compass_heading_base = prefs.getBoolean("use_compass_heading_base", false); p.PREF_use_compass_heading_always = prefs.getBoolean("use_compass_heading_always", false); p.PREF_use_compass_heading_fast = prefs.getBoolean("use_compass_heading_fast", false); p.PREF_use_anti_aliasing = prefs.getBoolean("use_anti_aliasing", true); p.PREF_use_map_filtering = prefs.getBoolean("use_map_filtering", true); p.PREF_gui_oneway_arrows = prefs.getBoolean("gui_oneway_arrows", true); p.PREF_c_linedrawing = prefs.getBoolean("c_linedrawing", false); p.PREF_show_debug_messages = prefs.getBoolean("show_debug_messages", false); p.PREF_show_3d_map = prefs.getBoolean("show_3d_map", false); send_data_to_plugin_bg(PLUGIN_MSG_CAT_3d_mode, String.valueOf(p.PREF_show_3d_map)); p.PREF_use_smooth_drawing = prefs.getBoolean("use_smooth_drawing", true); p.PREF_use_more_smooth_drawing = prefs.getBoolean("use_more_smooth_drawing", false); if (p.PREF_use_smooth_drawing == false) { p.PREF_use_more_smooth_drawing = false; } if (p.PREF_use_more_smooth_drawing == true) { p.PREF_use_smooth_drawing = true; } boolean b1 = prefs.getBoolean("show_real_gps_pos", false); if (b1 == false) { p.PREF_show_real_gps_pos = 0; } else { p.PREF_show_real_gps_pos = 1; } if (p.PREF_use_more_smooth_drawing) { NavitGraphics.Vehicle_delay_real_gps_position = 595; } else { NavitGraphics.Vehicle_delay_real_gps_position = 450; } p.PREF_use_lock_on_roads = prefs.getBoolean("use_lock_on_roads", true); p.PREF_use_route_highways = prefs.getBoolean("use_route_highways", true); p.PREF_save_zoomlevel = prefs.getBoolean("save_zoomlevel", true); p.PREF_search_country = prefs.getInt("search_country_id", 1); // default=*ALL* p.PREF_zoomlevel_num = prefs.getInt("zoomlevel_num", 174698); // default zoom level = 174698 // shows almost the whole world p.PREF_show_sat_status = prefs.getBoolean("show_sat_status", true); p.PREF_use_agps = prefs.getBoolean("use_agps", true); p.PREF_enable_debug_functions = prefs.getBoolean("enable_debug_functions", false); p.PREF_show_turn_restrictions = prefs.getBoolean("show_turn_restrictions", false); p.PREF_auto_night_mode = prefs.getBoolean("auto_night_mode", true); if (FDBL) { try { if (!prefs.contains("enable_debug_crashdetect")) { prefs.edit().putBoolean("enable_debug_crashdetect", true).commit(); System.out.println("setting default value of enable_debug_crashdetect to \"true\""); } } catch (Exception e4) { } p.PREF_enable_debug_crashdetect = prefs.getBoolean("enable_debug_crashdetect", true); } else { if (PLAYSTORE_VERSION_CRASHDETECT) { try { if (!prefs.contains("enable_debug_crashdetect")) { prefs.edit().putBoolean("enable_debug_crashdetect", true).commit(); System.out.println("setting default value of enable_debug_crashdetect to \"true\""); } } catch (Exception e4) { } } p.PREF_enable_debug_crashdetect = prefs.getBoolean("enable_debug_crashdetect", PLAYSTORE_VERSION_CRASHDETECT); } // System.out.println("night mode=" + p.PREF_auto_night_mode); try { // recreate the menu items Message msg = Navit_progress_h.obtainMessage(); Bundle b = new Bundle(); msg.what = 29; msg.setData(b); Navit_progress_h.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } p.PREF_enable_debug_write_gpx = prefs.getBoolean("enable_debug_write_gpx", false); p.PREF_enable_debug_enable_comm = prefs.getBoolean("enable_debug_enable_comm", false); p.PREF_speak_street_names = prefs.getBoolean("speak_street_names", true); p.PREF_use_custom_font = prefs.getBoolean("use_custom_font", true); p.PREF_draw_polyline_circles = prefs.getBoolean("draw_polyline_circles", true); p.PREF_streetsearch_r = prefs.getString("streetsearch_r", "2"); p.PREF_route_style = prefs.getString("route_style", "3"); p.PREF_item_dump = prefs.getBoolean("item_dump", false); p.PREF_show_route_rects = prefs.getBoolean("show_route_rects", false); p.PREF_trafficlights_delay = prefs.getString("trafficlights_delay", "0"); boolean tmp = prefs.getBoolean("avoid_sharp_turns", false); p.PREF_avoid_sharp_turns = "0"; //if (tmp) //{ // p.PREF_avoid_sharp_turns = "1"; //} p.PREF_autozoom_flag = prefs.getBoolean("autozoom_flag", true); p.PREF_show_multipolygons = prefs.getBoolean("show_multipolygons", true); p.PREF_use_index_search = true; // prefs.getBoolean("use_index_search", true); // PREF_show_2d3d_toggle = prefs.getBoolean("show_2d3d_toggle", true); p.PREF_show_2d3d_toggle = true; // PREF_show_vehicle_3d = prefs.getBoolean("show_vehicle_3d", true); p.PREF_show_vehicle_3d = true; p.PREF_speak_filter_special_chars = prefs.getBoolean("speak_filter_special_chars", true); try { p.PREF_routing_engine = Integer.parseInt(prefs.getString("routing_engine", "0")); } catch (Exception e) { p.PREF_routing_engine = 0; } // send to C code -------- NavitGraphics.CallbackMessageChannel(55598, "" + p.PREF_routing_engine); // send to C code -------- p.PREF_routing_profile = prefs.getString("routing_profile", "car"); p.PREF_road_priority_001 = (prefs.getInt("road_priority_001", (68 - 10)) + 10); // must ADD minimum value!! p.PREF_road_priority_002 = (prefs.getInt("road_priority_002", (329 - 10)) + 10); // must ADD minimum value!! p.PREF_road_priority_003 = (prefs.getInt("road_priority_003", (5000 - 10)) + 10); // must ADD minimum value!! p.PREF_road_priority_004 = (prefs.getInt("road_priority_004", (5 - 0)) + 0); // must ADD minimum value!! p.PREF_night_mode_lux = (prefs.getInt("night_mode_lux", (10 - 1)) + 1); // must ADD minimum value!! p.PREF_night_mode_buffer = (prefs.getInt("night_mode_buffer", (20 - 1)) + 1); // must ADD minimum value!! // p.PREF_road_prio_weight_street_1_city = (prefs.getInt("road_prio_weight_street_1_city", (30 - 10)) + 10); // must ADD minimum value!! p.PREF_traffic_speed_factor = (prefs.getInt("traffic_speed_factor", (83 - 20)) + 20); // must ADD minimum value!! p.PREF_tracking_connected_pref = (prefs.getInt("tracking_connected_pref", (250 - 0)) + 0); // must ADD minimum value!! p.PREF_tracking_angle_pref = (prefs.getInt("tracking_angle_pref", (40 - 0)) + 0); // must ADD minimum value!! p.PREF_streets_only = prefs.getBoolean("streets_only", false); p.PREF_show_status_bar = prefs.getBoolean("show_status_bar", true); p.PREF_show_poi_on_map = prefs.getBoolean("show_poi_on_map", false); p.PREF_last_selected_dir_gpxfiles = prefs.getString("last_selected_dir_gpxfiles", MAP_FILENAME_PATH + "/../"); p.PREF_roadspeed_warning = prefs.getBoolean("roadspeed_warning", false); p.PREF_lane_assist = prefs.getBoolean("lane_assist", false); try { p.PREF_roadspeed_warning_margin = Integer.parseInt(prefs.getString("roadspeed_warning_margin", "20")); } catch (Exception e) { p.PREF_roadspeed_warning_margin = 20; } p.PREF_StreetSearchStrings = loadArray("xxStrtSrhStrxx", STREET_SEARCH_STRINGS_SAVE_COUNT); try { p.PREF_drawatorder = Integer.parseInt(prefs.getString("drawatorder", "0")); } catch (Exception e) { p.PREF_drawatorder = 0; } //try //{ // PREF_cancel_map_drawing_timeout = Integer.parseInt(prefs.getString("cancel_map_drawing_timeout", "1")); //} //catch (Exception e) //{ p.PREF_cancel_map_drawing_timeout = 1; //} try { p.PREF_map_font_size = Integer.parseInt(prefs.getString("map_font_size", "3")); } catch (Exception e) { p.PREF_map_font_size = 2; } Navit_last_address_search_country_id = p.PREF_search_country; Navit_last_address_search_country_iso2_string = NavitAddressSearchCountrySelectActivity.CountryList_Human[p.PREF_search_country][0]; if (!p.PREF_follow_gps) { // no compass turning without follow mode! p.PREF_use_compass_heading_base = false; } if (!p.PREF_use_compass_heading_base) { // child is always "false" when parent is "false" !! p.PREF_use_compass_heading_always = false; } p.PREF_show_maps_debug_view = prefs.getBoolean("show_maps_debug_view", false); p.PREF_show_vehicle_in_center = prefs.getBoolean("show_vehicle_in_center", false); p.PREF_use_imperial = prefs.getBoolean("use_imperial", false); Navit.cur_max_speed = -1; // to update speedwarning graphics // System.out.println("get settings"); // System.out.println("PREF_search_country=" + PREF_search_country); // System.out.println("PREF_follow_gps=" + PREF_follow_gps); // System.out.println("PREF_use_fast_provider=" + PREF_use_fast_provider); // System.out.println("PREF_allow_gui_internal=" + PREF_allow_gui_internal); // System.out.println("PREF_use_compass_heading_base=" + PREF_use_compass_heading_base); // System.out.println("PREF_use_compass_heading_always=" + PREF_use_compass_heading_always); // System.out.println("PREF_show_vehicle_in_center=" + PREF_show_vehicle_in_center); // System.out.println("PREF_use_imperial=" + PREF_use_imperial); // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); }