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

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

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

Revision 40 Revision 41
102 } 102 }
103 103
104 @Override 104 @Override
105 public void onCreate(Bundle savedInstanceState) 105 public void onCreate(Bundle savedInstanceState)
106 { 106 {
107 Navit.applySharedTheme(this, Navit.PREF_current_theme); 107 Navit.applySharedTheme(this, Navit.p.PREF_current_theme);
108 108
109 super.onCreate(savedInstanceState); 109 super.onCreate(savedInstanceState);
110 overridePendingTransition(R.anim.pull_in_from_right, R.anim.hold); 110 overridePendingTransition(R.anim.pull_in_from_right, R.anim.hold);
111 111
112 my = this; 112 my = this;
113 113
114 context_items = new String[] { Navit.get_text("delete Destination"), Navit.get_text("rename Destination"), Navit.get_text("set as Home Location") }; // TRANS 114 context_items = new String[] { Navit.get_text("delete Destination"), Navit.get_text("rename Destination"), Navit.get_text("set as Home Location"), Navit.get_text("show destination on map"), Navit.get_text("Use as destination") }; // TRANS
115 115
116 listview_items.clear(); 116 listview_items.clear();
117 listview_addons.clear(); 117 listview_addons.clear();
118 118
119 // crash reported on google play store 119 // crash reported on google play store
254 @Override 254 @Override
255 public boolean onContextItemSelected(MenuItem item) 255 public boolean onContextItemSelected(MenuItem item)
256 { 256 {
257 AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); 257 AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
258 int menuItemIndex = item.getItemId(); 258 int menuItemIndex = item.getItemId();
259 String menuItemName = context_items[menuItemIndex]; 259 // String menuItemName = context_items[menuItemIndex];
260 t_position = info.position; 260 t_position = info.position;
261 t_size = Navit.map_points.size(); 261 t_size = Navit.map_points.size();
262 String listItemName = Navit.map_points.get(t_size - t_position - 1).point_name; 262 // String listItemName = Navit.map_points.get(t_size - t_position - 1).point_name;
263 263
264 switch (menuItemIndex) 264 switch (menuItemIndex)
265 { 265 {
266 case 0: 266 case 0:
267 // delete item 267 // delete item
293 } 293 }
294 294
295 ); 295 );
296 rd.show(); 296 rd.show();
297 break; 297 break;
298 case 3:
299 // show position on map
300 NavitRecentDestinationActivity.t = Navit.map_points.get(t_size - t_position - 1);
301 // compensate "selected_id" for reverse listing order of items!
302 this.selected_id = t_size - t_position - 1;
303 executeDone(1);
304 break;
305 case 4:
306 // navigate to position
307 NavitRecentDestinationActivity.t = Navit.map_points.get(t_size - t_position - 1);
308 // compensate "selected_id" for reverse listing order of items!
309 this.selected_id = t_size - t_position - 1;
310 executeDone(0);
311 break;
298 case 2: 312 case 2:
299 // find old HOME item 313 // find old HOME item
300 int old_home_id = Navit.find_home_point(); 314 int old_home_id = Navit.find_home_point();
301 if (old_home_id != -1) 315 if (old_home_id != -1)
302 { 316 {
347 int t_p = position; 361 int t_p = position;
348 int t_s = Navit.map_points.size(); 362 int t_s = Navit.map_points.size();
349 // compensate "selected_id" for reverse listing order of items! 363 // compensate "selected_id" for reverse listing order of items!
350 this.selected_id = t_s - t_p - 1; 364 this.selected_id = t_s - t_p - 1;
351 // close this activity 365 // close this activity
352 executeDone(); 366 executeDone(0);
353 } 367 }
354 368
355 private void executeDone() 369 private void executeDone(int mode)
356 { 370 {
357 Intent resultIntent = new Intent(); 371 Intent resultIntent = new Intent();
358 resultIntent.putExtra("selected_id", String.valueOf(this.selected_id)); 372 resultIntent.putExtra("selected_id", String.valueOf(this.selected_id));
373 if (mode == 1)
374 {
375 resultIntent.putExtra("what", "view");
376 }
377 else
378 {
379 resultIntent.putExtra("what", "navigate");
380 }
359 setResult(Activity.RESULT_OK, resultIntent); 381 setResult(Activity.RESULT_OK, resultIntent);
360 finish(); 382 finish();
361 } 383 }
362} 384}

Legend:
Removed from v.40  
changed lines
  Added in v.41

   
Visit the ZANavi Wiki