download manager: -cd5, +update
This commit is contained in:
parent
70bb46b156
commit
50f321f242
3 changed files with 73 additions and 304 deletions
|
@ -6,7 +6,7 @@ public class BInstallerSizes {
|
||||||
public static int getRd5Size( int idx )
|
public static int getRd5Size( int idx )
|
||||||
{
|
{
|
||||||
int i = rd5_sizes[idx];
|
int i = rd5_sizes[idx];
|
||||||
return (3*i)/4;
|
return i/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] rd5_sizes = {
|
private static int[] rd5_sizes = {
|
||||||
|
@ -228,230 +228,4 @@ public class BInstallerSizes {
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static int getCd5Size( int idx )
|
|
||||||
{
|
|
||||||
int i = cd5_sizes[idx];
|
|
||||||
return (3*i)/4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int[] cd5_sizes = {
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,70091,0,0,
|
|
||||||
0,0,0,0,25842,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,26278,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,200,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,26259,0,0,0,
|
|
||||||
30082,0,0,0,0,0,0,0,0,113801,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
200,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
51488,51488,25831,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,26228,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,200,200,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
25996,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,200,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,855984,848057,106076,
|
|
||||||
264966,0,0,0,26443,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,200,0,200,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,51664,1229395,1523538,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,200,0,0,200,0,
|
|
||||||
0,0,28554,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,1388142,819889,0,
|
|
||||||
76581,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,3167520,1396119,447357,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,152900,3043319,0,0,0,419020,4499648,2640604,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,7014974,2204051,3692565,
|
|
||||||
3538224,0,0,0,0,0,0,0,0,27506,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,200,0,0,0,0,0,0,0,195022,
|
|
||||||
0,0,0,2004936,10752726,15334312,466879,0,0,0,4257348,5052333,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,200,27702,10721885,4463058,11695286,
|
|
||||||
15715896,3837469,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,6236471,3255699,5702830,952087,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,94437,8698025,
|
|
||||||
808755,272655,597627,6623172,1406671,3572554,12157393,29118,0,0,107840,0,
|
|
||||||
29747,0,0,0,0,0,0,26420,0,25989,0,0,
|
|
||||||
0,0,44771,0,0,0,0,200,0,1509658,3913714,2706437,
|
|
||||||
8090199,14507302,7510503,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,1626401,2068012,16198756,8087930,0,102502,1100743,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,424290,814453,
|
|
||||||
614422,389030,579953,688421,1013629,1199974,12519388,0,0,68520,0,0,
|
|
||||||
118066,26106,0,0,101189,57623,58979,0,0,32261,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,813781,3727511,2143812,
|
|
||||||
1998634,12100594,35961675,16189825,0,0,200,0,0,0,0,0,
|
|
||||||
0,0,348291,1681103,926801,3365528,2353136,326104,1117879,2324365,0,3019791,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,276481,906721,
|
|
||||||
353887,306906,804579,863430,862414,2006354,1088708,0,182926,1180048,0,0,
|
|
||||||
155000,120971,68131,200,105943,174661,316332,54494,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,35913,3315952,8289410,3555958,
|
|
||||||
2074926,2324324,9479436,8187703,1012172,0,0,0,0,0,93444,0,
|
|
||||||
0,0,840718,1131979,877423,2436119,2692661,868852,295741,3016753,96850,32310,
|
|
||||||
58487,0,0,0,0,0,0,0,0,0,0,26154,
|
|
||||||
435246,699655,621291,635420,732518,1847696,0,0,0,273794,0,942558,
|
|
||||||
67839,478467,36473,0,0,0,86228,0,25931,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,8004515,3921220,1317795,1218386,
|
|
||||||
1424326,922444,2163188,3072017,4139586,0,0,0,0,0,0,0,
|
|
||||||
0,0,899109,1225760,748944,2114813,1768988,1316740,501928,776440,139099,200,
|
|
||||||
0,0,0,0,0,0,0,32223,0,29888,0,200,
|
|
||||||
838439,63419,1018352,259837,491713,98911,66814,200,27387,93570,0,29424,
|
|
||||||
0,0,0,0,0,0,0,88661,102246,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,521425,4247472,537493,454640,923857,
|
|
||||||
630078,705171,1743305,2280163,7235320,2249922,0,0,0,41768,0,0,
|
|
||||||
0,0,2019015,975576,863693,870974,1610767,1873416,0,26191,55043,0,
|
|
||||||
0,0,40884,0,0,0,0,0,106286,7871150,7830021,5687009,
|
|
||||||
2768480,922562,273373,79445,564301,808481,176474,344735,175686,0,0,85953,
|
|
||||||
0,27352,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,119988,41603,2771778,10293826,302527,299876,1004541,
|
|
||||||
1162977,688180,1932725,1866052,1838910,31605,0,0,0,0,0,0,
|
|
||||||
0,147657,786084,2001467,627925,3818165,2933263,3841484,396474,0,0,129025,
|
|
||||||
0,0,59434,0,0,0,0,232354,2167631,963215,698925,3242509,
|
|
||||||
1186175,767466,596232,571662,606461,59816,200077,0,0,59991,29471,111871,
|
|
||||||
0,0,0,27289,87346,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,69191,6468546,5653736,263447,839590,
|
|
||||||
301743,687038,200,0,0,0,0,0,0,0,163516,173876,
|
|
||||||
0,1563689,2262598,1310634,914341,909499,4810677,1810798,1501200,1229133,0,0,
|
|
||||||
0,0,335056,0,0,0,0,2578402,11278635,410221,1710437,490548,
|
|
||||||
770370,774470,26336,0,0,0,0,0,0,0,164032,0,
|
|
||||||
0,0,0,200,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,248339,4081232,5253733,11036844,1312104,1709282,
|
|
||||||
1150704,269175,0,0,0,0,0,0,0,2244447,2084894,4530390,
|
|
||||||
4964318,3776624,2390256,1723217,1020670,1096413,1317512,4702596,1452761,992111,67022,0,
|
|
||||||
0,0,276651,4873787,4415326,0,132663,2494488,4327776,274020,53603,1292989,
|
|
||||||
4289781,5219796,133476,37244,26038,25849,36012,54314,63914,60106,91862,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,4391852,7514388,1739114,773938,3952452,4576179,4920746,
|
|
||||||
472582,0,0,0,0,0,0,208169,3866534,2111654,3084994,3488690,
|
|
||||||
1984559,2444808,1560538,1206873,855351,1044130,1305977,2310140,1859015,843422,401033,0,
|
|
||||||
0,0,1502765,25094822,2146339,77136,382183,2341866,10960229,7286828,25887,390462,
|
|
||||||
18572412,516634,0,200,507456,81475,0,0,26721,27446,0,0,
|
|
||||||
0,0,26692,0,776160,80548,0,0,0,0,0,0,
|
|
||||||
0,27342,34108,3063101,18738086,4448347,3205886,238381,2359029,8172826,13978928,2910143,
|
|
||||||
0,0,0,0,0,0,136325,373179,988399,671901,350687,997600,
|
|
||||||
821522,664832,97923,406062,308207,79802,3962440,897536,2800063,725432,885202,300927,
|
|
||||||
0,0,9026494,7942446,2278768,113814,505827,8486099,12888221,3086203,338733,278972,
|
|
||||||
7034414,0,0,0,0,286089,0,0,0,200,0,0,
|
|
||||||
0,0,0,25891,2710524,0,0,0,0,0,0,0,
|
|
||||||
0,373331,2987687,12159158,2509066,163892,4868766,3854312,4263837,741931,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,356263,383830,200,52164,
|
|
||||||
378086,385938,332530,286545,146588,162413,737343,4366047,1782067,4182775,2880662,5034347,
|
|
||||||
0,2078810,7240240,3909505,2511938,6129414,3445600,4370475,4212182,4202772,9468000,2193123,
|
|
||||||
12224221,499424,200,0,33754,0,28864,0,0,0,0,0,
|
|
||||||
54172,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
142725,1598472,5011219,10787297,39396269,4601941,577865,46581722,822807,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,4943168,2133614,1445526,274336,
|
|
||||||
415981,484628,814655,694313,411882,442449,4911819,1482339,1789278,3544665,7443296,6221660,
|
|
||||||
1687623,1978176,7092380,14861546,7994746,5634309,2748956,2226853,3799379,3064716,2743153,4096999,
|
|
||||||
4405343,4928938,132846,0,76995,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,1380543,
|
|
||||||
40285622,24548529,16905694,30669785,67054800,54508675,73773672,83649044,12059098,0,0,225966,
|
|
||||||
0,0,0,0,0,0,0,0,911085,51752,10700266,4110896,
|
|
||||||
1535660,2274696,4322063,542093,1420700,988254,11841263,20710438,3542375,3572656,3591723,2211995,
|
|
||||||
684089,1590834,8635545,8222499,533943,417909,710405,1145559,2581718,3357078,4362796,5055766,
|
|
||||||
5640731,9091896,113602886,48138375,200,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,54328213,
|
|
||||||
18717780,10278901,29259961,25815529,43175293,68090093,78467043,126822478,140844487,4425761,0,0,
|
|
||||||
0,0,0,0,0,72067,1133782,0,0,0,29226749,38506462,
|
|
||||||
16549533,10978257,16225249,12330151,29074534,19134830,22668613,20521680,9944947,5101342,5682353,4142169,
|
|
||||||
1557603,3194307,1390635,1279292,543056,221959,590255,920975,2216698,2066773,3415359,6746539,
|
|
||||||
2371133,22623922,13569892,152798833,58503357,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,46743146,
|
|
||||||
20769427,27601542,18668147,18603093,32942577,45786577,67464728,69607399,82209702,122340164,5753818,3320647,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,55255756,52621687,
|
|
||||||
73473866,39224112,61689726,34123848,34880176,29367743,11925278,9153752,24106662,7587052,834865,610300,
|
|
||||||
891571,5783714,6572540,3295291,1131879,1457960,685006,695737,704138,1164592,1493345,2804994,
|
|
||||||
2654017,3421893,2759904,840614,44252344,770505,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,605826,47241781,
|
|
||||||
25257858,15066323,7711203,21500519,19806053,19268603,10634827,6321265,13348789,19194348,10727933,7674160,
|
|
||||||
1631680,1800345,0,0,0,0,0,0,0,0,152790,62057382,
|
|
||||||
108599841,159996480,129090151,67700331,27514762,21763749,12188130,16193784,8123207,1622818,804643,534911,
|
|
||||||
823122,706375,1147880,707446,1294609,1030328,922599,1029357,1235660,1866848,870626,912240,
|
|
||||||
1162521,1467231,1794292,1422054,2122279,72611,28369,0,0,0,0,0,
|
|
||||||
45444,32085,75262,54183,0,0,0,0,0,449759,1966233,4123088,
|
|
||||||
5050260,13531641,5542015,4057486,1970065,889001,344244,206202,455242,328091,707612,524098,
|
|
||||||
617620,0,200,0,0,0,0,0,0,586889,34431477,119682249,
|
|
||||||
70473640,138403084,81649512,40422397,27928097,14047125,14343210,16526001,5350325,6663457,4782345,5760419,
|
|
||||||
2831298,1354263,3114737,1622580,4770732,3625730,2111855,472547,2698922,1592613,1428266,1023346,
|
|
||||||
1042886,1438912,560094,1417461,909854,0,0,724159,200,200,57707,26667,
|
|
||||||
0,34918,30967,347076,461576,566051,51521,52543,336102,964470,1016187,1634436,
|
|
||||||
2451204,1214338,374531,345204,279946,150433,28084,0,60317,0,0,0,
|
|
||||||
30114,0,0,26048,0,0,0,0,0,0,3295737,20647296,
|
|
||||||
81000,19592714,42049809,15699583,13648777,13620617,11091935,23696672,9896380,7114238,5590637,7290515,
|
|
||||||
8492126,3382493,2631488,1418490,3059735,2415177,3194264,1572255,1006959,732137,610159,314443,
|
|
||||||
601682,591149,234701,135897,76103,58883,330582,226182,204420,53546,0,0,
|
|
||||||
0,94444,214083,522118,434078,621542,2398977,605839,800353,354953,224060,225268,
|
|
||||||
299375,344125,200,0,62942,119657,0,32185,34798,81270,75039,0,
|
|
||||||
0,158595,181079,29320,0,0,0,2118879,652594,149718,427247,413198,
|
|
||||||
198565,6502947,9118685,8953724,20255359,18652807,6001482,1909014,3082130,1971424,1698686,1228900,
|
|
||||||
1222503,1800774,3198056,2334523,421355,335691,189425,78417,174729,187642,458306,596013,
|
|
||||||
472277,817786,606170,332839,301805,488547,373861,143842,52682,184891,144327,78508,
|
|
||||||
66146,88283,194381,356642,171747,379228,476055,112432,238033,175943,58163,0,
|
|
||||||
39939,52551,82747,32021,57797,34035,67664,64808,0,0,33630,56862,
|
|
||||||
0,356678,0,0,55035,0,0,603468,652320,231882,0,0,
|
|
||||||
0,0,2281278,2647710,3181650,2892458,2581204,393964,354906,115932,469432,771477,
|
|
||||||
510925,701337,415875,668256,193794,374160,0,0,200,0,250653,87512,
|
|
||||||
26292,200,213998,125456,117227,161033,245100,118865,194595,310876,339978,197377,
|
|
||||||
200,0,0,28321,172385,59585,161067,30373,0,0,0,0,
|
|
||||||
0,0,0,0,26430,33626,59040,55334,30863,0,32152,0,
|
|
||||||
113221,38808,0,0,0,0,0,29154,0,0,200,0,
|
|
||||||
0,0,0,87063,309737,499023,78183,0,0,0,69523,0,
|
|
||||||
0,84890,78693,200,25959,0,0,0,27738,0,59923,200,
|
|
||||||
0,35248,0,51843,77511,200,0,0,0,25880,200,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,29684,0,200,61161,0,
|
|
||||||
0,0,0,0,0,0,200,0,0,0,0,0,
|
|
||||||
0,0,59425,77705,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,25863,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,26081,
|
|
||||||
0,0,0,0,0,0,0,0,26010,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,200,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,200,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,8 @@ import btools.router.RoutingHelper;
|
||||||
public class BInstallerView extends View
|
public class BInstallerView extends View
|
||||||
{
|
{
|
||||||
private static final int MASK_SELECTED_RD5 = 1;
|
private static final int MASK_SELECTED_RD5 = 1;
|
||||||
private static final int MASK_SELECTED_CD5 = 2;
|
private static final int MASK_INSTALLED_RD5 = 4;
|
||||||
private static final int MASK_INSTALLED_RD5 = 4;
|
private static final int MASK_CURRENT_RD5 = 8;
|
||||||
private static final int MASK_INSTALLED_CD5 = 8;
|
|
||||||
|
|
||||||
private static final int[] maskTransitions = new int[]
|
|
||||||
{ 3, 2, 0, 1,
|
|
||||||
6, 6, 4, 4,
|
|
||||||
9, 8, 9, 8,
|
|
||||||
12, 12, 12, 12 };
|
|
||||||
|
|
||||||
private int imgwOrig;
|
private int imgwOrig;
|
||||||
private int imghOrig;
|
private int imghOrig;
|
||||||
|
@ -60,8 +53,6 @@ public class BInstallerView extends View
|
||||||
|
|
||||||
private boolean tilesVisible = false;
|
private boolean tilesVisible = false;
|
||||||
|
|
||||||
private long lastDownTime = 0;
|
|
||||||
|
|
||||||
private long availableSize;
|
private long availableSize;
|
||||||
private String baseDir;
|
private String baseDir;
|
||||||
|
|
||||||
|
@ -74,7 +65,6 @@ public class BInstallerView extends View
|
||||||
|
|
||||||
private long totalSize = 0;
|
private long totalSize = 0;
|
||||||
private long rd5Tiles = 0;
|
private long rd5Tiles = 0;
|
||||||
private long cd5Tiles = 0;
|
|
||||||
|
|
||||||
protected String baseNameForTile( int tileIndex )
|
protected String baseNameForTile( int tileIndex )
|
||||||
{
|
{
|
||||||
|
@ -122,7 +112,6 @@ public class BInstallerView extends View
|
||||||
}
|
}
|
||||||
|
|
||||||
int tidx_min = -1;
|
int tidx_min = -1;
|
||||||
boolean isCd5_min = false;
|
|
||||||
int min_size = Integer.MAX_VALUE;
|
int min_size = Integer.MAX_VALUE;
|
||||||
|
|
||||||
// prepare download list
|
// prepare download list
|
||||||
|
@ -131,35 +120,31 @@ public class BInstallerView extends View
|
||||||
for( int iy=0; iy<36; iy++ )
|
for( int iy=0; iy<36; iy++ )
|
||||||
{
|
{
|
||||||
int tidx = gridPos2Tileindex( ix, iy );
|
int tidx = gridPos2Tileindex( ix, iy );
|
||||||
for( int mask = 1; mask <= 2; mask *= 2 )
|
if ( ( tileStatus[tidx] & MASK_SELECTED_RD5 ) != 0 )
|
||||||
{
|
|
||||||
int s = tileStatus[tidx];
|
|
||||||
boolean isCd5 = (mask == 2);
|
|
||||||
if ( ( s & mask ) != 0 && ( s & (mask*4)) == 0 )
|
|
||||||
{
|
{
|
||||||
int tilesize = isCd5 ? BInstallerSizes.getCd5Size(tidx) : BInstallerSizes.getRd5Size(tidx);
|
int tilesize = BInstallerSizes.getRd5Size(tidx);
|
||||||
if ( tilesize > 0 && tilesize < min_size )
|
if ( tilesize > 0 && tilesize < min_size )
|
||||||
{
|
{
|
||||||
tidx_min = tidx;
|
tidx_min = tidx;
|
||||||
isCd5_min = isCd5;
|
|
||||||
min_size = tilesize;
|
min_size = tilesize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( tidx_min != -1 )
|
if ( tidx_min != -1 )
|
||||||
{
|
{
|
||||||
startDownload( tidx_min, isCd5_min );
|
tileStatus[tidx_min] = 0;
|
||||||
|
startDownload( tidx_min );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startDownload( int tileIndex, boolean isCd5 )
|
private void startDownload( int tileIndex )
|
||||||
{
|
{
|
||||||
|
|
||||||
String namebase = baseNameForTile( tileIndex );
|
String namebase = baseNameForTile( tileIndex );
|
||||||
String baseurl = "http://brouter.de/brouter/segments4/";
|
String baseurl = "http://brouter.de/brouter/segments4/";
|
||||||
currentDownloadFile = namebase + (isCd5 ? ".cd5" : ".rd5" );
|
currentDownloadFile = namebase + ".rd5";
|
||||||
String url = baseurl + (isCd5 ? "carsubset/" : "" ) + currentDownloadFile;
|
String url = baseurl + currentDownloadFile;
|
||||||
isDownloading = true;
|
isDownloading = true;
|
||||||
downloadCanceled = false;
|
downloadCanceled = false;
|
||||||
currentDownloadSize = 0;
|
currentDownloadSize = 0;
|
||||||
|
@ -208,34 +193,35 @@ public class BInstallerView extends View
|
||||||
|
|
||||||
private void scanExistingFiles()
|
private void scanExistingFiles()
|
||||||
{
|
{
|
||||||
clearTileSelection( MASK_INSTALLED_CD5 | MASK_INSTALLED_RD5 );
|
clearTileSelection( MASK_INSTALLED_RD5 | MASK_CURRENT_RD5 );
|
||||||
|
|
||||||
scanExistingFiles( new File( baseDir + "/brouter/segments3" ), ".rd5", MASK_INSTALLED_RD5 );
|
scanExistingFiles( new File( baseDir + "/brouter/segments3" ) );
|
||||||
scanExistingFiles( new File( baseDir + "/brouter/segments3/carsubset" ), ".cd5", MASK_INSTALLED_CD5 );
|
|
||||||
|
|
||||||
File secondary = RoutingHelper.getSecondarySegmentDir( baseDir + "/brouter/segments3" );
|
File secondary = RoutingHelper.getSecondarySegmentDir( baseDir + "/brouter/segments3" );
|
||||||
if ( secondary != null )
|
if ( secondary != null )
|
||||||
{
|
{
|
||||||
scanExistingFiles( secondary, ".rd5", MASK_INSTALLED_RD5 );
|
scanExistingFiles( secondary );
|
||||||
scanExistingFiles( new File( secondary, "carsubset" ), ".cd5", MASK_INSTALLED_CD5 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatFs stat = new StatFs(baseDir);
|
StatFs stat = new StatFs(baseDir);
|
||||||
availableSize = (long)stat.getAvailableBlocks()*stat.getBlockSize();
|
availableSize = (long)stat.getAvailableBlocks()*stat.getBlockSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scanExistingFiles( File dir, String suffix, int maskBit )
|
private void scanExistingFiles( File dir )
|
||||||
{
|
{
|
||||||
String[] fileNames = dir.list();
|
String[] fileNames = dir.list();
|
||||||
if ( fileNames == null ) return;
|
if ( fileNames == null ) return;
|
||||||
|
String suffix = ".rd5";
|
||||||
for( String fileName : fileNames )
|
for( String fileName : fileNames )
|
||||||
{
|
{
|
||||||
if ( fileName.endsWith( suffix ) )
|
if ( fileName.endsWith( suffix ) )
|
||||||
{
|
{
|
||||||
String basename = fileName.substring( 0, fileName.length() - suffix.length() );
|
String basename = fileName.substring( 0, fileName.length() - suffix.length() );
|
||||||
int tidx = tileForBaseName( basename );
|
int tidx = tileForBaseName( basename );
|
||||||
tileStatus[tidx] |= maskBit;
|
tileStatus[tidx] |= MASK_INSTALLED_RD5;
|
||||||
tileStatus[tidx] ^= tileStatus[tidx] & (maskBit >> 2);
|
|
||||||
|
long age = System.currentTimeMillis() - new File( dir, fileName ).lastModified();
|
||||||
|
if ( age < 86400000 ) tileStatus[tidx] |= MASK_CURRENT_RD5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,15 +326,22 @@ public class BInstallerView extends View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rd5Tiles = 0;
|
rd5Tiles = 0;
|
||||||
cd5Tiles = 0;
|
|
||||||
totalSize = 0;
|
totalSize = 0;
|
||||||
|
int mask2 = MASK_SELECTED_RD5 | MASK_INSTALLED_RD5;
|
||||||
|
int mask3 = mask2 | MASK_CURRENT_RD5;
|
||||||
Paint pnt_2 = new Paint();
|
Paint pnt_2 = new Paint();
|
||||||
pnt_2.setColor(Color.GRAY);
|
pnt_2.setColor(Color.GRAY);
|
||||||
pnt_2.setStrokeWidth(1);
|
pnt_2.setStrokeWidth(1);
|
||||||
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_INSTALLED_RD5, MASK_INSTALLED_CD5, false, drawGrid );
|
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_INSTALLED_RD5, mask3, false, drawGrid );
|
||||||
|
pnt_2.setColor(Color.BLUE);
|
||||||
|
pnt_2.setStrokeWidth(1);
|
||||||
|
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_INSTALLED_RD5 | MASK_CURRENT_RD5, mask3, false, drawGrid );
|
||||||
pnt_2.setColor(Color.GREEN);
|
pnt_2.setColor(Color.GREEN);
|
||||||
pnt_2.setStrokeWidth(2);
|
pnt_2.setStrokeWidth(2);
|
||||||
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_SELECTED_RD5, MASK_SELECTED_CD5, true, drawGrid );
|
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_SELECTED_RD5, mask2, true, drawGrid );
|
||||||
|
pnt_2.setColor(Color.YELLOW);
|
||||||
|
pnt_2.setStrokeWidth(2);
|
||||||
|
drawSelectedTiles( canvas, pnt_2, fw, fh, MASK_SELECTED_RD5 | MASK_INSTALLED_RD5, mask2, true, drawGrid );
|
||||||
|
|
||||||
canvas.setMatrix( matText );
|
canvas.setMatrix( matText );
|
||||||
|
|
||||||
|
@ -375,13 +368,13 @@ public class BInstallerView extends View
|
||||||
|
|
||||||
String totmb = ((totalSize + mb-1)/mb) + " MB";
|
String totmb = ((totalSize + mb-1)/mb) + " MB";
|
||||||
String freemb = ((availableSize + mb-1)/mb) + " MB";
|
String freemb = ((availableSize + mb-1)/mb) + " MB";
|
||||||
canvas.drawText( "Selected: full=" + rd5Tiles + " carsubset=" + cd5Tiles, 10, 25, paint );
|
canvas.drawText( "Selected segments=" + rd5Tiles, 10, 25, paint );
|
||||||
canvas.drawText( "Size=" + totmb + " Free=" + freemb , 10, 45, paint );
|
canvas.drawText( "Size=" + totmb + " Free=" + freemb , 10, 45, paint );
|
||||||
|
|
||||||
|
|
||||||
String btnText = null;
|
String btnText = null;
|
||||||
if ( isDownloading ) btnText = "Cancel Download";
|
if ( isDownloading ) btnText = "Cancel Download";
|
||||||
else if ( rd5Tiles + cd5Tiles > 0 ) btnText = "Start Download";
|
else if ( rd5Tiles > 0 ) btnText = "Start Download";
|
||||||
|
|
||||||
if ( btnText != null )
|
if ( btnText != null )
|
||||||
{
|
{
|
||||||
|
@ -400,38 +393,38 @@ public class BInstallerView extends View
|
||||||
|
|
||||||
float tx, ty;
|
float tx, ty;
|
||||||
|
|
||||||
private void drawSelectedTiles( Canvas canvas, Paint pnt, float fw, float fh, int maskRd5, int maskCd5, boolean doCount, boolean doDraw )
|
private void drawSelectedTiles( Canvas canvas, Paint pnt, float fw, float fh, int status, int mask, boolean doCount, boolean doDraw )
|
||||||
{
|
{
|
||||||
for( int ix=0; ix<72; ix++ )
|
for ( int ix = 0; ix < 72; ix++ )
|
||||||
for( int iy=0; iy<36; iy++ )
|
for ( int iy = 0; iy < 36; iy++ )
|
||||||
|
{
|
||||||
|
int tidx = gridPos2Tileindex( ix, iy );
|
||||||
|
if ( ( tileStatus[tidx] & mask ) == status )
|
||||||
|
{
|
||||||
|
int tilesize = BInstallerSizes.getRd5Size( tidx );
|
||||||
|
if ( tilesize > 0 )
|
||||||
{
|
{
|
||||||
int tidx = gridPos2Tileindex( ix, iy );
|
if ( doCount )
|
||||||
boolean isRd5 = (tileStatus[tidx] & maskRd5) != 0;
|
{
|
||||||
boolean isCd5 = (tileStatus[tidx] & maskCd5) != 0;
|
rd5Tiles++;
|
||||||
if ( isRd5 || isCd5 )
|
totalSize += BInstallerSizes.getRd5Size( tidx );
|
||||||
{
|
}
|
||||||
int tilesize = BInstallerSizes.getRd5Size(tidx);
|
if ( !doDraw )
|
||||||
if ( tilesize > 0 )
|
continue;
|
||||||
{
|
// draw cross
|
||||||
if ( doCount )
|
canvas.drawLine( fw * ix, fh * iy, fw * ( ix + 1 ), fh * ( iy + 1 ), pnt );
|
||||||
{
|
canvas.drawLine( fw * ix, fh * ( iy + 1 ), fw * ( ix + 1 ), fh * iy, pnt );
|
||||||
if ( isRd5) { rd5Tiles++; totalSize += BInstallerSizes.getRd5Size(tidx); };
|
|
||||||
if ( isCd5) { cd5Tiles++; totalSize += BInstallerSizes.getCd5Size(tidx); };
|
|
||||||
}
|
|
||||||
if ( !doDraw ) continue;
|
|
||||||
if ( isRd5 ) canvas.drawLine( fw*ix, fh*iy, fw*(ix+1), fh*(iy+1), pnt);
|
|
||||||
if ( isCd5 ) canvas.drawLine( fw*ix, fh*(iy+1), fw*(ix+1), fh*iy, pnt);
|
|
||||||
|
|
||||||
canvas.drawLine( fw*ix, fh*iy, fw*(ix+1), fh*iy, pnt);
|
// draw frame
|
||||||
canvas.drawLine( fw*ix, fh*(iy+1), fw*(ix+1), fh*(iy+1), pnt);
|
canvas.drawLine( fw * ix, fh * iy, fw * ( ix + 1 ), fh * iy, pnt );
|
||||||
canvas.drawLine( fw*ix, fh*iy, fw*ix, fh*(iy+1), pnt);
|
canvas.drawLine( fw * ix, fh * ( iy + 1 ), fw * ( ix + 1 ), fh * ( iy + 1 ), pnt );
|
||||||
canvas.drawLine( fw*(ix+1), fh*iy, fw*(ix+1), fh*(iy+1), pnt);
|
canvas.drawLine( fw * ix, fh * iy, fw * ix, fh * ( iy + 1 ), pnt );
|
||||||
}
|
canvas.drawLine( fw * ( ix + 1 ), fh * iy, fw * ( ix + 1 ), fh * ( iy + 1 ), pnt );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
|
||||||
|
@ -495,7 +488,7 @@ float tx, ty;
|
||||||
boolean tilesv = currentScale() >= 3.f;
|
boolean tilesv = currentScale() >= 3.f;
|
||||||
if ( tilesVisible && !tilesv )
|
if ( tilesVisible && !tilesv )
|
||||||
{
|
{
|
||||||
clearTileSelection( MASK_SELECTED_CD5 | MASK_SELECTED_RD5 );
|
clearTileSelection( MASK_SELECTED_RD5 );
|
||||||
}
|
}
|
||||||
tilesVisible = tilesv;
|
tilesVisible = tilesv;
|
||||||
}
|
}
|
||||||
|
@ -508,9 +501,9 @@ float tx, ty;
|
||||||
}
|
}
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
|
|
||||||
lastDownTime = event.getEventTime() - event.getDownTime();
|
long downTime = event.getEventTime() - event.getDownTime();
|
||||||
|
|
||||||
if ( lastDownTime < 5 || lastDownTime > 500 )
|
if ( downTime < 5 || downTime > 500 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +514,7 @@ float tx, ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// download button?
|
// download button?
|
||||||
if ( rd5Tiles + cd5Tiles > 0 && event.getX() > imgwOrig - btnw*scaleOrig && event.getY() > imghOrig-btnh*scaleOrig )
|
if ( rd5Tiles > 0 && event.getX() > imgwOrig - btnw*scaleOrig && event.getY() > imghOrig-btnh*scaleOrig )
|
||||||
{
|
{
|
||||||
toggleDownload();
|
toggleDownload();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -541,7 +534,10 @@ float tx, ty;
|
||||||
int tidx = tileIndex( touchpoint[0], touchpoint[1] );
|
int tidx = tileIndex( touchpoint[0], touchpoint[1] );
|
||||||
if ( tidx != -1 )
|
if ( tidx != -1 )
|
||||||
{
|
{
|
||||||
tileStatus[tidx] = maskTransitions[tileStatus[tidx]];
|
if ( ( tileStatus[tidx] & MASK_CURRENT_RD5 ) == 0 )
|
||||||
|
{
|
||||||
|
tileStatus[tidx] ^= MASK_SELECTED_RD5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = touchpoint[0];
|
tx = touchpoint[0];
|
||||||
|
@ -609,7 +605,6 @@ float tx, ty;
|
||||||
int slidx = surl.lastIndexOf( "segments4/" );
|
int slidx = surl.lastIndexOf( "segments4/" );
|
||||||
fname = baseDir + "/brouter/segments3/" + surl.substring( slidx+10 );
|
fname = baseDir + "/brouter/segments3/" + surl.substring( slidx+10 );
|
||||||
tmp_file = new File( fname + "_tmp" );
|
tmp_file = new File( fname + "_tmp" );
|
||||||
if ( new File( fname ).exists() ) return "internal error: file exists: " + fname;
|
|
||||||
output = new FileOutputStream( tmp_file );
|
output = new FileOutputStream( tmp_file );
|
||||||
|
|
||||||
byte data[] = new byte[4096];
|
byte data[] = new byte[4096];
|
||||||
|
@ -626,8 +621,8 @@ float tx, ty;
|
||||||
publishProgress((int) (total * 100 / fileLength));
|
publishProgress((int) (total * 100 / fileLength));
|
||||||
output.write(data, 0, count);
|
output.write(data, 0, count);
|
||||||
|
|
||||||
// enforce < 200kB/s
|
// enforce < 2 Mbit/s
|
||||||
long dt = t0 + total/200 - System.currentTimeMillis();
|
long dt = t0 + total/262 - System.currentTimeMillis();
|
||||||
if ( dt > 0 )
|
if ( dt > 0 )
|
||||||
{
|
{
|
||||||
try { Thread.sleep( dt ); } catch( InterruptedException ie ) {}
|
try { Thread.sleep( dt ); } catch( InterruptedException ie ) {}
|
||||||
|
|
|
@ -92,9 +92,9 @@ public class BRouterActivity extends Activity implements OnInitListener {
|
||||||
builder.setTitle( "BRouter Download Manager" )
|
builder.setTitle( "BRouter Download Manager" )
|
||||||
.setMessage( "*** Attention: ***\n\n"
|
.setMessage( "*** Attention: ***\n\n"
|
||||||
+ "The Download Manager is used to download routing-data "
|
+ "The Download Manager is used to download routing-data "
|
||||||
+ "files which can be huge. Do not start the Download Manager "
|
+ "files which can be up to 100MB each. Do not start the Download Manager "
|
||||||
+ "on a cellular data connection without a flat-rate! "
|
+ "on a cellular data connection without a data plan! "
|
||||||
+ "Download speed is restricted to 200 kB/s." )
|
+ "Download speed is restricted to 2 MBit/s." )
|
||||||
.setPositiveButton( "I know", new DialogInterface.OnClickListener() {
|
.setPositiveButton( "I know", new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
Intent intent = new Intent(BRouterActivity.this, BInstallerActivity.class);
|
Intent intent = new Intent(BRouterActivity.this, BInstallerActivity.class);
|
||||||
|
|
Loading…
Reference in a new issue