Commit 741736f4 authored by fallenstardust's avatar fallenstardust

update comparison list

parent bcfb2a6d
package cn.garymb.ygomobile.ex_card;
import static cn.garymb.ygomobile.Constants.URL_PRE_CARD;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.ImageView;
......@@ -40,58 +38,53 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCardData, BaseViewHold
public void loadData() {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> {
LogUtil.d(TAG, "start fetch");
List<ExCardData> exCardDataList = null;
try {
Response response = OkhttpUtil.synchronousGet(ServerUtil.preCardListJson(), null, null);
String responseBodyString = response.body().string();
Type listType = new TypeToken<List<ExCardData>>() {
}.getType();
Gson gson = new Gson();
// Convert JSON to Java object using Gson
exCardDataList = gson.fromJson(responseBodyString, listType);
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
if (exCardDataList.isEmpty()) {
return null;
} else {
return exCardDataList;
}
})
.fail((e) -> {
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
LogUtil.i(TAG, "webCrawler fail");
})
.done((exCardDataList) -> {
if (exCardDataList != null) {
LogUtil.i(TAG, "webCrawler done");
getData().clear();
addData(exCardDataList);
notifyDataSetChanged();
}
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
});
LogUtil.d(TAG, "start fetch");
List<ExCardData> exCardDataList = null;
try {
Response response = OkhttpUtil.synchronousGet(ServerUtil.preCardListJson(), null, null);
String responseBodyString = response.body().string();
Type listType = new TypeToken<List<ExCardData>>() {
}.getType();
Gson gson = new Gson();
// Convert JSON to Java object using Gson
exCardDataList = gson.fromJson(responseBodyString, listType);
} catch (IOException e) {
Log.e(TAG, "Error occured when fetching data from pre-card server");
return null;
}
if (exCardDataList.isEmpty()) {
return null;
} else {
return exCardDataList;
}
}).fail((e) -> {
Log.e("seesee",e+"");
if (dialog_read_ex.isShowing()) {//关闭异常
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
LogUtil.i(TAG, "webCrawler fail");
}).done((exCardDataList) -> {
Log.w("seesee",exCardDataList+"");
if (exCardDataList != null) {
LogUtil.i(TAG, "webCrawler done");
getData().clear();
addData(exCardDataList);
notifyDataSetChanged();
}
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
});
}
......
......@@ -322,7 +322,108 @@ public interface ComparisonTableUtil {
100224027,
100224032,
100224033,
100224034
100224034,
101207000,
101207001,
101207002,
101207003,
101207004,
101207005,
101207006,
101207007,
101207008,
101207009,
101207010,
101207011,
101207012,
101207013,
101207014,
101207015,
101207016,
101207017,
101207018,
101207019,
101207020,
101207021,
101207022,
101207023,
101207024,
101207025,
101207026,
101207027,
101207028,
101207029,
101207030,
101207031,
101207032,
101207033,
101207034,
101207035,
101207036,
101207037,
101207038,
101207039,
101207040,
101207041,
101207042,
101207043,
101207044,
101207045,
101207046,
101207047,
101207048,
101207049,
101207050,
101207051,
101207052,
101207053,
101207054,
101207055,
101207056,
101207057,
101207058,
101207059,
101207060,
101207061,
101207062,
101207063,
101207064,
101207065,
101207066,
101207067,
101207068,
101207069,
101207070,
101207071,
101207072,
101207073,
101207074,
101207075,
101207076,
101207077,
101207078,
101207079,
101207080,
100228001,
100225001,
100230401,
100200262,
101206081,
101206082,
101206083,
101206084,
101206085,
101206086,
101206087,
101206088,
101206089,
101206090,
101206091,
101206092,
101206093,
101206094,
101206095,
101206100
};
int[] newIDsArray = {
......@@ -643,7 +744,108 @@ public interface ComparisonTableUtil {
43219114,
89604813,
16699558,
42097666
42097666,
99217226,
3598351,
30583090,
76978105,
3376703,
39761418,
65155517,
2254222,
38648860,
65033975,
91438674,
37426272,
64911387,
90315086,
27704731,
63198739,
99193444,
26582143,
62076252,
99471856,
25865565,
52854600,
98248208,
24643913,
51132012,
87126721,
54611591,
81005500,
24521325,
50915474,
86304179,
13708888,
59893882,
86282581,
12686296,
58071334,
85065943,
11464648,
48958757,
84343351,
10732060,
47736165,
73121813,
10515412,
46014517,
72409226,
9453320,
45852939,
72246674,
4731783,
41739381,
77124096,
3519195,
30913809,
76302448,
3496543,
39881252,
65289956,
2674965,
38669664,
5063379,
31552317,
77946022,
4341721,
30339825,
67724434,
3129133,
39613288,
66002986,
2006591,
39491690,
65889305,
91284003,
38379052,
64767757,
91152455,
27556460,
63941169,
90939874,
26434972,
53829527,
42544773,
29325276,
47643326,
10218411,
23738096,
50123605,
86527709,
22916418,
59901153,
85395151,
12890860,
58288565,
84673574,
11677278,
43066927,
80551022,
16955631,
42940335,
19338434,
55733143
};
}
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