Commit 0f418747 authored by fallenstardust's avatar fallenstardust Committed by GitHub

Merge pull request #121 from zhuhongbozhuhongbo/master

修改先行卡服务器网址
parents f3d4f227 b98e223e
...@@ -163,10 +163,11 @@ public interface Constants { ...@@ -163,10 +163,11 @@ public interface Constants {
String ID2 = "[download_link]"; String ID2 = "[download_link]";
String ID3 = "#pre_release_code"; String ID3 = "#pre_release_code";
String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile"; String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile";
String URL_YGO233_ADVANCE = "https://ygo233.com/pre#pre_release_cards"; String URL_YGO233_ADVANCE = "";//"https://ygo233.com/pre#pre_release_cards";//关闭233先行卡服务器,但不要删除该字段,许多未调用的遗留代码使用该contant
String URL_YGO233_DATAVER = "https://ygo233.com/pre/dataver"; String URL_YGO233_DATAVER = "https://cdn02.moecube.com:444/ygopro-super-pre/data/version.txt";
String URL_YGO233_FILE = "https://ygo233.com/pre/download-ygomobile"; String URL_PRE_CARD = "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.json";
String URL_YGO233_FILE_ALT = "https://ygo233.com/pre/download-ygomobile/alt"; String URL_YGO233_FILE = "https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk";
String URL_YGO233_FILE_ALT = "https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk";
String URL_YGO233_BUG_REPORT = "https://ygo233.com/pre#faq"; String URL_YGO233_BUG_REPORT = "https://ygo233.com/pre#faq";
int PORT_YGO233 = 23333; int PORT_YGO233 = 23333;
String URL_YGO233_1 = "s1.ygo233.com"; String URL_YGO233_1 = "s1.ygo233.com";
...@@ -258,5 +259,5 @@ public interface Constants { ...@@ -258,5 +259,5 @@ public interface Constants {
23923758, 69133798, 64583600, 13302026, 57511992, 90583279, 76352503, 77672444, 75311421, 12527118, 27657173, 50699850, 96084564, 86605515, 15464375, 15198996, 78077209, 64475743, 9627468, 62967433, 98462037, 5182107, 67853262, 8085950, 31464658, 8910240, 76823930, 97534104, 36629635, 33099732, 3121655, 39520293, 89974735, 65892310, 99742859, 47132793, 93347961, 30342076, 35026117, 62411811, 8505920, 34904525, 61398234, 97783338, 34771947, 60176682, 96661780, 33055499, 23446369, 50834074, 86239173, 22723778, 59712426, 85106525, 12501230, 58996839, 84384943, 11489642, 47873397, 84262395, 10666000, 47051709, 73046708, 19544412, 46939151, 72323266, 19322865, 45716579, 71101678, 8690387, 44094981, 71089030, 7473735, 33872334, 70366448, 6351147, 33750856, 25577965, 15635751, 42620460, 88124568, 86893702, 49858495, 5916510, 3103067, 38105306, 85758066, 33331231, 9726840, 36114945, 62219643, 9603252, 35098357, 89839552, 77590412, 88617904, 42228966, 86469231, 47077697, 84900597, 1683982, 64104037, 99370594, 61103515, 35705817, 20994205, 57499304, 83888009, 19272658, 56677752, 82661461, 19050066, 55554175, 70551291, 6556909, 43940008, 79339613, 5833312, 32828466, 78217065, 5611760, 31006879, 68490573, 4599182, 30983281, 67378935, 93777634, 30761649, 66156348, 92644052, 39049051, 65433790, 92428405, 28827503, 64211118, 91706817, 27104921, 54878729, 91262474, 26988374, 11020863, 58415502, 76076738, 84813516, 11808215, 47292920, 84797028, 10186633, 46570372, 83575471, 19963185, 46358784, 72843899, 18847598, 45236142, 71620241, 39396763, 75780818, 8025950, 44413654, 70508653, 7903368, 33391067, 70786111, 6180710, 32175429, 79663524, 5068132, 32453837, 68441986, 4836680, 31230289, 67725394, 94113093, 30118701, 62503746, 99991455, 25396150, 62480168, 98875863, 25273572, 61668670, 97053215, 24151924, 50546029, 37930737, 23099524, 59494222, 85888377, 59094601, 85182315, 11587414, 47961342, 73355951, 844056, 36848764, 72233469, 5829717, 31817415, 77202120, 4606229, 30095833, 77189532, 91479482, 34456146, 63013339, 32549749, 31600513, 53754104, 3574681, 39973386, 61322713, 66367984, 54594017, 2752099, 35756798, 61245403, 97639441, 34034150, 60023855, 97417863, 23812568, 60306277, 96795312, 22790910, 26050548, 52445243, 39943352, 65938950, 1259814, 91434602, 38529357, 64927055, 90312154, 37706769, 63101468, 90290572, 26684111, 41406613, 77895328, 3289027, 30284022, 76672730, 3167439, 39552584, 65956182, 66431519, 2526224, 38910263, 65305978, 91703676, 38798785, 64182380, 90681088, 19096726, 45484331, 82489470, 18973184, 44362883, 81767888, 17751597, 44146295, 70534340, 12877076, 58371671, 85766789, 11155484, 47149093, 84544192, 10938846, 49027020, 75416738, 12801833, 48805472, 75294187, 1688285, 48183890, 74577599, 98396890, 51779204, 98173209, 24662957, 50056656, 87451661, 62991792, 25784595, 13179234, 2347656, 48745395, 75730490, 1225009, 37629703, 74018812, 2511, 33407125, 69895264, 5380979, 32785578, 68779682, 5168381, 92107604, 29595202, 31562086, 68957034, 94445733, 66712905, 30430448, 67835547, 20618850, 93229151, 55990317, 92385016, 28373620, 49131917, 15130912, 41525660, 88919365, 14418464, 41802073, 87897777, 13291886, 40680521, 76075139, 49568943, 75952542, 38339996, 65734501, 91222209, 37617348, 64612053, 90000652, 37495766, 63899465, 99984170, 26372118, 62777823, 99162522, 25550531, 52645235, 98049934, 24434049, 51822687, 83827392, 20212491, 56700100, 82105704, 29599813, 55584558, 82983267, 18377261, 54862960, 81260679, 17255673, 44649322, 80044027, 16433136, 43527730, 79912449, 16310544, 42705243, 78199891, 5852388, 31241087, 67745632, 94130731, 30128445, 67523044, 93918159, 29302858, 66401502, 92895501, 29280200, 55688914, 91073013, 28168628, 54562327, 91951471, 27345070, 53330789, 80738884, 26223582, 53618197, 89016236, 15001940, 52495649, 88890658, 15388353, 41773061, 87778106, 14166715, 40551410, 87955518, 23288411, 55272555, 81677154, 18165869, 54550967, 81945676, 17943271, 43338320, 80722024, 16227633, 43215738, 79600447, 15005145, 42493140, 78888899, 15982593, 41371602, 77765207, 4160316, 40155014, 77543769, 3048768, 30432463, 76821171, 2815176, 39210885, 5605529, 42193638, 78598237, 4582942, 31971040, 61496006, 98881700, 34876719, 61374414, 97769122, 23153227, 60158866, 96546575, 23931679, 69436288, 95824983, 22819092, 58203736, 95602345, 21057444, 57541158, 84546257, 20934852, 57329501, 83723605, 19712214, 38082437, 1876841, 64487132, 37260946, 63265554, 90659259, 36148308, 63542003, 99937011, 25926710, 62320425, 98715423, 25209168, 51208877, 97692972, 24087580, 50486289, 97870394, 23965033, 59353647, 86758746, 11962031, 57357130, 84755744, 10140443, 57134592, 83533296, 19027895, 46412900, 22411609, 59805313, 85250352, 11654067, 58143766, 84138874, 11522479, 47921178, 83315222, 10300821, 46804536, 83293635, 19688343, 48784854, 67127799, 20001443, 56495147, 93490856, 29884951, 55273560, 82777208, 28762303, 55151012, 81555617, 53212882, 18940725, 54334420, 80433039, 17827173, 80611581, 16605586, 42090294, 89594399, 15983048, 42377643, 78362751, 14761450, 41255165, 73640163, 44818, 46033517, 72427512, 9822220, 35311929, 72305034, 8700633, 34198387, 71583486, 34072799, 6855503, 60461804, 33250142, 69248256, 96633955, 32138660, 69522668, 95911373, 21915012, 68300121, 94798725, 21293424, 67288539, 93672138, 56465981, 93850690, 29948294, 55343303, 82738008, 28126717, 55521751, 81615450, 17000165, 54408264, 80893872, 17888577, 53286626, 89771220, 16165939, 42560034, 89558743, 15943341, 41348446, 78836195, 14821890, 41215808, 77610503, 4008212, 40493210, 16598965, 43986064, 79371769, 20295753, 56790702, 82184400, 25573115, 51578214, 88962829, 14357527, 50855622, 87240371, 13234975, 40633084, 93612434, 7987191, 20071842, 46123974, 31699677, 77683371, 3078380, 30576089, 66961194, 3355732, 39354437, 66749546, 92133240, 38628859, 65626958, 91011603, 28406301, 64804316, 90299015, 27383719, 53782828, 90176467, 26561172, 52566270, 99054885, 25449584, 52843699, 88232397, 24226942, 51611041, 87116749, 14504454, 50599453, 86993168, 13382806, 49776811, 86271510, 12266229, 48654323, 85059922, 11443677, 48832775, 74936480, 11321089, 47710198, 73104892, 109401, 46593546, 73082255, 9486959, 35871958, 72860663, 8264361, 35659410, 71143015, 7142724, 34536828, 60921537, 7320132, 33814281, 69809989, 96203584, 32692693, 69087397, 95471006, 21570001, 64964750, 90359458, 27753563, 53742162, 99137266, 26631975, 52020510, 99414629, 25419323, 52807032, 28292031, 64797746, 91781484, 27170599, 54564198, 90969892, 26357901, 53442500, 84462118, 10851853, 57946551, 83340560, 19739265, 82128978, 19516687, 45001322, 71406430, 18890039, 44889144, 16312943, 21949879, 58938528, 84332527, 21727231, 57111330, 83610035, 10604644, 56099748, 83488497, 19882096, 46877100, 82361809, 18760514, 45154513, 71549257, 18548966, 44932065, 70427670, 17825378, 43210483, 70204022, 6609736, 42198835, 79582540, 5577149, 52253888, 32975247, 78360952, 4754691, 31259606, 67248304, 4632019, 30037118, 66425726, 3410461, 39915560, 66309175, 92798873, 38192988, 65187687, 91575236, 24070330, 60465049, 97453744, 23848752, 59242457, 96637156, 22125101, 59120809, 95515518, 21903613, 58308221, 84792926, 21887075, 57285770, 83670388, 10065487, 56063182, 83558891, 19942835, 45337544, 82735249, 18720257, 45115956, 81613061, 17008760, 44092304, 70491413, 17885118, 43270827, 79775821, 6763530, 42158279, 79552283, 5941982, 32335697, 78420796, 4825390, 31213049, 7608148, 54656181, 80040886, 26435595, 53923690, 89328238, 52707042, 88106656, 15590355, 41085464, 88083109, 14478717, 72309040, 13256226, 40740224, 76145933, 13533678, 49928686, 75922381, 2311090, 48806195, 75290703, 1295442, 37683547, 74078255, 37961969, 572850, 73956664, 9350312, 36745317, 62133026, 9238125, 35622739, 61011438, 98416533, 34800281, 1855886, 37343995, 63748694, 132308, 36521307, 63526052, 99910751, 35405755, 62803464, 98898163, 35283277, 61681816, 94076521, 20560620, 66569334, 93953933, 29348048, 56733747, 92731385, 28226490, 55610199, 81019803, 28403802, 54498517, 80993256, 27381364, 53776969, 80170678, 16169772, 89058026, 52553471, 15443125, 42431833, 88836438, 14220547, 41619242, 77103950, 14108995, 40597694, 76981308, 13386407, 49370016, 76869711, 2263869, 49658464, 75047173, 1041278, 38436986, 74920585, 1329620, 37313338, 63708033, 197042, 36591747, 63086455, 9070454, 35479109, 84366728, 11765832, 47759571, 73244186, 10632284, 46037983, 73421698, 9416697, 46815301, 8794055, 45792753, 3259760, 71187462, 8571567, 34976176, 70465810, 7459919, 33854624, 60242223, 6637331, 32731036, 69120785, 95515789, 32909498, 68304193, 94392192, 31887806, 67282505, 94670654, 20065259, 66069967, 93454062, 29942771, 56347375, 92332424, 28720123, 55125728, 81519836, 28004531, 54092240, 12061457, 81497285, 27882993, 53270092, 80275707, 16769305, 53154400, 89552119, 15947754, 42932862, 84330567, 11825276, 47219274, 73218989, 10602628, 46057733, 73542331, 9940036, 45935145, 72329844, 8728498, 45112597, 71607202, 7602800, 34090915, 70485614, 7889323, 33878367, 60362066, 6767771, 32152870, 69540484, 95545183, 32939238, 8428836, 34813545, 71817640, 7206349, 34690953, 60095092, 6589707, 33578406, 69973414, 96367119, 32756828, 68250822, 95245571, 21639276, 68038375, 94423983, 20417688, 67906797, 4472318, 40460013, 77855162, 30748475, 76133574, 3137279, 39522887, 65910922, 2405631, 38409239, 65898344, 73478096, 863795, 46261704, 72656408, 5141117, 31149212, 78534861, 4928565, 30327674, 77312273, 3806388, 30291086, 66699781, 3084730, 39078434, 65477143, 92962242, 38356857, 65351555, 91749600, 27134209, 64538914, 90027012, 27012717, 53416326, 99801464, 26259179, 52254878, 99748883, 25137581, 51522296, 88926295, 24915933, 51409648, 87804747, 13298352, 50687050, 86682165, 13076804, 49565413, 85969517, 12954226, 48348921, 85747929, 11132674, 48626373, 74615388, 10019086, 47404795, 73898890, 897409, 46382143, 72776252, 9175957, 35569555, 72554664, 8953369, 34447918, 71832012, 7236721, 34225426, 60619435, 6004133, 33503878, 9597987, 36982581, 72386290, 8775395, 35269904, 61264008, 8653757, 34047456, 60442460, 7436169, 33925864, 60329973, 92714517, 39103226, 65107325, 91592030, 61845881, 97240499, 24634594, 60623203, 96127902, 59900655, 96305350, 22390469, 58884063, 95283172, 21677871, 23512906, 20455229, 57940938, 83334932, 10333641, 56727340, 82112494, 19510093, 45005708, 82090807, 18494511, 45883110, 71277255, 17272964, 44760562, 70155677, 17550376, 43944080, 79933029, 6327734, 42822433, 79210531, 5205146, 31600845, 78098950, 4483598, 31987203, 67972302, 3361010, 30765615, 66150724, 3248469, 39643167, 65037172, 92422871, 38811586, 65815684, 91300233, 28798938, 64193046, 90587641, 27572350, 53971455, 90465153, 22850702, 58858807, 95243515, 21637210, 58036229, 84521924, 20515672, 57900671, 83308376, 10793085, 56787189, 82286798, 19671433, 45065541, 82460246, 18458255, 44843954, 21347668, 57736667, 84121302, 10125011, 56510115, 83008724, 19403423, 46497537, 82886276, 19271881, 45675980, 71164684, 18158393, 44553392, 71948047, 7336745, 43331750, 70825459, 6214163, 43618262, 66736715, 93125329, 29510428, 65914127, 91323605, 92003832, 28497830, 65892585, 91286284, 27275398, 54670997, 90164606, 15845914, 60283232, 97682931, 23076639, 55461744, 92565383, 28954097, 55349196, 81743801, 27132400, 54126514, 80621253, 27015862, 53404966, 89809665, 16893370, 52382379, 89776023, 15171722, 41165831, 88554436, 14959144, 41443249, 77832858, 13836592, 40221691, 76615300, 13014905, 49109013, 76593718, 2992467, 48386462, 75771170, 1769875, 38264974, 74659582, 43227, 821049, 36320744, 62714453, 9709452, 35103106, 62592805, 98986900, 34481518, 61470213, 97864322, 24269961, 63136489, 99531088, 36920182, 62314831, 98319530, 25807544, 61292243, 98696958, 24081957, 61070601, 97474300, 23969415, 50357013, 96352712, 23746827, 59131526, 22024279, 58019984, 85407683, 11802691, 57296396, 84281045, 10780049, 53174748, 89569453, 15967552, 42952160, 88346805, 24454387, 51849482, 87837090, 24232799, 50727844, 86111442, 13510157, 59504256, 86999951, 12397569, 58882608, 85277313, 37442336, 63436931, 653675, 36742774, 85520170, 14513273, 41908872, 77392987, 14391625, 40785230, 72270339, 9674034, 45663742, 12058741, 48452496, 84941194, 11335209, 47330808, 74725513, 10113611, 46518210, 73602965, 9091064, 46485778, 72880377, 9275482, 35263180, 71768839, 8152834, 34541543, 71545247, 7930346, 33325951, 60823690, 6218704, 33202303, 69601012, 95095116, 32480825, 68989420, 95973569, 21368273, 67752972, 94151981, 20145685, 67630394, 93039339, 29423048, 56818742, 92812851, 29301450, 55795155, 82190203, 28189908, 54573517, 81978611, 17462320, 54851325, 80845034, 16240772, 53639887, 89023486, 16528181, 42516299, 88901994, 15306543, 41790641, 78789356, 14283055, 40678060, 77066768, 3461403, 40456412, 76840111, 2339825, 39733924, 75728539, 2116237, 38511382, 74906081, 1490690, 33499794, 60883493, 6278008, 33676146 23923758, 69133798, 64583600, 13302026, 57511992, 90583279, 76352503, 77672444, 75311421, 12527118, 27657173, 50699850, 96084564, 86605515, 15464375, 15198996, 78077209, 64475743, 9627468, 62967433, 98462037, 5182107, 67853262, 8085950, 31464658, 8910240, 76823930, 97534104, 36629635, 33099732, 3121655, 39520293, 89974735, 65892310, 99742859, 47132793, 93347961, 30342076, 35026117, 62411811, 8505920, 34904525, 61398234, 97783338, 34771947, 60176682, 96661780, 33055499, 23446369, 50834074, 86239173, 22723778, 59712426, 85106525, 12501230, 58996839, 84384943, 11489642, 47873397, 84262395, 10666000, 47051709, 73046708, 19544412, 46939151, 72323266, 19322865, 45716579, 71101678, 8690387, 44094981, 71089030, 7473735, 33872334, 70366448, 6351147, 33750856, 25577965, 15635751, 42620460, 88124568, 86893702, 49858495, 5916510, 3103067, 38105306, 85758066, 33331231, 9726840, 36114945, 62219643, 9603252, 35098357, 89839552, 77590412, 88617904, 42228966, 86469231, 47077697, 84900597, 1683982, 64104037, 99370594, 61103515, 35705817, 20994205, 57499304, 83888009, 19272658, 56677752, 82661461, 19050066, 55554175, 70551291, 6556909, 43940008, 79339613, 5833312, 32828466, 78217065, 5611760, 31006879, 68490573, 4599182, 30983281, 67378935, 93777634, 30761649, 66156348, 92644052, 39049051, 65433790, 92428405, 28827503, 64211118, 91706817, 27104921, 54878729, 91262474, 26988374, 11020863, 58415502, 76076738, 84813516, 11808215, 47292920, 84797028, 10186633, 46570372, 83575471, 19963185, 46358784, 72843899, 18847598, 45236142, 71620241, 39396763, 75780818, 8025950, 44413654, 70508653, 7903368, 33391067, 70786111, 6180710, 32175429, 79663524, 5068132, 32453837, 68441986, 4836680, 31230289, 67725394, 94113093, 30118701, 62503746, 99991455, 25396150, 62480168, 98875863, 25273572, 61668670, 97053215, 24151924, 50546029, 37930737, 23099524, 59494222, 85888377, 59094601, 85182315, 11587414, 47961342, 73355951, 844056, 36848764, 72233469, 5829717, 31817415, 77202120, 4606229, 30095833, 77189532, 91479482, 34456146, 63013339, 32549749, 31600513, 53754104, 3574681, 39973386, 61322713, 66367984, 54594017, 2752099, 35756798, 61245403, 97639441, 34034150, 60023855, 97417863, 23812568, 60306277, 96795312, 22790910, 26050548, 52445243, 39943352, 65938950, 1259814, 91434602, 38529357, 64927055, 90312154, 37706769, 63101468, 90290572, 26684111, 41406613, 77895328, 3289027, 30284022, 76672730, 3167439, 39552584, 65956182, 66431519, 2526224, 38910263, 65305978, 91703676, 38798785, 64182380, 90681088, 19096726, 45484331, 82489470, 18973184, 44362883, 81767888, 17751597, 44146295, 70534340, 12877076, 58371671, 85766789, 11155484, 47149093, 84544192, 10938846, 49027020, 75416738, 12801833, 48805472, 75294187, 1688285, 48183890, 74577599, 98396890, 51779204, 98173209, 24662957, 50056656, 87451661, 62991792, 25784595, 13179234, 2347656, 48745395, 75730490, 1225009, 37629703, 74018812, 2511, 33407125, 69895264, 5380979, 32785578, 68779682, 5168381, 92107604, 29595202, 31562086, 68957034, 94445733, 66712905, 30430448, 67835547, 20618850, 93229151, 55990317, 92385016, 28373620, 49131917, 15130912, 41525660, 88919365, 14418464, 41802073, 87897777, 13291886, 40680521, 76075139, 49568943, 75952542, 38339996, 65734501, 91222209, 37617348, 64612053, 90000652, 37495766, 63899465, 99984170, 26372118, 62777823, 99162522, 25550531, 52645235, 98049934, 24434049, 51822687, 83827392, 20212491, 56700100, 82105704, 29599813, 55584558, 82983267, 18377261, 54862960, 81260679, 17255673, 44649322, 80044027, 16433136, 43527730, 79912449, 16310544, 42705243, 78199891, 5852388, 31241087, 67745632, 94130731, 30128445, 67523044, 93918159, 29302858, 66401502, 92895501, 29280200, 55688914, 91073013, 28168628, 54562327, 91951471, 27345070, 53330789, 80738884, 26223582, 53618197, 89016236, 15001940, 52495649, 88890658, 15388353, 41773061, 87778106, 14166715, 40551410, 87955518, 23288411, 55272555, 81677154, 18165869, 54550967, 81945676, 17943271, 43338320, 80722024, 16227633, 43215738, 79600447, 15005145, 42493140, 78888899, 15982593, 41371602, 77765207, 4160316, 40155014, 77543769, 3048768, 30432463, 76821171, 2815176, 39210885, 5605529, 42193638, 78598237, 4582942, 31971040, 61496006, 98881700, 34876719, 61374414, 97769122, 23153227, 60158866, 96546575, 23931679, 69436288, 95824983, 22819092, 58203736, 95602345, 21057444, 57541158, 84546257, 20934852, 57329501, 83723605, 19712214, 38082437, 1876841, 64487132, 37260946, 63265554, 90659259, 36148308, 63542003, 99937011, 25926710, 62320425, 98715423, 25209168, 51208877, 97692972, 24087580, 50486289, 97870394, 23965033, 59353647, 86758746, 11962031, 57357130, 84755744, 10140443, 57134592, 83533296, 19027895, 46412900, 22411609, 59805313, 85250352, 11654067, 58143766, 84138874, 11522479, 47921178, 83315222, 10300821, 46804536, 83293635, 19688343, 48784854, 67127799, 20001443, 56495147, 93490856, 29884951, 55273560, 82777208, 28762303, 55151012, 81555617, 53212882, 18940725, 54334420, 80433039, 17827173, 80611581, 16605586, 42090294, 89594399, 15983048, 42377643, 78362751, 14761450, 41255165, 73640163, 44818, 46033517, 72427512, 9822220, 35311929, 72305034, 8700633, 34198387, 71583486, 34072799, 6855503, 60461804, 33250142, 69248256, 96633955, 32138660, 69522668, 95911373, 21915012, 68300121, 94798725, 21293424, 67288539, 93672138, 56465981, 93850690, 29948294, 55343303, 82738008, 28126717, 55521751, 81615450, 17000165, 54408264, 80893872, 17888577, 53286626, 89771220, 16165939, 42560034, 89558743, 15943341, 41348446, 78836195, 14821890, 41215808, 77610503, 4008212, 40493210, 16598965, 43986064, 79371769, 20295753, 56790702, 82184400, 25573115, 51578214, 88962829, 14357527, 50855622, 87240371, 13234975, 40633084, 93612434, 7987191, 20071842, 46123974, 31699677, 77683371, 3078380, 30576089, 66961194, 3355732, 39354437, 66749546, 92133240, 38628859, 65626958, 91011603, 28406301, 64804316, 90299015, 27383719, 53782828, 90176467, 26561172, 52566270, 99054885, 25449584, 52843699, 88232397, 24226942, 51611041, 87116749, 14504454, 50599453, 86993168, 13382806, 49776811, 86271510, 12266229, 48654323, 85059922, 11443677, 48832775, 74936480, 11321089, 47710198, 73104892, 109401, 46593546, 73082255, 9486959, 35871958, 72860663, 8264361, 35659410, 71143015, 7142724, 34536828, 60921537, 7320132, 33814281, 69809989, 96203584, 32692693, 69087397, 95471006, 21570001, 64964750, 90359458, 27753563, 53742162, 99137266, 26631975, 52020510, 99414629, 25419323, 52807032, 28292031, 64797746, 91781484, 27170599, 54564198, 90969892, 26357901, 53442500, 84462118, 10851853, 57946551, 83340560, 19739265, 82128978, 19516687, 45001322, 71406430, 18890039, 44889144, 16312943, 21949879, 58938528, 84332527, 21727231, 57111330, 83610035, 10604644, 56099748, 83488497, 19882096, 46877100, 82361809, 18760514, 45154513, 71549257, 18548966, 44932065, 70427670, 17825378, 43210483, 70204022, 6609736, 42198835, 79582540, 5577149, 52253888, 32975247, 78360952, 4754691, 31259606, 67248304, 4632019, 30037118, 66425726, 3410461, 39915560, 66309175, 92798873, 38192988, 65187687, 91575236, 24070330, 60465049, 97453744, 23848752, 59242457, 96637156, 22125101, 59120809, 95515518, 21903613, 58308221, 84792926, 21887075, 57285770, 83670388, 10065487, 56063182, 83558891, 19942835, 45337544, 82735249, 18720257, 45115956, 81613061, 17008760, 44092304, 70491413, 17885118, 43270827, 79775821, 6763530, 42158279, 79552283, 5941982, 32335697, 78420796, 4825390, 31213049, 7608148, 54656181, 80040886, 26435595, 53923690, 89328238, 52707042, 88106656, 15590355, 41085464, 88083109, 14478717, 72309040, 13256226, 40740224, 76145933, 13533678, 49928686, 75922381, 2311090, 48806195, 75290703, 1295442, 37683547, 74078255, 37961969, 572850, 73956664, 9350312, 36745317, 62133026, 9238125, 35622739, 61011438, 98416533, 34800281, 1855886, 37343995, 63748694, 132308, 36521307, 63526052, 99910751, 35405755, 62803464, 98898163, 35283277, 61681816, 94076521, 20560620, 66569334, 93953933, 29348048, 56733747, 92731385, 28226490, 55610199, 81019803, 28403802, 54498517, 80993256, 27381364, 53776969, 80170678, 16169772, 89058026, 52553471, 15443125, 42431833, 88836438, 14220547, 41619242, 77103950, 14108995, 40597694, 76981308, 13386407, 49370016, 76869711, 2263869, 49658464, 75047173, 1041278, 38436986, 74920585, 1329620, 37313338, 63708033, 197042, 36591747, 63086455, 9070454, 35479109, 84366728, 11765832, 47759571, 73244186, 10632284, 46037983, 73421698, 9416697, 46815301, 8794055, 45792753, 3259760, 71187462, 8571567, 34976176, 70465810, 7459919, 33854624, 60242223, 6637331, 32731036, 69120785, 95515789, 32909498, 68304193, 94392192, 31887806, 67282505, 94670654, 20065259, 66069967, 93454062, 29942771, 56347375, 92332424, 28720123, 55125728, 81519836, 28004531, 54092240, 12061457, 81497285, 27882993, 53270092, 80275707, 16769305, 53154400, 89552119, 15947754, 42932862, 84330567, 11825276, 47219274, 73218989, 10602628, 46057733, 73542331, 9940036, 45935145, 72329844, 8728498, 45112597, 71607202, 7602800, 34090915, 70485614, 7889323, 33878367, 60362066, 6767771, 32152870, 69540484, 95545183, 32939238, 8428836, 34813545, 71817640, 7206349, 34690953, 60095092, 6589707, 33578406, 69973414, 96367119, 32756828, 68250822, 95245571, 21639276, 68038375, 94423983, 20417688, 67906797, 4472318, 40460013, 77855162, 30748475, 76133574, 3137279, 39522887, 65910922, 2405631, 38409239, 65898344, 73478096, 863795, 46261704, 72656408, 5141117, 31149212, 78534861, 4928565, 30327674, 77312273, 3806388, 30291086, 66699781, 3084730, 39078434, 65477143, 92962242, 38356857, 65351555, 91749600, 27134209, 64538914, 90027012, 27012717, 53416326, 99801464, 26259179, 52254878, 99748883, 25137581, 51522296, 88926295, 24915933, 51409648, 87804747, 13298352, 50687050, 86682165, 13076804, 49565413, 85969517, 12954226, 48348921, 85747929, 11132674, 48626373, 74615388, 10019086, 47404795, 73898890, 897409, 46382143, 72776252, 9175957, 35569555, 72554664, 8953369, 34447918, 71832012, 7236721, 34225426, 60619435, 6004133, 33503878, 9597987, 36982581, 72386290, 8775395, 35269904, 61264008, 8653757, 34047456, 60442460, 7436169, 33925864, 60329973, 92714517, 39103226, 65107325, 91592030, 61845881, 97240499, 24634594, 60623203, 96127902, 59900655, 96305350, 22390469, 58884063, 95283172, 21677871, 23512906, 20455229, 57940938, 83334932, 10333641, 56727340, 82112494, 19510093, 45005708, 82090807, 18494511, 45883110, 71277255, 17272964, 44760562, 70155677, 17550376, 43944080, 79933029, 6327734, 42822433, 79210531, 5205146, 31600845, 78098950, 4483598, 31987203, 67972302, 3361010, 30765615, 66150724, 3248469, 39643167, 65037172, 92422871, 38811586, 65815684, 91300233, 28798938, 64193046, 90587641, 27572350, 53971455, 90465153, 22850702, 58858807, 95243515, 21637210, 58036229, 84521924, 20515672, 57900671, 83308376, 10793085, 56787189, 82286798, 19671433, 45065541, 82460246, 18458255, 44843954, 21347668, 57736667, 84121302, 10125011, 56510115, 83008724, 19403423, 46497537, 82886276, 19271881, 45675980, 71164684, 18158393, 44553392, 71948047, 7336745, 43331750, 70825459, 6214163, 43618262, 66736715, 93125329, 29510428, 65914127, 91323605, 92003832, 28497830, 65892585, 91286284, 27275398, 54670997, 90164606, 15845914, 60283232, 97682931, 23076639, 55461744, 92565383, 28954097, 55349196, 81743801, 27132400, 54126514, 80621253, 27015862, 53404966, 89809665, 16893370, 52382379, 89776023, 15171722, 41165831, 88554436, 14959144, 41443249, 77832858, 13836592, 40221691, 76615300, 13014905, 49109013, 76593718, 2992467, 48386462, 75771170, 1769875, 38264974, 74659582, 43227, 821049, 36320744, 62714453, 9709452, 35103106, 62592805, 98986900, 34481518, 61470213, 97864322, 24269961, 63136489, 99531088, 36920182, 62314831, 98319530, 25807544, 61292243, 98696958, 24081957, 61070601, 97474300, 23969415, 50357013, 96352712, 23746827, 59131526, 22024279, 58019984, 85407683, 11802691, 57296396, 84281045, 10780049, 53174748, 89569453, 15967552, 42952160, 88346805, 24454387, 51849482, 87837090, 24232799, 50727844, 86111442, 13510157, 59504256, 86999951, 12397569, 58882608, 85277313, 37442336, 63436931, 653675, 36742774, 85520170, 14513273, 41908872, 77392987, 14391625, 40785230, 72270339, 9674034, 45663742, 12058741, 48452496, 84941194, 11335209, 47330808, 74725513, 10113611, 46518210, 73602965, 9091064, 46485778, 72880377, 9275482, 35263180, 71768839, 8152834, 34541543, 71545247, 7930346, 33325951, 60823690, 6218704, 33202303, 69601012, 95095116, 32480825, 68989420, 95973569, 21368273, 67752972, 94151981, 20145685, 67630394, 93039339, 29423048, 56818742, 92812851, 29301450, 55795155, 82190203, 28189908, 54573517, 81978611, 17462320, 54851325, 80845034, 16240772, 53639887, 89023486, 16528181, 42516299, 88901994, 15306543, 41790641, 78789356, 14283055, 40678060, 77066768, 3461403, 40456412, 76840111, 2339825, 39733924, 75728539, 2116237, 38511382, 74906081, 1490690, 33499794, 60883493, 6278008, 33676146
}; };
public final String officialExCardPackageName = "ygo233.com-pre-release.ypk";//官方扩展卡包ypk文件的名称 public final String officialExCardPackageName = "ygopro-super-pre.ypk";//官方扩展卡包ypk文件的名称
} }
...@@ -6,7 +6,7 @@ import android.os.Parcelable; ...@@ -6,7 +6,7 @@ import android.os.Parcelable;
/* /*
This class contains two types of card information:ex-card information and updating log, which is marked This class contains two types of card information:ex-card information and updating log, which is marked
by "type 0" and "type 1", respectively. by "type 0" and "type 1", respectively.
本类包括两种卡牌信息,先行卡信息和更新日志(分别由·type 0和type 1表示)。 本类包括两种卡牌信息,先行卡信息和更新日志(分别由·type 0和type 1表示)。
*/ */
public class ExCard implements Parcelable { public class ExCard implements Parcelable {
private String name; private String name;
......
...@@ -21,7 +21,7 @@ public class ExCardActivity extends BaseActivity { ...@@ -21,7 +21,7 @@ public class ExCardActivity extends BaseActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ex_card); setContentView(R.layout.activity_ex_card);
viewPager = findViewById(R.id.viewPager); viewPager = findViewById(R.id.viewPager);
viewPager.setOffscreenPageLimit(2); viewPager.setOffscreenPageLimit(1);
tabLayout = findViewById(R.id.packagetablayout); tabLayout = findViewById(R.id.packagetablayout);
createTabFragment(); createTabFragment();
...@@ -47,4 +47,19 @@ public class ExCardActivity extends BaseActivity { ...@@ -47,4 +47,19 @@ public class ExCardActivity extends BaseActivity {
return true; return true;
} }
//todo 当未下载完先行卡就退出页面时,会导致软件错误退出。未来通过监听返回事件,判断下载状态,若正在下载则阻拦返回键。
//若发生错误或已完成,则不阻拦返回。
@Override
public void onBackPressed() {
// 完全由自己控制返回键逻辑,系统不再控制,但是有个前提是:
// 不要在Activity的onKeyDown或者OnKeyUp中拦截掉返回键
// 拦截:就是在OnKeyDown或者OnKeyUp中自己处理了返回键
//(这里处理之后return true.或者return false都会导致onBackPressed不会执行)
// 不拦截:在OnKeyDown和OnKeyUp中返回super对应的方法
//(如果两个方法都被覆写就分别都要返回super.onKeyDown,super.onKeyUp)
super.onBackPressed();
}
} }
package cn.garymb.ygomobile.ex_card;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ExCardData {
@SerializedName("id")
@Expose
private Long id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("desc")
@Expose
private String desc;
@SerializedName("overallString")
@Expose
private String overallString;
@SerializedName("picUrl")
@Expose
private String picUrl;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getOverallString() {
return overallString;
}
public void setOverallString(String overallString) {
this.overallString = overallString;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
}
\ No newline at end of file
package cn.garymb.ygomobile.ex_card; package cn.garymb.ygomobile.ex_card;
import static cn.garymb.ygomobile.Constants.URL_PRE_CARD;
import static cn.garymb.ygomobile.utils.StringUtils.mergeListDelimeter;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestBuilder;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.jsoup.Jsoup; import java.io.IOException;
import org.jsoup.nodes.Document; import java.lang.reflect.Type;
import org.jsoup.nodes.Element; import java.util.List;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.plus.DialogPlus; import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil; import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.glide.GlideCompat; import cn.garymb.ygomobile.utils.glide.GlideCompat;
import okhttp3.Response;
public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> { public class ExCardListAdapter extends BaseQuickAdapter<ExCardData, BaseViewHolder> {
private static final String TAG = ExCardListAdapter.class.getSimpleName(); private static final String TAG = ExCardListAdapter.class.getSimpleName();
private ImageLoader imageLoader; private ImageLoader imageLoader;
...@@ -34,34 +38,32 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> ...@@ -34,34 +38,32 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder>
public void loadData() { public void loadData() {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card)); final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
//Connect to the website LogUtil.d(TAG, "start fetch");
Document document = Jsoup.connect(Constants.URL_YGO233_ADVANCE).get(); List<ExCardData> exCardDataList = null;
Element pre_card_content = document.getElementById("pre_release_cards"); try {
Element tbody = pre_card_content.getElementsByTag("tbody").get(0); Response response = OkhttpUtil.synchronousGet(URL_PRE_CARD, null, null);
Elements cards = tbody.getElementsByTag("tr"); String responseBodyString = response.body().string();
if (cards.size() > 5000) {//Considering the efficiency of html parse, if the size of Type listType = new TypeToken<List<ExCardData>>() {
// pre cards list is to large, return null directly. }.getType();
return null; Gson gson = new Gson();
}
ArrayList<ExCard> exCardList = new ArrayList<>(); // Convert JSON to Java object using Gson
for (Element card : cards) { exCardDataList = gson.fromJson(responseBodyString, listType);
Elements card_attributes = card.getElementsByTag("td");
String imageUrl = card_attributes.get(0).getElementsByTag("a").attr("href") + "!half";
String name = card_attributes.get(1).text();
String description = card_attributes.get(2).text();
ExCard exCard = new ExCard(name, imageUrl, description, 0);
exCardList.add(exCard);
}
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
if (exCardList.isEmpty()) { if (exCardDataList.isEmpty()) {
return null; return null;
} else { } else {
return exCardList; return exCardDataList;
} }
}).fail((e) -> { })
.fail((e) -> {
//关闭异常 //关闭异常
if (dialog_read_ex.isShowing()) { if (dialog_read_ex.isShowing()) {
try { try {
...@@ -71,13 +73,14 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> ...@@ -71,13 +73,14 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder>
} }
LogUtil.i(TAG, "webCrawler fail"); LogUtil.i(TAG, "webCrawler fail");
}).done(exCardList -> { })
.done((exCardDataList) -> {
if (exCardList != null) { if (exCardDataList != null) {
LogUtil.i(TAG, "webCrawler done"); LogUtil.i(TAG, "webCrawler done");
getData().clear(); getData().clear();
addData(exCardList); addData(exCardDataList);
notifyDataSetChanged(); notifyDataSetChanged();
} }
if (dialog_read_ex.isShowing()) { if (dialog_read_ex.isShowing()) {
...@@ -87,25 +90,32 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> ...@@ -87,25 +90,32 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder>
} }
} }
}); });
}
private static Boolean isMonster(List<String> list) {
for (String data : list) {
if (data.equals("怪兽")) {
return true;
}
}
return false;
} }
@Override @Override
protected void convert(BaseViewHolder helper, ExCard item) { protected void convert(BaseViewHolder helper, ExCardData item) {
helper.setText(R.id.ex_card_name, item.getName()); helper.setText(R.id.ex_card_name, item.getName());
helper.setText(R.id.ex_card_description, item.getDescription()); helper.setText(R.id.ex_card_description, item.getDesc());
helper.setText(R.id.ex_card_overall,item.getOverallString());
if (item.isUpdatingLog()) {
helper.setGone(R.id.ex_card_image, true);
} else {
helper.setGone(R.id.ex_card_image, false);
ImageView imageview = helper.getView(R.id.ex_card_image); ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...) //the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
//cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...) //cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...)
//is a private function,so I copied the content of it to here //is a private function,so I copied the content of it to here
RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(item.getImageUrl()); RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(item.getPicUrl());
resource.placeholder(R.drawable.unknown); resource.placeholder(R.drawable.unknown);
resource.error(R.drawable.unknown); resource.error(R.drawable.unknown);
resource.into(imageview); resource.into(imageview);
}
} }
} }
package cn.garymb.ygomobile.ex_card; package cn.garymb.ygomobile.ex_card;
import static cn.garymb.ygomobile.Constants.URL_YGO233_ADVANCE;
import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE; import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE;
import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE_ALT; import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE_ALT;
import static cn.garymb.ygomobile.utils.DownloadUtil.TYPE_DOWNLOAD_EXCEPTION; import static cn.garymb.ygomobile.utils.DownloadUtil.TYPE_DOWNLOAD_EXCEPTION;
...@@ -31,27 +30,25 @@ import org.greenrobot.eventbus.ThreadMode; ...@@ -31,27 +30,25 @@ import org.greenrobot.eventbus.ThreadMode;
import java.io.File; import java.io.File;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.events.ExCardEvent; import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.activities.WebActivity;
import cn.garymb.ygomobile.ui.home.MainActivity; import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.utils.DownloadUtil; import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils; import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.LogUtil; import cn.garymb.ygomobile.utils.LogUtil;
import cn.garymb.ygomobile.utils.ServerUtil; import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil; import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.UnzipUtils;
import cn.garymb.ygomobile.utils.YGOUtil; import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.DataManager; import ocgcore.DataManager;
public class ExCardListFragment extends Fragment implements View.OnClickListener { public class ExCardListFragment extends Fragment {
private static final String TAG = String.valueOf(ExCardListFragment.class); private static final String TAG = String.valueOf(ExCardListFragment.class);
private Context context; private Context context;
private View layoutView; private View layoutView;
private ExCardListAdapter mExCardListAdapter; private ExCardListAdapter mExCardListAdapter;
private RecyclerView mExCardListView; private RecyclerView mExCardListView;
private LinearLayout ll_Download;
private TextView textDownload; private TextView textDownload;
private int FailedCount; private int FailedCount;
...@@ -99,26 +96,24 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -99,26 +96,24 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
mExCardListView.setLayoutManager(linearLayoutManager); mExCardListView.setLayoutManager(linearLayoutManager);
mExCardListView.setAdapter(mExCardListAdapter); mExCardListView.setAdapter(mExCardListAdapter);
mExCardListAdapter.loadData(); mExCardListAdapter.loadData();
textDownload = layoutView.findViewById(R.id.text_download_prerelease); textDownload = layoutView.findViewById(R.id.text_download_precard);
ll_Download = layoutView.findViewById(R.id.btn_download_prerelease);
ll_Download.setOnClickListener(this);
changeDownloadText();
}
LinearLayout clickLayout = layoutView.findViewById(R.id.layout_download_precard);
clickLayout.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_download_prerelease:
LogUtil.i(TAG, "start download"); LogUtil.i(TAG, "start download");
if (downloadState != DownloadState.DOWNLOAD_ING) { if (downloadState != DownloadState.DOWNLOAD_ING) {
downloadState = DownloadState.DOWNLOAD_ING; downloadState = DownloadState.DOWNLOAD_ING;
downloadfromWeb(URL_YGO233_FILE); downloadfromWeb(URL_YGO233_FILE);
} }
break;
} }
});
changeDownloadText();
} }
/** /**
* 根据先行卡包状态改变按钮样式 * 根据先行卡包状态改变按钮样式
*/ */
...@@ -129,15 +124,16 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -129,15 +124,16 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.NEED_UPDATE) { } else if (ServerUtil.exCardState == ServerUtil.ExCardState.NEED_UPDATE) {
textDownload.setText(R.string.Download); textDownload.setText(R.string.Download);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) { } else if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) {
/* 查询不到版本号时,提示toast */
textDownload.setText(R.string.Download);
Toast.makeText(getActivity(), R.string.ex_card_check_toast_message_iii, Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), R.string.ex_card_check_toast_message_iii, Toast.LENGTH_LONG).show();
WebActivity.open(getActivity(), getString(R.string.ex_card_list_title), URL_YGO233_ADVANCE); //WebActivity.open(getActivity(), getString(R.string.ex_card_list_title), URL_YGO233_ADVANCE);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.UNCHECKED) { } else if (ServerUtil.exCardState == ServerUtil.ExCardState.UNCHECKED) {
//do nothing //do nothing
//状态UNCHECKED仅在app启动后调用哦你Create()之前短暂存在,所以该情况进行处理 //状态UNCHECKED仅在app启动后调用哦你Create()之前短暂存在,所以该情况进行处理
//the UNCHECKED state only exists temporarily before the check action, so we need not handle it. //the UNCHECKED state only exists temporarily before the check action, so we need not handle it.
} }
} }
//TODO eventbus receive event
@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
Handler handler = new Handler() { Handler handler = new Handler() {
...@@ -150,18 +146,19 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -150,18 +146,19 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
textDownload.setText(msg.arg1 + "%"); textDownload.setText(msg.arg1 + "%");
break; break;
case DownloadUtil.TYPE_DOWNLOAD_EXCEPTION: case DownloadUtil.TYPE_DOWNLOAD_EXCEPTION:
downloadState = DownloadState.NO_DOWNLOAD;
++FailedCount; ++FailedCount;
if (FailedCount <= 2) { if (FailedCount <= 2) {
Toast.makeText(getActivity(), R.string.Ask_to_Change_Other_Way, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.Ask_to_Change_Other_Way, Toast.LENGTH_SHORT).show();
downloadfromWeb(URL_YGO233_FILE_ALT); downloadfromWeb(URL_YGO233_FILE_ALT);
} }
YGOUtil.showTextToast("error" + msg.obj); YGOUtil.showTextToast("error" + getString(R.string.Download_precard_failed));
break;
case UnzipUtils.ZIP_READY:
textDownload.setText(R.string.title_use_ex);
break; break;
case UnzipUtils.ZIP_UNZIP_OK: // case UnzipUtils.ZIP_READY:
// textDownload.setText(R.string.title_use_ex);
// break;
case DownloadUtil.TYPE_DOWNLOAD_OK:
downloadState = DownloadState.NO_DOWNLOAD;
/* 将先行服务器信息添加到服务器列表中 */ /* 将先行服务器信息添加到服务器列表中 */
String servername = ""; String servername = "";
if (AppsSettings.get().getDataLanguage() == AppsSettings.languageEnum.Chinese.code) if (AppsSettings.get().getDataLanguage() == AppsSettings.languageEnum.Chinese.code)
...@@ -196,10 +193,10 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -196,10 +193,10 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
} }
break; break;
case UnzipUtils.ZIP_UNZIP_EXCEPTION: // case UnzipUtils.ZIP_UNZIP_EXCEPTION:
Toast.makeText(context, getString(R.string.install_failed_bcos) + msg.obj, // Toast.makeText(context, getString(R.string.install_failed_bcos) + msg.obj,
Toast.LENGTH_SHORT).show(); // Toast.LENGTH_SHORT).show();
break; // break;
// case HomeFragment.TYPE_GET_DATA_VER_OK: // case HomeFragment.TYPE_GET_DATA_VER_OK:
// WebActivity.exCardVer = msg.obj.toString(); // WebActivity.exCardVer = msg.obj.toString();
// String oldVer = SharedPreferenceUtil.getExpansionDataVer(); // String oldVer = SharedPreferenceUtil.getExpansionDataVer();
...@@ -228,29 +225,22 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -228,29 +225,22 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
private void downloadfromWeb(String fileUrl) { private void downloadfromWeb(String fileUrl) {
textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本 textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
File file = new File(AppsSettings.get().getResourcePath() + "-preRlease.zip"); String path = AppsSettings.get().getExpansionsPath().getAbsolutePath();
String fileName = Constants.officialExCardPackageName;
File file = new File(path + "/" + fileName);
if (file.exists()) { if (file.exists()) {
/* 删除旧的先行卡包 */
FileUtils.deleteFile(file); FileUtils.deleteFile(file);
SharedPreferenceUtil.setExpansionDataVer(null);//删除先行卡后,更新版本状态
ServerUtil.exCardState = ServerUtil.ExCardState.NEED_UPDATE;
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPackageChange));//删除后,通知UI做更新
} }
DownloadUtil.get().download(fileUrl, file.getParent(), file.getName(), new DownloadUtil.OnDownloadListener() { DownloadUtil.get().download(fileUrl, path, fileName, new DownloadUtil.OnDownloadListener() {
@Override @Override
public void onDownloadSuccess(File file) { public void onDownloadSuccess(File file) {
downloadState = DownloadState.NO_DOWNLOAD;
Message message = new Message(); Message message = new Message();
message.what = UnzipUtils.ZIP_READY; message.what = DownloadUtil.TYPE_DOWNLOAD_OK;
try {
File ydks = new File(AppsSettings.get().getDeckDir());
File[] subYdks = ydks.listFiles();
for (File files : subYdks) {
if (files.getName().contains("-") && files.getName().contains(" new cards"))
files.delete();
}
UnzipUtils.upZipSelectFile(file, AppsSettings.get().getResourcePath(), ".ypk");
} catch (Exception e) {
message.what = UnzipUtils.ZIP_UNZIP_EXCEPTION;
} finally {
message.what = UnzipUtils.ZIP_UNZIP_OK;//TODO 不对吧,finally是一定执行,这样即使有exception也会发unzip_ok啊
}
handler.sendMessage(message); handler.sendMessage(message);
} }
...@@ -265,11 +255,11 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener ...@@ -265,11 +255,11 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
@Override @Override
public void onDownloadFailed(Exception e) { public void onDownloadFailed(Exception e) {
//下载失败后删除下载的文件 //下载失败后删除下载的文件
FileUtils.deleteFile(file); FileUtils.deleteFile(file);
Message message = new Message(); Message message = new Message();
message.what = TYPE_DOWNLOAD_EXCEPTION; message.what = TYPE_DOWNLOAD_EXCEPTION;
message.obj = e.toString();
handler.sendMessage(message); handler.sendMessage(message);
} }
}); });
......
...@@ -12,6 +12,9 @@ import java.util.List; ...@@ -12,6 +12,9 @@ import java.util.List;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
/**
* 旧版本用于展示先行卡更新日志的页面,暂不使用。
*/
public class ExCardLogAdapter extends BaseExpandableListAdapter { public class ExCardLogAdapter extends BaseExpandableListAdapter {
public ExCardLogAdapter(Context context) { public ExCardLogAdapter(Context context) {
......
...@@ -26,6 +26,9 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus; ...@@ -26,6 +26,9 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.LogUtil; import cn.garymb.ygomobile.utils.LogUtil;
/**
* 配合cn.garymb.ygomobile.ex_card.ExCardLogAdapter,实现展示先行卡更新日志的页面,暂不使用。
*/
public class ExCardLogFragment extends Fragment implements View.OnClickListener { public class ExCardLogFragment extends Fragment implements View.OnClickListener {
private static final String TAG = String.valueOf(ExCardLogFragment.class); private static final String TAG = String.valueOf(ExCardLogFragment.class);
private Context mContext; private Context mContext;
...@@ -92,7 +95,7 @@ public class ExCardLogFragment extends Fragment implements View.OnClickListener ...@@ -92,7 +95,7 @@ public class ExCardLogFragment extends Fragment implements View.OnClickListener
} }
}).fail((e) -> { }).fail((e) -> {
//ر쳣 //关闭异常
if (dialog_read_ex.isShowing()) { if (dialog_read_ex.isShowing()) {
try { try {
dialog_read_ex.dismiss(); dialog_read_ex.dismiss();
...@@ -111,7 +114,7 @@ public class ExCardLogFragment extends Fragment implements View.OnClickListener ...@@ -111,7 +114,7 @@ public class ExCardLogFragment extends Fragment implements View.OnClickListener
if (exCardLogList != null) { if (exCardLogList != null) {
LogUtil.i(TAG, "webCrawler parse html complete"); LogUtil.i(TAG, "webCrawler parse html complete");
} }
//ر쳣 //关闭异常
if (dialog_read_ex.isShowing()) { if (dialog_read_ex.isShowing()) {
try { try {
dialog_read_ex.dismiss(); dialog_read_ex.dismiss();
......
...@@ -29,15 +29,17 @@ public class ExPackageTabAdapter extends FragmentStatePagerAdapter { ...@@ -29,15 +29,17 @@ public class ExPackageTabAdapter extends FragmentStatePagerAdapter {
Fragment fragment = null; Fragment fragment = null;
if (position == 0) { if (position == 0) {
fragment = new ExCardListFragment(); fragment = new ExCardListFragment();
} else if (position == 1) {
fragment = new ExCardLogFragment();
} }
/* 目前只显示一个tab,未来可能添加其他tab */
// else if (position == 1) {
// fragment = new ExCardLogFragment();
// }
return fragment; return fragment;
} }
@Override @Override
public int getCount() { public int getCount() {
return 2; return 1;
} }
@Override @Override
...@@ -46,9 +48,10 @@ public class ExPackageTabAdapter extends FragmentStatePagerAdapter { ...@@ -46,9 +48,10 @@ public class ExPackageTabAdapter extends FragmentStatePagerAdapter {
if (position == 0) { if (position == 0) {
title = context.getString(R.string.ex_card_list_title); title = context.getString(R.string.ex_card_list_title);
} else if (position == 1) {
title = context.getString(R.string.ex_card_log_title);
} }
// else if (position == 1) {
// title = context.getString(R.string.ex_card_log_title);
// }
return title; return title;
} }
} }
...@@ -29,6 +29,7 @@ import ocgcore.enums.LimitType; ...@@ -29,6 +29,7 @@ import ocgcore.enums.LimitType;
* 包括LimitManager、CardManager、LimitList * 包括LimitManager、CardManager、LimitList
* LimitList负责判断禁止卡等 * LimitList负责判断禁止卡等
* field包括LimitManager、CardManager * field包括LimitManager、CardManager
* 未封装成单例,使用时要构造实例
*/ */
public class CardLoader implements ICardSearcher { public class CardLoader implements ICardSearcher {
private final LimitManager mLimitManager; private final LimitManager mLimitManager;
......
...@@ -794,15 +794,10 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -794,15 +794,10 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
// break; // break;
// } // }
if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) { /* 查不到版本号也打开excard安卓原生activity */
WebActivity.open(getContext(), getString(R.string.action_download_expansions), Constants.URL_YGO233_ADVANCE);
LogUtil.i(TAG, "cannot connect to ex card server, open webactivity");
} else {
/* using Web crawler to extract the information of pre card */
LogUtil.i(TAG, "connect to ex card http server, open webactivity");
Intent exCardIntent = new Intent(getActivity(), ExCardActivity.class); Intent exCardIntent = new Intent(getActivity(), ExCardActivity.class);
startActivity(exCardIntent); startActivity(exCardIntent);
}
break; break;
case R.id.action_help: { case R.id.action_help: {
final DialogPlus dialog = new DialogPlus(getContext()); final DialogPlus dialog = new DialogPlus(getContext());
......
...@@ -22,6 +22,7 @@ public class DownloadUtil { ...@@ -22,6 +22,7 @@ public class DownloadUtil {
private final OkHttpClient okHttpClient; private final OkHttpClient okHttpClient;
public static final int TYPE_DOWNLOAD_EXCEPTION = 1; public static final int TYPE_DOWNLOAD_EXCEPTION = 1;
public static final int TYPE_DOWNLOAD_ING = 2; public static final int TYPE_DOWNLOAD_ING = 2;
public static final int TYPE_DOWNLOAD_OK = 3;
//暂时关闭 //暂时关闭
private static final boolean ENABLE_CACHE = false; private static final boolean ENABLE_CACHE = false;
private static final Map<String, Call> cache = new HashMap<>(); private static final Map<String, Call> cache = new HashMap<>();
...@@ -83,8 +84,8 @@ public class DownloadUtil { ...@@ -83,8 +84,8 @@ public class DownloadUtil {
@Override @Override
public void onResponse(Call call, Response response) throws IOException { public void onResponse(Call call, Response response) throws IOException {
if(!response.isSuccessful()){ if (!response.isSuccessful()) {
listener.onDownloadFailed(new Exception("error:"+response.code())); listener.onDownloadFailed(new Exception("error:" + response.code()));
return; return;
} }
String contentLen = response.header("Content-Length"); String contentLen = response.header("Content-Length");
...@@ -104,10 +105,11 @@ public class DownloadUtil { ...@@ -104,10 +105,11 @@ public class DownloadUtil {
try { try {
is = response.body().byteStream(); is = response.body().byteStream();
long total = response.body().contentLength(); long total = response.body().contentLength();
if(contentLength > 0 && total != contentLength){ if (contentLength > 0 && total != contentLength) {
listener.onDownloadFailed(new Exception("file length[" + total + "] < " + contentLen)); listener.onDownloadFailed(new Exception("file length[" + total + "] < " + contentLen));
} else { } else {
out = new FileOutputStream(file); /* 入参为false时,向file覆盖写入 */
out = new FileOutputStream(file, false);
long sum = 0; long sum = 0;
while ((len = is.read(buf)) != -1) { while ((len = is.read(buf)) != -1) {
out.write(buf, 0, len); out.write(buf, 0, len);
......
...@@ -4,6 +4,7 @@ import android.text.TextUtils; ...@@ -4,6 +4,7 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -197,6 +198,25 @@ public class OkhttpUtil { ...@@ -197,6 +198,25 @@ public class OkhttpUtil {
client.newCall(request.build()).enqueue(callback); client.newCall(request.build()).enqueue(callback);
} }
public static Response synchronousGet(String address, Map<String, Object> map, String cookie) throws IOException {
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder httpBuilder = HttpUrl.parse(address).newBuilder();
if (map != null) {
for (Map.Entry<String, Object> param : map.entrySet()) {
httpBuilder.addQueryParameter(param.getKey(), param.getValue().toString());
}
}
Request.Builder request = new Request.Builder()
.url(httpBuilder.build());
Log.e("OkhttpUtil", "为" + httpBuilder.build());
if (!TextUtils.isEmpty(cookie)) {
request.addHeader("cookie", cookie);
}
return client.newCall(request.build()).execute();
}
public static void del(String address, Map<String, Object> map, String cookie, Callback callback) { public static void del(String address, Map<String, Object> map, String cookie, Callback callback) {
OkHttpClient client = new OkHttpClient(); OkHttpClient client = new OkHttpClient();
...@@ -292,10 +312,18 @@ public class OkhttpUtil { ...@@ -292,10 +312,18 @@ public class OkhttpUtil {
if (!TextUtils.isEmpty(cookie)) { if (!TextUtils.isEmpty(cookie)) {
request.addHeader("cookie", cookie); request.addHeader("cookie", cookie);
} }
Log.e("OkhttpUtil",json+" 状态 "+ request.build()); Log.e("OkhttpUtil", json + " 状态 " + request.build());
okHttpClient.newCall(request.build()).enqueue(callback); okHttpClient.newCall(request.build()).enqueue(callback);
} }
/**
* 将byte[]类型的十六进制数据(不进行解码)转为字符串格式。如,byte[]中存储的值为0xab78,则转换后的字符串的内容为“ab78”,
* byte[]中存储的值为0xb78,则转换后的字符串的内容为“0b78”
* 可用于将byte中的数据不做改变地打印到log中。
*
* @param buf
* @return
*/
public static String parseByte2HexStr(byte[] buf) { public static String parseByte2HexStr(byte[] buf) {
if (null == buf) { if (null == buf) {
return null; return null;
......
...@@ -4,7 +4,7 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST; ...@@ -4,7 +4,7 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER; import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER;
import static cn.garymb.ygomobile.utils.StringUtils.isHost; import static cn.garymb.ygomobile.utils.StringUtils.isHost;
import static cn.garymb.ygomobile.utils.StringUtils.isNumeric; import static cn.garymb.ygomobile.utils.StringUtils.isNumeric;
import static cn.garymb.ygomobile.utils.StringUtils.isValidIP; import static cn.garymb.ygomobile.utils.WebParseUtil.isValidIP;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -76,8 +76,13 @@ public class ServerUtil { ...@@ -76,8 +76,13 @@ public class ServerUtil {
public void onResponse(Call call, Response response) throws IOException { public void onResponse(Call call, Response response) throws IOException {
failCounter = 0;//充值计数器 failCounter = 0;//充值计数器
String newVer = response.body().string(); String newVer = response.body().string();
/* 服务器有点怪,返回的版本号带个\n,要去掉 */
if (newVer.endsWith("\n")) {
newVer = newVer.substring(0, newVer.length() - 2);
}
serverExCardVersion = newVer; serverExCardVersion = newVer;
LogUtil.i(TAG, "ServerUtil fetch pre-card version:" + newVer); LogUtil.i(TAG, "ServerUtil fetch pre-card version:" + newVer);
if (!TextUtils.isEmpty(newVer)) { if (!TextUtils.isEmpty(newVer)) {
......
...@@ -51,8 +51,8 @@ public class SharedPreferenceUtil { ...@@ -51,8 +51,8 @@ public class SharedPreferenceUtil {
return getShareRecord().getInt("StartTimes", 0); return getShareRecord().getInt("StartTimes", 0);
} }
public static void setExpansionDataVer(String json) { public static void setExpansionDataVer(String dataVer) {
getShareRecord().edit().putString("ExpansionsDataVer", json).commit(); getShareRecord().edit().putString("ExpansionsDataVer", dataVer).commit();
} }
public static String getExpansionDataVer() { public static String getExpansionDataVer() {
......
...@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.utils; ...@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.utils;
import android.text.TextUtils; import android.text.TextUtils;
import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -82,28 +83,24 @@ public class StringUtils { ...@@ -82,28 +83,24 @@ public class StringUtils {
return isurl; return isurl;
} }
/** /**
* 检查字符串是否是IPv4 * 使用分隔符,将List<String>合为一个String
*/ */
public static boolean isValidIP(String s) { public static String mergeListDelimeter(List<String> list) {
if (TextUtils.isEmpty(s)) { if (list == null || list.isEmpty()) {
return false; return "";
}
String[] arr = s.split("\\.");
if (arr.length != 4) {
return false;
}
for (String value : arr) {
try {
int n = Integer.parseInt(value);
if (!(n >= 0 && n <= 255)) {
return false;
}
} catch (NumberFormatException e) {
return false;
} }
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < list.size() - 1; i++) {
stringBuilder.append(list.get(i));
stringBuilder.append("|");
} }
return true; stringBuilder.append(list.get(list.size() - 1));
return stringBuilder.toString();
} }
} }
...@@ -16,6 +16,7 @@ public class UnzipUtils { ...@@ -16,6 +16,7 @@ public class UnzipUtils {
public static final int ZIP_READY = 600; public static final int ZIP_READY = 600;
public static final int ZIP_UNZIP_OK = 601; public static final int ZIP_UNZIP_OK = 601;
public static final int ZIP_UNZIP_EXCEPTION = 602; public static final int ZIP_UNZIP_EXCEPTION = 602;
/** /**
* 解压缩一个文件 * 解压缩一个文件
* *
...@@ -82,7 +83,7 @@ public class UnzipUtils { ...@@ -82,7 +83,7 @@ public class UnzipUtils {
if (entry.isDirectory()) { if (entry.isDirectory()) {
continue; continue;
} }
if (entry.getName().contains(nameContains)) { if (entry.getName().contains(nameContains)) {//如果zip中包含.ypk格式的文件,则将其放到/storage/emulated/0/Android/data/cn.garymb.ygomobile.CN/files/ygocore目录下
InputStream is = zf.getInputStream(entry); InputStream is = zf.getInputStream(entry);
String str = folderPath + File.separator + entry.getName(); String str = folderPath + File.separator + entry.getName();
str = new String(str.getBytes("8859_1"), StandardCharsets.UTF_8); str = new String(str.getBytes("8859_1"), StandardCharsets.UTF_8);
......
package cn.garymb.ygomobile.utils;
import android.text.TextUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.ex_card.ExCard;
/**
* 用于解析html网页内容的工具类
*/
public class WebParseUtil {
/**
* 检查字符串是否是IPv4
*/
public static boolean isValidIP(String s) {
if (TextUtils.isEmpty(s)) {
return false;
}
String[] arr = s.split("\\.");
if (arr.length != 4) {
return false;
}
for (String value : arr) {
try {
int n = Integer.parseInt(value);
if (!(n >= 0 && n <= 255)) {
return false;
}
} catch (NumberFormatException e) {
return false;
}
}
return true;
}
public static List<ExCard> loadData() throws IOException {
//Connect to the website
Document document = Jsoup.connect(Constants.URL_YGO233_ADVANCE).get();
Element pre_card_content = document.getElementById("pre_release_cards");
Element tbody = pre_card_content.getElementsByTag("tbody").get(0);
Elements cards = tbody.getElementsByTag("tr");
if (cards.size() > 5000) {//Considering the efficiency of html parse, if the size of
// pre cards list is to large, return null directly.
return null;
}
ArrayList<ExCard> exCardList = new ArrayList<>();
for (Element card : cards) {
Elements card_attributes = card.getElementsByTag("td");
String imageUrl = card_attributes.get(0).getElementsByTag("a").attr("href") + "!half";
String name = card_attributes.get(1).text();
String description = card_attributes.get(2).text();
ExCard exCard = new ExCard(name, imageUrl, description, 0);
exCardList.add(exCard);
}
if (exCardList.isEmpty()) {
return null;
} else {
return exCardList;
}
}
}
...@@ -14,18 +14,29 @@ ...@@ -14,18 +14,29 @@
android:padding="5dp" android:padding="5dp"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
<!-- 不知道为啥,android:focusableInTouchMode="true"就导致必须按两次linearylayout才触发点击事件
有帖子说:
一个View的点击事件在第一次点击时无效,第二次点击之后才会响应。
最后发现是因为焦点问题,第一次点击实际上是获取焦点,第二次点击才会响应点击事件。
只要在相关控件属性里面加了两个焦点相关的属性:
android:focusable="true"
android:focusableInTouchMode="false"
版权声明:本文为CSDN博主「qiqiname1989」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qiqiname1989/article/details/82177869-->
<LinearLayout <LinearLayout
android:id="@+id/btn_download_prerelease" android:id="@+id/layout_download_precard"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_marginRight="20dp" android:layout_marginRight="30dp"
android:layout_marginBottom="70dp" android:layout_marginBottom="100dp"
android:clickable="true" android:clickable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="false"
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:padding="10dp">
<Button <Button
android:id="@+id/btn_download_precard"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_gravity="center" android:layout_gravity="center"
...@@ -34,7 +45,7 @@ ...@@ -34,7 +45,7 @@
android:clickable="false" /> android:clickable="false" />
<TextView <TextView
android:id="@+id/text_download_prerelease" android:id="@+id/text_download_precard"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="30dp" android:layout_height="30dp"
android:background="@drawable/ic_radius_bg" android:background="@drawable/ic_radius_bg"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sml="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:background="@drawable/list_item_bg" android:background="@drawable/list_item_bg"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingBottom="10dp">
<!-- set the layout_height in the linear layout to “wrap_content” <!-- set the layout_height in the linear layout to “wrap_content”
so it doesn’t only show one TextView per page.--> so it doesn’t only show one TextView per page.-->
...@@ -14,16 +13,16 @@ ...@@ -14,16 +13,16 @@
android:id="@+id/ex_card_image" android:id="@+id/ex_card_image"
android:layout_width="@dimen/card_width_middle" android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle" android:layout_height="@dimen/card_height_middle"
android:padding="10dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingRight="2dp"
android:scaleType="fitXY" android:scaleType="fitXY"
tools:src="@drawable/unknown" /> tools:src="@drawable/unknown" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:orientation="vertical"
android:orientation="vertical"> android:padding="10dp">
<cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView <cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView
android:id="@+id/ex_card_name" android:id="@+id/ex_card_name"
...@@ -40,12 +39,19 @@ ...@@ -40,12 +39,19 @@
android:textSize="15sp" android:textSize="15sp"
tools:text="Card Name" /> tools:text="Card Name" />
<TextView
android:id="@+id/ex_card_overall"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/ex_card_description" android:id="@+id/ex_card_description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -269,6 +269,7 @@ ...@@ -269,6 +269,7 @@
<string name="Checking_Update">检查更新中,请稍候</string> <string name="Checking_Update">检查更新中,请稍候</string>
<string name="Found_Update">发现新版本,前往下载?</string> <string name="Found_Update">发现新版本,前往下载?</string>
<string name="Checking_Update_Failed">检查更新失败</string> <string name="Checking_Update_Failed">检查更新失败</string>
<string name="Download_precard_failed">先行卡下载失败</string>
<string name="Ask_to_Change_Other_Way">主线获取失败,尝试备选线路中...</string> <string name="Ask_to_Change_Other_Way">主线获取失败,尝试备选线路中...</string>
<string name="DuelAssistant">决斗助手启用中</string> <string name="DuelAssistant">决斗助手启用中</string>
<string name="masterrule">学习大师规则</string> <string name="masterrule">学习大师规则</string>
......
...@@ -266,6 +266,7 @@ ...@@ -266,6 +266,7 @@
<string name="Checking_Update">Now Checking Update</string> <string name="Checking_Update">Now Checking Update</string>
<string name="Found_Update">New upGrade is Founded, Download?</string> <string name="Found_Update">New upGrade is Founded, Download?</string>
<string name="Checking_Update_Failed">Checking Update Failed</string> <string name="Checking_Update_Failed">Checking Update Failed</string>
<string name="Download_precard_failed">Download pre-cards failed</string>
<string name="Ask_to_Change_Other_Way">trying other way...</string> <string name="Ask_to_Change_Other_Way">trying other way...</string>
<string name="DuelAssistant">DuelAssiatant is On</string> <string name="DuelAssistant">DuelAssiatant is On</string>
<string name="masterrule">Master Rule</string> <string name="masterrule">Master Rule</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment