use of cn.liuyin.manhua.data.bean.SearchResult in project Manhua by ag2s20150909.
the class SearchActivity method getHtml.
// public void search(final String kw) {
// new Thread(new Runnable() {
//
// @Override
// public void run() {
//
// String u = HttpTool.search(getApplicationContext(), kw);
// getHtml(u);
// }
// }).start();
// }
public void getHtml(final String url) {
new Thread(new Runnable() {
@Override
public void run() {
try {
String d = HttpTool.httpGet(url);
if (d.startsWith("error:")) {
mHander.obtainMessage(0, d).sendToTarget();
} else {
Document doc = Jsoup.parse(d, url);
// FileTool.writeFile("doc.html",doc.html());
Elements lists = doc.select(".cont-list").select("li");
mHander.obtainMessage(0, "搜索到" + lists.size() + "条结果").sendToTarget();
SearchResult data = new SearchResult();
for (Element item : lists) {
Book temp = new Book();
temp.link = item.select("a").attr("abs:href") + "/";
temp.name = item.select("h3").text();
temp.img = item.select("img").attr("data-src");
temp.author = item.select("dd").get(0).text();
temp.type = item.select("dd").get(1).text();
temp.newChapter = item.select("dd").get(2).text();
temp.updateTime = item.select("dd").get(3).text();
data.add(temp);
}
// FileTool.writeFile("update.html",doc.toString());
mHander.obtainMessage(1, data).sendToTarget();
}
} catch (Exception e) {
mHander.obtainMessage(0, "error" + e).sendToTarget();
}
}
}).start();
}
use of cn.liuyin.manhua.data.bean.SearchResult in project Manhua by ag2s20150909.
the class SearchActivity method search.
public void search(final String kw) {
new Thread(new Runnable() {
@Override
public void run() {
Gson gson = new Gson();
SearchResult data = new SearchResult();
SearchBean d = gson.fromJson(new API().search_1(kw, 1, 100), SearchBean.class);
data.add(d);
mHander.obtainMessage(1, data).sendToTarget();
// String u = HttpTool.search(getApplicationContext(), kw);
// getHtml(u);
}
}).start();
}
use of cn.liuyin.manhua.data.bean.SearchResult in project Manhua by ag2s20150909.
the class HomeActivity method getType.
public void getType(final int classId) {
new Thread(new Runnable() {
@Override
public void run() {
API api = new API();
try {
SearchResult d = new SearchResult();
ClassListBean data = gson.fromJson(api.getCateDetail(classId, 1, 100), ClassListBean.class);
d.add(data);
mHander.obtainMessage(1, d).sendToTarget();
} catch (Exception e) {
FileTool.writeError(e);
mHander.obtainMessage(0, e.getLocalizedMessage()).sendToTarget();
}
}
}).start();
}
use of cn.liuyin.manhua.data.bean.SearchResult in project Manhua by ag2s20150909.
the class HomeActivity method getNew.
public void getNew() {
new Thread(new Runnable() {
@Override
public void run() {
API api = new API();
try {
SearchResult d = new SearchResult();
RankingBean data = gson.fromJson(api.getRanking("newOnline", 1, 100), RankingBean.class);
d.add(data);
mHander.obtainMessage(1, d).sendToTarget();
} catch (Exception e) {
FileTool.writeError(e);
mHander.obtainMessage(0, e.getLocalizedMessage()).sendToTarget();
}
}
}).start();
}
Aggregations