use of cn.liuyin.manhua.adapter.BookListAdapter in project Manhua by ag2s20150909.
the class ListActivity method showList.
private void showList(final ChaptersBean chapters) {
if (chapters == null) {
return;
}
if (chapters.code != 0) {
mHander.obtainMessage(0, chapters.message).sendToTarget();
return;
}
int possion;
book = BookShelf.getBookById(book.bookid);
possion = book != null ? book.index : 1;
if (adapter == null) {
adapter = new BookListAdapter(ListActivity.this, chapters, possion);
// lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
lv.setAdapter(adapter);
} else {
adapter.updateView(chapters, possion);
}
lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
lv.setSelection(possion - 1);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
try {
Intent i = new Intent(ListActivity.this, BookContentActivity.class);
i.putExtra("data", chapters);
i.putExtra("book", book);
i.putExtra("index", p3 + 1);
// Toast.makeText(ListActivity.this,data.get(p3).get("url"),1).show();
startActivity(i);
} catch (Exception e) {
e.printStackTrace();
mHander.obtainMessage(0, e.getMessage()).sendToTarget();
}
}
});
}
Aggregations