String lon2;\r
String lat2;\r
String map_name = "";\r
- int est_size_bytes = 0;\r
+ long est_size_bytes = 0;\r
\r
public osm_map_values(String mapname, String lon_1, String lat_1, String lon_2, String lat_2,\r
- int bytes_est)\r
+ long bytes_est)\r
{\r
this.map_name = mapname;\r
this.lon1 = lon_1;\r
//\r
// define the maps here\r
// name , lon1 , lat1 , lon2 , lat2, est. size in bytes\r
- public static osm_map_values austria = new osm_map_values("Austria",\r
- "9.4", "46.32", "17.21",\r
- "49.1", 222000000);\r
- public static osm_map_values benelux = new osm_map_values("BeNeLux",\r
- "2.08", "48.87", "7.78",\r
- "54.52", 530000000);\r
- public static osm_map_values germany = new osm_map_values("Germany",\r
- "5.18", "46.84", "15.47",\r
- "55.64", 943000000);\r
- public static osm_map_values[] OSM_MAPS = new osm_map_values[]{\r
- NavitMapDownloader.austria, NavitMapDownloader.germany, NavitMapDownloader.benelux};\r
- public static String[] OSM_MAP_NAME_LIST = new String[]{\r
- NavitMapDownloader.OSM_MAPS[0].map_name, NavitMapDownloader.OSM_MAPS[1].map_name,\r
- NavitMapDownloader.OSM_MAPS[2].map_name };\r
-\r
- public Boolean stop_me = false;\r
- static final int SOCKET_CONNECT_TIMEOUT = 6000;\r
- static final int SOCKET_READ_TIMEOUT = 6000;\r
- static final int MAP_WRITE_FILE_BUFFER = 1024 * 64;\r
- static final int MAP_WRITE_MEM_BUFFER = 1024 * 64;\r
- static final int MAP_READ_FILE_BUFFER = 1024 * 64;\r
- static final int UPDATE_PROGRESS_EVERY_CYCLE = 2;\r
+ /*\r
+ * public static osm_map_values austria = new osm_map_values("Austria",\r
+ * "9.4", "46.32", "17.21",\r
+ * "49.1", 222000000);\r
+ * public static osm_map_values benelux = new osm_map_values("BeNeLux",\r
+ * "2.08", "48.87", "7.78",\r
+ * "54.52", 530000000);\r
+ * public static osm_map_values germany = new osm_map_values("Germany",\r
+ * "5.18", "46.84", "15.47",\r
+ * "55.64", 943000000);\r
+ */\r
+\r
+\r
+ public static osm_map_values Whole_Planet = new osm_map_values(\r
+ "Whole Planet",\r
+ "-180",\r
+ "-90",\r
+ "180",\r
+ "90",\r
+ (long) (5.6 * 1024 * 1024 * 1024));\r
+ public static osm_map_values Africa = new osm_map_values("Africa",\r
+ "-20.8", "-35.2",\r
+ "52.5", "37.4", 20);\r
+ public static osm_map_values Angola = new osm_map_values("Angola",\r
+ "11.4", "-18.1", "24.2",\r
+ "-5.3", 20);\r
+ public static osm_map_values Burundi = new osm_map_values(\r
+ "Burundi", "28.9",\r
+ "-4.5", "30.9", "-2.2",\r
+ 20);\r
+ public static osm_map_values Democratic_Republic_of_the_Congo = new osm_map_values(\r
+ "Democratic Republic of the Congo",\r
+ "11.7", "-13.6", "31.5",\r
+ "5.7", 20);\r
+ public static osm_map_values Kenya = new osm_map_values("Kenya",\r
+ "33.8", "-5.2", "42.4",\r
+ "4.9", 20);\r
+ public static osm_map_values Lesotho = new osm_map_values(\r
+ "Lesotho", "26.9",\r
+ "-30.7", "29.6",\r
+ "-28.4", 20);\r
+ public static osm_map_values Madagascar = new osm_map_values(\r
+ "Madagascar", "43.0",\r
+ "-25.8", "50.8",\r
+ "-11.8", 20);\r
+ public static osm_map_values Nambia_Botswana = new osm_map_values(\r
+ "Nambia+Botswana",\r
+ "11.4", "-29.1", "29.5",\r
+ "-16.9", 20);\r
+ public static osm_map_values Reunion = new osm_map_values(\r
+ "Reunion", "55.2",\r
+ "-21.4", "55.9",\r
+ "-20.9", 20);\r
+ public static osm_map_values Rwanda = new osm_map_values("Rwanda",\r
+ "28.8", "-2.9", "30.9",\r
+ "-1.0", 20);\r
+ public static osm_map_values South_Africa = new osm_map_values(\r
+ "South Africa", "15.6",\r
+ "-35.2", "33.3",\r
+ "-21.9", 20);\r
+ public static osm_map_values Uganda = new osm_map_values("Uganda",\r
+ "29.3", "-1.6", "35.1",\r
+ "4.3", 20);\r
+ public static osm_map_values Asia = new osm_map_values("Asia",\r
+ "23.8", "0.1", "195.0",\r
+ "82.4", 20);\r
+ public static osm_map_values China = new osm_map_values("China",\r
+ "67.3", "5.3", "135.0",\r
+ "54.5", 20);\r
+ public static osm_map_values Cyprus = new osm_map_values("Cyprus",\r
+ "32.0", "34.5", "34.9",\r
+ "35.8", 20);\r
+ public static osm_map_values India_Nepal = new osm_map_values(\r
+ "India+Nepal", "67.9",\r
+ "5.5", "89.6", "36.0",\r
+ 20);\r
+ public static osm_map_values Indonesia = new osm_map_values(\r
+ "Indonesia", "93.7",\r
+ "-17.3", "155.5", "7.6",\r
+ 20);\r
+ public static osm_map_values Iran = new osm_map_values("Iran",\r
+ "43.5", "24.4", "63.6",\r
+ "40.4", 20);\r
+ public static osm_map_values Iraq = new osm_map_values("Iraq",\r
+ "38.7", "28.5", "49.2",\r
+ "37.4", 20);\r
+ public static osm_map_values Israel = new osm_map_values("Israel",\r
+ "33.99", "29.8",\r
+ "35.95", "33.4", 20);\r
+ public static osm_map_values Japan_Korea_Taiwan = new osm_map_values(\r
+ "Japan+Korea+Taiwan",\r
+ "117.6", "20.5",\r
+ "151.3", "47.1", 20);\r
+ public static osm_map_values Malasia_Singapore = new osm_map_values(\r
+ "Malasia+Singapore",\r
+ "94.3", "-5.9", "108.6",\r
+ "6.8", 20);\r
+ public static osm_map_values Mongolia = new osm_map_values(\r
+ "Mongolia", "87.5",\r
+ "41.4", "120.3", "52.7",\r
+ 20);\r
+ public static osm_map_values Thailand = new osm_map_values(\r
+ "Thailand", "97.5",\r
+ "5.7", "105.2", "19.7",\r
+ 20);\r
+ public static osm_map_values Turkey = new osm_map_values("Turkey",\r
+ "25.1", "35.8", "46.4",\r
+ "42.8", 20);\r
+ public static osm_map_values UAE_Other = new osm_map_values(\r
+ "UAE+Other", "51.5",\r
+ "22.6", "56.7", "26.5",\r
+ 20);\r
+ public static osm_map_values Australia = new osm_map_values(\r
+ "Australia", "110.5",\r
+ "-44.2", "154.9",\r
+ "-9.2", 20);\r
+ public static osm_map_values Tasmania = new osm_map_values(\r
+ "Tasmania", "144.0",\r
+ "-45.1", "155.3",\r
+ "-24.8", 20);\r
+ public static osm_map_values Victoria_New_South_Wales = new osm_map_values(\r
+ "Victoria+New South Wales",\r
+ "140.7", "-39.4",\r
+ "153.7", "-26.9", 20);\r
+ public static osm_map_values New_Zealand = new osm_map_values(\r
+ "New Zealand", "165.2",\r
+ "-47.6", "179.1",\r
+ "-33.7", 20);\r
+ public static osm_map_values Europe = new osm_map_values("Europe",\r
+ "-12.97", "33.59",\r
+ "34.15", "72.10", 20);\r
+ public static osm_map_values Western_Europe = new osm_map_values(\r
+ "Western Europe",\r
+ "-17.6", "34.5", "42.9",\r
+ "70.9", 20);\r
+ public static osm_map_values Austria = new osm_map_values(\r
+ "Austria", "9.4",\r
+ "46.32", "17.21",\r
+ "49.1", 20);\r
+ public static osm_map_values BeNeLux = new osm_map_values(\r
+ "BeNeLux", "2.08",\r
+ "48.87", "7.78",\r
+ "54.52", 20);\r
+ public static osm_map_values Faroe_Islands = new osm_map_values(\r
+ "Faroe Islands", "-7.8",\r
+ "61.3", "-6.1", "62.5",\r
+ 20);\r
+ public static osm_map_values France = new osm_map_values("France",\r
+ "-5.45", "42.00",\r
+ "8.44", "51.68", 20);\r
+ public static osm_map_values Germany = new osm_map_values(\r
+ "Germany", "5.18",\r
+ "46.84", "15.47",\r
+ "55.64", 20);\r
+ public static osm_map_values Bavaria = new osm_map_values(\r
+ "Bavaria", "10.3",\r
+ "47.8", "13.6", "49.7",\r
+ 20);\r
+ public static osm_map_values Saxonia = new osm_map_values(\r
+ "Saxonia", "11.8",\r
+ "50.1", "15.0", "51.7",\r
+ 20);\r
+ public static osm_map_values Germany_Austria_Switzerland = new osm_map_values(\r
+ "Germany+Austria+Switzerland",\r
+ "3.4", "44.5", "18.6",\r
+ "55.1", 20);\r
+ public static osm_map_values Iceland = new osm_map_values(\r
+ "Iceland", "-25.3",\r
+ "62.8", "-11.4", "67.5",\r
+ 20);\r
+ public static osm_map_values Ireland = new osm_map_values(\r
+ "Ireland", "-11.17",\r
+ "51.25", "-5.23",\r
+ "55.9", 20);\r
+ public static osm_map_values Italy = new osm_map_values("Italy",\r
+ "6.52", "36.38",\r
+ "18.96", "47.19", 20);\r
+ public static osm_map_values Spain_Portugal = new osm_map_values(\r
+ "Spain+Portugal",\r
+ "-11.04", "34.87",\r
+ "4.62", "44.41", 20);\r
+ public static osm_map_values Mallorca = new osm_map_values(\r
+ "Mallorca", "2.2",\r
+ "38.8", "4.7", "40.2",\r
+ 20);\r
+ public static osm_map_values Galicia = new osm_map_values(\r
+ "Galicia", "-10.0",\r
+ "41.7", "-6.3", "44.1",\r
+ 20);\r
+ public static osm_map_values Scandinavia = new osm_map_values(\r
+ "Scandinavia", "4.0",\r
+ "54.4", "32.1", "71.5",\r
+ 20);\r
+ public static osm_map_values Finland = new osm_map_values(\r
+ "Finland", "18.6",\r
+ "59.2", "32.3", "70.3",\r
+ 20);\r
+ public static osm_map_values Denmark = new osm_map_values(\r
+ "Denmark", "7.49",\r
+ "54.33", "13.05",\r
+ "57.88", 20);\r
+ public static osm_map_values Switzerland = new osm_map_values(\r
+ "Switzerland", "5.79",\r
+ "45.74", "10.59",\r
+ "47.84", 20);\r
+ public static osm_map_values UK = new osm_map_values("UK",\r
+ "-9.7", "49.6", "2.2",\r
+ "61.2", 20);\r
+ public static osm_map_values Bulgaria = new osm_map_values(\r
+ "Bulgaria", "24.7",\r
+ "42.1", "24.8", "42.1",\r
+ 20);\r
+ public static osm_map_values Czech_Republic = new osm_map_values(\r
+ "Czech Republic",\r
+ "11.91", "48.48",\r
+ "19.02", "51.17", 20);\r
+ public static osm_map_values Croatia = new osm_map_values(\r
+ "Croatia", "13.4",\r
+ "42.1", "19.4", "46.9",\r
+ 20);\r
+ public static osm_map_values Estonia = new osm_map_values(\r
+ "Estonia", "21.5",\r
+ "57.5", "28.2", "59.6",\r
+ 20);\r
+ public static osm_map_values Greece = new osm_map_values("Greece",\r
+ "28.9", "37.8", "29.0",\r
+ "37.8", 20);\r
+ public static osm_map_values Crete = new osm_map_values("Crete",\r
+ "23.3", "34.5", "26.8",\r
+ "36.0", 20);\r
+ public static osm_map_values Hungary = new osm_map_values(\r
+ "Hungary", "16.08",\r
+ "45.57", "23.03",\r
+ "48.39", 20);\r
+ public static osm_map_values Latvia = new osm_map_values("Latvia",\r
+ "20.7", "55.6", "28.3",\r
+ "58.1", 20);\r
+ public static osm_map_values Lithuania = new osm_map_values(\r
+ "Lithuania", "20.9",\r
+ "53.8", "26.9", "56.5",\r
+ 20);\r
+ public static osm_map_values Poland = new osm_map_values("Poland",\r
+ "13.6", "48.8", "24.5",\r
+ "55.0", 20);\r
+ public static osm_map_values Romania = new osm_map_values(\r
+ "Romania", "20.3",\r
+ "43.5", "29.9", "48.4",\r
+ 20);\r
+ public static osm_map_values North_America = new osm_map_values(\r
+ "North America",\r
+ "-178.1", "6.5",\r
+ "-10.4", "84.0", 20);\r
+ public static osm_map_values Alaska = new osm_map_values("Alaska",\r
+ "-179.5", "49.5",\r
+ "-129", "71.6", 20);\r
+ public static osm_map_values Canada = new osm_map_values("Canada",\r
+ "-141.3", "41.5",\r
+ "-52.2", "70.2", 20);\r
+ public static osm_map_values Hawaii = new osm_map_values("Hawaii",\r
+ "-161.07", "18.49",\r
+ "-154.45", "22.85", 20);\r
+ public static osm_map_values USA__except_Alaska_and_Hawaii_ = new osm_map_values(\r
+ "USA (except Alaska and Hawaii)",\r
+ "-125.4", "24.3",\r
+ "-66.5", "49.3", 20);\r
+ public static osm_map_values Nevada = new osm_map_values("Nevada",\r
+ "-120.2", "35.0",\r
+ "-113.8", "42.1", 20);\r
+ public static osm_map_values Oregon = new osm_map_values("Oregon",\r
+ "-124.8", "41.8",\r
+ "-116.3", "46.3", 20);\r
+ public static osm_map_values Washington_State = new osm_map_values(\r
+ "Washington State",\r
+ "-125.0", "45.5",\r
+ "-116.9", "49.0", 20);\r
+ public static osm_map_values South_Middle_America = new osm_map_values(\r
+ "South+Middle America",\r
+ "-83.5", "-56.3",\r
+ "-30.8", "13.7", 20);\r
+ public static osm_map_values Argentina = new osm_map_values(\r
+ "Argentina", "-73.9",\r
+ "-57.3", "-51.6",\r
+ "-21.0", 20);\r
+ public static osm_map_values Argentina_Chile = new osm_map_values(\r
+ "Argentina+Chile",\r
+ "-77.2", "-56.3",\r
+ "-52.7", "-16.1", 20);\r
+ public static osm_map_values Bolivia = new osm_map_values(\r
+ "Bolivia", "-70.5",\r
+ "-23.1", "-57.3",\r
+ "-9.3", 20);\r
+ public static osm_map_values Brazil = new osm_map_values("Brazil",\r
+ "-71.4", "-34.7",\r
+ "-32.8", "5.4", 20);\r
+ public static osm_map_values Cuba = new osm_map_values("Cuba",\r
+ "-85.3", "19.6",\r
+ "-74.0", "23.6", 20);\r
+ public static osm_map_values Colombia = new osm_map_values(\r
+ "Colombia", "-79.1",\r
+ "-4.0", "-66.7", "12.6",\r
+ 20);\r
+ public static osm_map_values Ecuador = new osm_map_values(\r
+ "Ecuador", "-82.6",\r
+ "-5.4", "-74.4", "2.3",\r
+ 20);\r
+ public static osm_map_values Guyana_Suriname_Guyane_Francaise = new osm_map_values(\r
+ "Guyana+Suriname+Guyane Francaise",\r
+ "-62.0", "1.0", "-51.2",\r
+ "8.9", 20);\r
+ public static osm_map_values Haiti_Republica_Dominicana = new osm_map_values(\r
+ "Haiti+Republica Dominicana",\r
+ "-74.8", "17.3",\r
+ "-68.2", "20.1", 20);\r
+ public static osm_map_values Jamaica = new osm_map_values(\r
+ "Jamaica", "-78.6",\r
+ "17.4", "-75.9", "18.9",\r
+ 20);\r
+ public static osm_map_values Mexico = new osm_map_values("Mexico",\r
+ "-117.6", "14.1",\r
+ "-86.4", "32.8", 20);\r
+ public static osm_map_values Paraguay = new osm_map_values(\r
+ "Paraguay", "-63.8",\r
+ "-28.1", "-53.6",\r
+ "-18.8", 20);\r
+ public static osm_map_values Peru = new osm_map_values("Peru",\r
+ "-82.4", "-18.1",\r
+ "-67.5", "0.4", 20);\r
+ public static osm_map_values Uruguay = new osm_map_values(\r
+ "Uruguay", "-59.2",\r
+ "-36.5", "-51.7",\r
+ "-29.7", 20);\r
+ public static osm_map_values Venezuela = new osm_map_values(\r
+ "Venezuela", "-73.6",\r
+ "0.4", "-59.7", "12.8",\r
+ 20);\r
+\r
+\r
+ public static osm_map_values[] OSM_MAPS = new osm_map_values[]{\r
+ Whole_Planet, Africa, Angola, Burundi, Democratic_Republic_of_the_Congo, Kenya, Lesotho,\r
+ Madagascar, Nambia_Botswana, Reunion, Rwanda, South_Africa, Uganda, Asia, China, Cyprus,\r
+ India_Nepal, Indonesia, Iran, Iraq, Israel, Japan_Korea_Taiwan, Malasia_Singapore,\r
+ Mongolia, Nambia_Botswana, Thailand, Turkey, UAE_Other, Australia, Tasmania,\r
+ Victoria_New_South_Wales, New_Zealand, Europe, Western_Europe, Austria, BeNeLux,\r
+ Faroe_Islands, France, Germany, Bavaria, Saxonia, Germany_Austria_Switzerland, Iceland,\r
+ Ireland, Italy, Spain_Portugal, Mallorca, Galicia, Scandinavia, Finland, Denmark,\r
+ Switzerland, UK, Bulgaria, Czech_Republic, Croatia, Estonia, Greece, Crete, Hungary,\r
+ Latvia, Lithuania, Poland, Romania, North_America, Alaska, Canada, Hawaii,\r
+ USA__except_Alaska_and_Hawaii_, Nevada, Oregon, Washington_State, South_Middle_America,\r
+ Argentina, Argentina_Chile, Bolivia, Brazil, Cuba, Colombia, Ecuador,\r
+ Guyana_Suriname_Guyane_Francaise, Haiti_Republica_Dominicana, Jamaica, Mexico, Paraguay,\r
+ Peru, Uruguay, Venezuela };\r
+ public static String[] OSM_MAP_NAME_LIST = new String[]{\r
+ Whole_Planet.map_name, Africa.map_name, Angola.map_name, Burundi.map_name,\r
+ Democratic_Republic_of_the_Congo.map_name, Kenya.map_name, Lesotho.map_name,\r
+ Madagascar.map_name, Nambia_Botswana.map_name, Reunion.map_name, Rwanda.map_name,\r
+ South_Africa.map_name, Uganda.map_name, Asia.map_name, China.map_name, Cyprus.map_name,\r
+ India_Nepal.map_name, Indonesia.map_name, Iran.map_name, Iraq.map_name, Israel.map_name,\r
+ Japan_Korea_Taiwan.map_name, Malasia_Singapore.map_name, Mongolia.map_name,\r
+ Nambia_Botswana.map_name, Thailand.map_name, Turkey.map_name, UAE_Other.map_name,\r
+ Australia.map_name, Tasmania.map_name, Victoria_New_South_Wales.map_name,\r
+ New_Zealand.map_name, Europe.map_name, Western_Europe.map_name, Austria.map_name,\r
+ BeNeLux.map_name, Faroe_Islands.map_name, France.map_name, Germany.map_name,\r
+ Bavaria.map_name, Saxonia.map_name, Germany_Austria_Switzerland.map_name,\r
+ Iceland.map_name, Ireland.map_name, Italy.map_name, Spain_Portugal.map_name,\r
+ Mallorca.map_name, Galicia.map_name, Scandinavia.map_name, Finland.map_name,\r
+ Denmark.map_name, Switzerland.map_name, UK.map_name, Bulgaria.map_name,\r
+ Czech_Republic.map_name, Croatia.map_name, Estonia.map_name, Greece.map_name,\r
+ Crete.map_name, Hungary.map_name, Latvia.map_name, Lithuania.map_name, Poland.map_name,\r
+ Romania.map_name, North_America.map_name, Alaska.map_name, Canada.map_name,\r
+ Hawaii.map_name, USA__except_Alaska_and_Hawaii_.map_name, Nevada.map_name,\r
+ Oregon.map_name, Washington_State.map_name, South_Middle_America.map_name,\r
+ Argentina.map_name, Argentina_Chile.map_name, Bolivia.map_name, Brazil.map_name,\r
+ Cuba.map_name, Colombia.map_name, Ecuador.map_name,\r
+ Guyana_Suriname_Guyane_Francaise.map_name, Haiti_Republica_Dominicana.map_name,\r
+ Jamaica.map_name, Mexico.map_name, Paraguay.map_name, Peru.map_name, Uruguay.map_name,\r
+ Venezuela.map_name };\r
+\r
+ public Boolean stop_me = false;\r
+ static final int SOCKET_CONNECT_TIMEOUT = 6000;\r
+ static final int SOCKET_READ_TIMEOUT = 6000;\r
+ static final int MAP_WRITE_FILE_BUFFER = 1024 * 64;\r
+ static final int MAP_WRITE_MEM_BUFFER = 1024 * 64;\r
+ static final int MAP_READ_FILE_BUFFER = 1024 * 64;\r
+ static final int UPDATE_PROGRESS_EVERY_CYCLE = 8;\r
\r
\r
public class ProgressThread extends Thread\r
Message msg = handler.obtainMessage();\r
Bundle b = new Bundle();\r
msg.what = 1;\r
- b.putInt("max", map_values.est_size_bytes);\r
+ b.putInt("max", 20); // use a dummy number here\r
b.putInt("cur", 0);\r
b.putString("title", "Mapdownload");\r
b.putString("text", "downloading: " + map_values.map_name);\r
c.setDoOutput(true);\r
c.setReadTimeout(SOCKET_READ_TIMEOUT);\r
c.setConnectTimeout(SOCKET_CONNECT_TIMEOUT);\r
- int real_size_bytes = c.getContentLength();\r
+ long real_size_bytes = c.getContentLength();\r
c.connect();\r
\r
- if (real_size_bytes > 0)\r
+ Log.d("NavitMapDownloader", "real size in bytes: " + real_size_bytes);\r
+ if (real_size_bytes > 20)\r
{\r
// change the estimated filesize to reported filesize\r
map_values.est_size_bytes = real_size_bytes;\r
}\r
+ Log.d("NavitMapDownloader", "size in bytes: " + map_values.est_size_bytes);\r
\r
File file = new File(PATH);\r
File outputFile = new File(file, fileName);\r
File final_outputFile = new File(file, final_fileName);\r
- // tests have shown that deleting the file first is sometimes faster -> so we delete it (who cares)\r
+ // tests have shown that deleting the file first is sometimes faster -> so we delete it (who knows)\r
outputFile.delete();\r
// seems this command overwrites the output file anyway\r
FileOutputStream fos = new FileOutputStream(outputFile);\r
int alt = UPDATE_PROGRESS_EVERY_CYCLE; // show progress about every xx cylces\r
int alt_cur = 0;\r
String kbytes_per_second = "";\r
- //long last_timestamp = 0;\r
long start_timestamp = System.currentTimeMillis();\r
- //int last_bytes = 0;\r
NumberFormat formatter = new DecimalFormat("00000.0");\r
String eta_string = "";\r
float per_second_overall = 0f;\r
- int bytes_remaining = 0;\r
+ long bytes_remaining = 0;\r
int eta_seconds = 0;\r
- //while ((len1 = is.read(buffer)) != -1)\r
while ((len1 = bif.read(buffer)) != -1)\r
{\r
if (stop_me)\r
{\r
// ok we need to be stopped! close all files and end\r
- Log.d("NavitMapDownloader", "stop_me 1");\r
buf.flush();\r
buf.close();\r
fos.close();\r
bif.close();\r
is.close();\r
- Log.d("NavitMapDownloader", "stop_me 2");\r
c.disconnect();\r
- Log.d("NavitMapDownloader", "stop_me 3");\r
return 2;\r
}\r
already_read = already_read + len1;\r
msg = handler.obtainMessage();\r
b = new Bundle();\r
msg.what = 1;\r
- b.putInt("max", map_values.est_size_bytes);\r
- b.putInt("cur", already_read);\r
+ b.putInt("max", (int) (map_values.est_size_bytes / 1024));\r
+ b.putInt("cur", (int) (already_read / 1024));\r
b.putString("title", "Map download");\r
- // if (last_timestamp == 0)\r
- // {\r
- // kbytes_per_second = "--";\r
- // }\r
- // else\r
- // {\r
- // //float temp = (((already_read - last_bytes) / 1024f) / ((System\r
- // // .currentTimeMillis() - last_timestamp) / 1000f));\r
- // //kbytes_per_second = formatter.format(temp);\r
- // }\r
- //last_timestamp = System.currentTimeMillis();\r
- //last_bytes = already_read;\r
per_second_overall = (float) already_read\r
/ (float) ((System.currentTimeMillis() - start_timestamp) / 1000);\r
kbytes_per_second = formatter.format((per_second_overall / 1024f));\r
- // Log.d("NavitMapDownloader", "k " + kbytes_per_second);\r
bytes_remaining = map_values.est_size_bytes - already_read;\r
eta_seconds = (int) ((float) bytes_remaining / (float) per_second_overall);\r
if (eta_seconds > 60)\r
// try\r
// {\r
// // little pause here\r
- // Thread.sleep(50);\r
+ // Thread.sleep(20);\r
// }\r
// catch (InterruptedException e1)\r
// {\r
// }\r
}\r
- //fos.write(buffer, 0, len1);\r
buf.write(buffer, 0, len1);\r
}\r
buf.flush();\r
msg = handler.obtainMessage();\r
b = new Bundle();\r
msg.what = 1;\r
- b.putInt("max", map_values.est_size_bytes);\r
- b.putInt("cur", map_values.est_size_bytes);\r
+ b.putInt("max", (int) (map_values.est_size_bytes / 1024));\r
+ b.putInt("cur", (int) (map_values.est_size_bytes / 1024));\r
b.putString("title", "Mapdownload");\r
b.putString("text", map_values.map_name + " ready");\r
msg.setData(b);\r