From: <zo...@us...> - 2011-02-18 21:08:55
|
Revision: 4207 http://navit.svn.sourceforge.net/navit/?rev=4207&view=rev Author: zoff99 Date: 2011-02-18 21:08:46 +0000 (Fri, 18 Feb 2011) Log Message: ----------- Add:Android:activate a newly downloaded map (works now only if there is no mapfile yet) Modified Paths: -------------- trunk/navit/navit/android/src/org/navitproject/navit/Navit.java trunk/navit/navit/android/src/org/navitproject/navit/NavitMapDownloader.java Modified: trunk/navit/navit/android/src/org/navitproject/navit/Navit.java =================================================================== --- trunk/navit/navit/android/src/org/navitproject/navit/Navit.java 2011-02-18 21:04:57 UTC (rev 4206) +++ trunk/navit/navit/android/src/org/navitproject/navit/Navit.java 2011-02-18 21:08:46 UTC (rev 4207) @@ -595,6 +595,14 @@ // dismiss dialog, remove dialog dismissDialog(msg.getData().getInt("dialog_num")); removeDialog(msg.getData().getInt("dialog_num")); + // try to use the new downloaded map (works only when there is now map yet!) + // please fix me in the C-source !! + // please fix me in the C-source !! + Message msg2 = new Message(); + Bundle b2 = new Bundle(); + b2.putInt("Callback", 6); + msg2.setData(b2); + N_NavitGraphics.callback_handler.sendMessage(msg2); break; case 1 : // change progressbar values Modified: trunk/navit/navit/android/src/org/navitproject/navit/NavitMapDownloader.java =================================================================== --- trunk/navit/navit/android/src/org/navitproject/navit/NavitMapDownloader.java 2011-02-18 21:04:57 UTC (rev 4206) +++ trunk/navit/navit/android/src/org/navitproject/navit/NavitMapDownloader.java 2011-02-18 21:08:46 UTC (rev 4207) @@ -180,7 +180,8 @@ File file = new File(PATH); File outputFile = new File(file, fileName); File final_outputFile = new File(file, final_fileName); - //outputFile.delete(); + // tests have shown that deleting the file first is sometimes faster -> so we delete it (who cares) + outputFile.delete(); // seems this command overwrites the output file anyway FileOutputStream fos = new FileOutputStream(outputFile); BufferedOutputStream buf = new BufferedOutputStream(fos, MAP_WRITE_FILE_BUFFER); // buffer @@ -194,9 +195,9 @@ int alt = UPDATE_PROGRESS_EVERY_CYCLE; // show progress about every xx cylces int alt_cur = 0; String kbytes_per_second = ""; - long last_timestamp = 0; + //long last_timestamp = 0; long start_timestamp = System.currentTimeMillis(); - int last_bytes = 0; + //int last_bytes = 0; NumberFormat formatter = new DecimalFormat("00000.0"); String eta_string = ""; float per_second_overall = 0f; @@ -241,8 +242,8 @@ // // .currentTimeMillis() - last_timestamp) / 1000f)); // //kbytes_per_second = formatter.format(temp); // } - last_timestamp = System.currentTimeMillis(); - last_bytes = already_read; + //last_timestamp = System.currentTimeMillis(); + //last_bytes = already_read; per_second_overall = (float) already_read / (float) ((System.currentTimeMillis() - start_timestamp) / 1000); kbytes_per_second = formatter.format((per_second_overall / 1024f)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |