use of cn.liuyin.manhua.data.bean.ContentBean in project Manhua by ag2s20150909.
the class DownloadRunnable method getContent.
public static ContentBean getContent(int bid, int cid) {
API api = new API();
if (FileTool.has("chapter", bid + "_" + cid + ".json")) {
String json = FileTool.readFile("chapter", bid + "_" + cid + ".json");
return ContentBean.fromJson(json);
} else {
String json = API.getContents(bid + "", cid + "");
if (json.startsWith("error:")) {
ContentBean c = new ContentBean();
c.code = 1;
c.success = false;
c.message = json;
return c;
}
return ContentBean.fromJson(json);
}
}
use of cn.liuyin.manhua.data.bean.ContentBean in project Manhua by ag2s20150909.
the class DownloadRunnable method downloadMh.
public void downloadMh(ChaptersBean data) {
mService.builder.setSmallIcon(R.mipmap.ic_launcher).setContentInfo("下载中...").setContentTitle("正在下载");
int i = 1;
for (ChaptersBean.Data.List d : data.data.list) {
ContentBean c = getContent(d.bid, d.cid);
// doGg(c,i);
fixdeThreadPool.execute(new DownloadImgRunnable(c, i));
i++;
mService.notifyMsg(c.data.bookTitle, data.data.list.size(), i, d.bid);
}
// mService.notifyMsg(c.data.bookTitle,data.data.list.size(),i,d.bid);
}
use of cn.liuyin.manhua.data.bean.ContentBean in project Manhua by ag2s20150909.
the class BookContentActivity method getData.
public void getData(final int index) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Gson gson = new Gson();
// API api=new API(BookContentActivity.this);
ContentBean data = BookMaker.getContent(chapters.data.list.get(index - 1).bid, chapters.data.list.get(index - 1).cid);
// =gson.fromJson(api.getContents(chapters.data.list.get(index-1).bid+"",chapters.data.list.get(index-1).cid+""),ContentBean.class);
String msg = gson.toJson(data, ContentBean.class);
FileTool.writeFile("debug.txt", msg);
mHander.obtainMessage(2, data).sendToTarget();
} catch (Exception e) {
FileTool.writeError(e.getMessage());
mHander.obtainMessage(0, e.getMessage()).sendToTarget();
}
}
}).start();
}
use of cn.liuyin.manhua.data.bean.ContentBean in project Manhua by ag2s20150909.
the class BookMaker method getContent.
public static ContentBean getContent(int bid, int cid) {
Gson gson = new Gson();
if (FileTool.has("chapter", bid + "_" + cid + ".json")) {
String json = FileTool.readFile("chapter", bid + "_" + cid + ".json");
return gson.fromJson(json, ContentBean.class);
} else {
String json = API.getContents(bid + "", cid + "");
if (json.startsWith("error:")) {
ContentBean c = new ContentBean();
c.code = 1;
c.success = false;
c.message = json;
return c;
}
return gson.fromJson(json, ContentBean.class);
}
}
Aggregations