/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAddressSearchActivity.java
ZANavi

Diff of /navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAddressSearchActivity.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 49 Revision 50
79import com.zoffcc.applications.zanavi.Navit.Navit_Address_Result_Struct; 79import com.zoffcc.applications.zanavi.Navit.Navit_Address_Result_Struct;
80import com.zoffcc.applications.zanavi.NavitSearchResultListArrayAdapter.search_result_entry; 80import com.zoffcc.applications.zanavi.NavitSearchResultListArrayAdapter.search_result_entry;
81 81
82public class NavitAddressSearchActivity extends ActionBarActivity 82public class NavitAddressSearchActivity extends ActionBarActivity
83{ 83{
84 private ZANaviAutoCompleteTextViewSearchLocation address_string; 84 static ZANaviAutoCompleteTextViewSearchLocation address_string;
85 private EditText hn_string; 85 private EditText hn_string;
86 private TextView addrhn_view; 86 private TextView addrhn_view;
87 private static CheckBox pm_checkbox; 87 private static CheckBox pm_checkbox;
88 private static CheckBox hdup_checkbox; 88 private static CheckBox hdup_checkbox;
89 static TextView result_count_number; 89 static TextView result_count_number;
101 private TextView index_light_noindex_text; 101 private TextView index_light_noindex_text;
102 static SearchResultsThreadNew searchresultsThreadNew_offline = null; 102 static SearchResultsThreadNew searchresultsThreadNew_offline = null;
103 private static int res_counter_ = 0; 103 private static int res_counter_ = 0;
104 private int selected_id = -1; 104 private int selected_id = -1;
105 private int selected_id_passthru = -1; 105 private int selected_id_passthru = -1;
106 static Activity NavitAddressSearchActivity_s = null;
106 107
107 public class SearchResultListNewArrayAdapter extends ArrayAdapter<search_result_entry> 108 public class SearchResultListNewArrayAdapter extends ArrayAdapter<search_result_entry>
108 { 109 {
109 private final Context context; 110 private final Context context;
110 ArrayList<search_result_entry> l = null; 111 ArrayList<search_result_entry> l = null;
235 if ((!Navit.search_hide_duplicates) || (!Navit.Navit_Address_Result_double_index.contains(hash_id))) 236 if ((!Navit.search_hide_duplicates) || (!Navit.Navit_Address_Result_double_index.contains(hash_id)))
236 { 237 {
237 Navit.NavitAddressResultList_foundItems.add(tmp_addr); 238 Navit.NavitAddressResultList_foundItems.add(tmp_addr);
238 Navit.Navit_Address_Result_double_index.add(hash_id); 239 Navit.Navit_Address_Result_double_index.add(hash_id);
239 //System.out.println("*add*=" + hash_id); 240 //System.out.println("*add*=" + hash_id);
241
242 // System.out.println("search_result:I:" + Navit.NavitAddressResultList_foundItems.size() + ":" + tmp_addr.result_type + ":" + tmp_addr.lat + ":" + tmp_addr.lon + ":" + tmp_addr.addr);
240 243
241 if (tmp_addr.result_type.equals("TWN")) 244 if (tmp_addr.result_type.equals("TWN"))
242 { 245 {
243 Navit.search_results_towns++; 246 Navit.search_results_towns++;
244 } 247 }
453 public void run() 456 public void run()
454 { 457 {
455 Log.e("Navit", "SearchResultsThreadNew started"); 458 Log.e("Navit", "SearchResultsThreadNew started");
456 459
457 Navit.index_search_realtime = true; 460 Navit.index_search_realtime = true;
461 Navit.search_ready = false;
458 462
459 System.out.println("Global_Location_update_not_allowed = 1"); 463 System.out.println("Global_Location_update_not_allowed = 1");
460 Navit.Global_Location_update_not_allowed = 1; // dont allow location updates now! 464 Navit.Global_Location_update_not_allowed = 1; // dont allow location updates now!
461 465
462 if (Navit.use_index_search) 466 if (Navit.use_index_search)
520 } 524 }
521 525
522 // Log.e("Navit", "SearchResultsThread run1"); 526 // Log.e("Navit", "SearchResultsThread run1");
523 // need lowercase to find stuff !! 527 // need lowercase to find stuff !!
524 Navit.Navit_last_address_search_string = Navit.filter_bad_chars(Navit.Navit_last_address_search_string).toLowerCase(); 528 Navit.Navit_last_address_search_string = Navit.filter_bad_chars(Navit.Navit_last_address_search_string).toLowerCase();
525 if ((Navit.Navit_last_address_hn_string != null) && (Navit.Navit_last_address_hn_string.equals(""))) 529 if ((Navit.Navit_last_address_hn_string != null) && (!Navit.Navit_last_address_hn_string.equals("")))
526 { 530 {
527 Navit.Navit_last_address_hn_string = Navit.filter_bad_chars(Navit.Navit_last_address_hn_string).toLowerCase(); 531 Navit.Navit_last_address_hn_string = Navit.filter_bad_chars(Navit.Navit_last_address_hn_string).toLowerCase();
528 } 532 }
529 533
530 // new method with index search 534 // new method with index search
551 555
552 Log.e("Navit", "SearchResultsThread args:pm=" + partial_match_i + " str=" + street_ + " town=" + town_ + " hn=" + hn_ + " cfl=" + Navit.Navit_last_address_search_country_flags + " iso=" + Navit.Navit_last_address_search_country_iso2_string); 556 Log.e("Navit", "SearchResultsThread args:pm=" + partial_match_i + " str=" + street_ + " town=" + town_ + " hn=" + hn_ + " cfl=" + Navit.Navit_last_address_search_country_flags + " iso=" + Navit.Navit_last_address_search_country_iso2_string);
553 Navit.N_NavitGraphics.SearchResultList(2, partial_match_i, street_, town_, hn_, Navit.Navit_last_address_search_country_flags, Navit.Navit_last_address_search_country_iso2_string, "0#0", 0); 557 Navit.N_NavitGraphics.SearchResultList(2, partial_match_i, street_, town_, hn_, Navit.Navit_last_address_search_country_flags, Navit.Navit_last_address_search_country_iso2_string, "0#0", 0);
554 558
555 is_searching = false; 559 is_searching = false;
560 Navit.search_ready = true;
556 561
557 while ((!changed) && (running)) 562 while ((!changed) && (running))
558 { 563 {
559 try 564 try
560 { 565 {
607 public void onClick(View v) 612 public void onClick(View v)
608 { 613 {
609 finish(); 614 finish();
610 } 615 }
611 }); 616 });
617
618 NavitAddressSearchActivity_s = this;
612 619
613 // address: label 620 // address: label
614 TextView addr_view = (TextView) findViewById(R.id.enter_dest); 621 TextView addr_view = (TextView) findViewById(R.id.enter_dest);
615 addr_view.setText(Navit.get_text("Enter Destination")); //TRANS 622 addr_view.setText(Navit.get_text("Enter Destination")); //TRANS
616 623
756 } 763 }
757 } 764 }
758 catch (Exception e) 765 catch (Exception e)
759 { 766 {
760 } 767 }
761 768
762 hn_string = (EditText) findViewById(R.id.et_house_number_string); 769 hn_string = (EditText) findViewById(R.id.et_house_number_string);
763 770
764 if (Navit.use_index_search) 771 if (Navit.use_index_search)
765 { 772 {
766 773
1057 break; 1064 break;
1058 } 1065 }
1059 1066
1060 } 1067 }
1061 1068
1069 static void force_done()
1070 {
1071 try
1072 {
1073 if (searchresultsThreadNew_offline != null)
1074 {
1075 searchresultsThreadNew_offline.stop_me();
1076 }
1077 }
1078 catch (Exception e)
1079 {
1080 }
1081
1082 Intent resultIntent = new Intent();
1083
1084 NavitAddressSearchActivity_s.setResult(ActionBarActivity.RESULT_OK, resultIntent);
1085 resultIntent.putExtra("address_string", NavitAddressSearchActivity.address_string.getText().toString());
1086 resultIntent.putExtra("what", "-");
1087
1088 NavitAddressSearchActivity_s.finish();
1089 }
1090
1062 private void executeDone(String what) 1091 private void executeDone(String what)
1063 { 1092 {
1064 try 1093 try
1065 { 1094 {
1066 if (searchresultsThreadNew_offline != null) 1095 if (searchresultsThreadNew_offline != null)
1071 catch (Exception e) 1100 catch (Exception e)
1072 { 1101 {
1073 } 1102 }
1074 1103
1075 Intent resultIntent = new Intent(); 1104 Intent resultIntent = new Intent();
1076 resultIntent.putExtra("address_string", NavitAddressSearchActivity.this.address_string.getText().toString()); 1105 resultIntent.putExtra("address_string", NavitAddressSearchActivity.address_string.getText().toString());
1077 1106
1078 if (this.search_type.endsWith("offline")) 1107 if (this.search_type.endsWith("offline"))
1079 { 1108 {
1080 if (Navit.use_index_search) 1109 if (Navit.use_index_search)
1081 { 1110 {
1082 resultIntent.putExtra("hn_string", NavitAddressSearchActivity.this.hn_string.getText().toString()); 1111 resultIntent.putExtra("hn_string", NavitAddressSearchActivity.this.hn_string.getText().toString());
1083 } 1112 }
1084 1113
1085 if (NavitAddressSearchActivity.this.pm_checkbox.isChecked()) 1114 if (NavitAddressSearchActivity.pm_checkbox.isChecked())
1086 { 1115 {
1087 resultIntent.putExtra("partial_match", "1"); 1116 resultIntent.putExtra("partial_match", "1");
1088 } 1117 }
1089 else 1118 else
1090 { 1119 {
1091 resultIntent.putExtra("partial_match", "0"); 1120 resultIntent.putExtra("partial_match", "0");
1092 } 1121 }
1093 1122
1094 if (NavitAddressSearchActivity.this.hdup_checkbox.isChecked()) 1123 if (NavitAddressSearchActivity.hdup_checkbox.isChecked())
1095 { 1124 {
1096 resultIntent.putExtra("hide_dup", "1"); 1125 resultIntent.putExtra("hide_dup", "1");
1097 } 1126 }
1098 else 1127 else
1099 { 1128 {

Legend:
Removed from v.49  
changed lines
  Added in v.50

   
Visit the ZANavi Wiki