use of com.justwayward.reader.ui.adapter.TocListAdapter in project BookReader by JustWayward.
the class ReadActivity method initTocList.
private void initTocList() {
mTocListAdapter = new TocListAdapter(this, mChapterList, bookId, currentChapter);
mTocListPopupWindow = new ListPopupWindow(this);
mTocListPopupWindow.setAdapter(mTocListAdapter);
mTocListPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mTocListPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mTocListPopupWindow.setAnchorView(mLlBookReadTop);
mTocListPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mTocListPopupWindow.dismiss();
currentChapter = position + 1;
mTocListAdapter.setCurrentChapter(currentChapter);
startRead = false;
showDialog();
readCurrentChapter();
hideReadBar();
}
});
mTocListPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
gone(mTvBookReadTocTitle);
visible(mTvBookReadReading, mTvBookReadCommunity, mTvBookReadChangeSource);
}
});
}
use of com.justwayward.reader.ui.adapter.TocListAdapter in project BookReader by JustWayward.
the class ReadEPubActivity method initTocList.
private void initTocList() {
mTocListAdapter = new TocListAdapter(this, mChapterList, "", 1);
mTocListAdapter.setEpub(true);
mTocListPopupWindow = new ListPopupWindow(this);
mTocListPopupWindow.setAdapter(mTocListAdapter);
mTocListPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mTocListPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mTocListPopupWindow.setAnchorView(mCommonToolbar);
mTocListPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mTocListPopupWindow.dismiss();
currentChapter = position + 1;
mTocListAdapter.setCurrentChapter(currentChapter);
viewpager.setCurrentItem(position);
}
});
mTocListPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
toolbarAnimateHide();
}
});
}
Aggregations