Search in sources :

Example 1 with TocListAdapter

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);
        }
    });
}
Also used : TocListAdapter(com.justwayward.reader.ui.adapter.TocListAdapter) ListPopupWindow(android.support.v7.widget.ListPopupWindow) ListPopupWindow(android.support.v7.widget.ListPopupWindow) PopupWindow(android.widget.PopupWindow) AdapterView(android.widget.AdapterView) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) BaseReadView(com.justwayward.reader.view.readview.BaseReadView)

Example 2 with TocListAdapter

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();
        }
    });
}
Also used : TocListAdapter(com.justwayward.reader.ui.adapter.TocListAdapter) ListPopupWindow(android.support.v7.widget.ListPopupWindow) PopupWindow(android.widget.PopupWindow) ListPopupWindow(android.support.v7.widget.ListPopupWindow) AdapterView(android.widget.AdapterView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView)

Aggregations

ListPopupWindow (android.support.v7.widget.ListPopupWindow)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 PopupWindow (android.widget.PopupWindow)2 TextView (android.widget.TextView)2 TocListAdapter (com.justwayward.reader.ui.adapter.TocListAdapter)2 GridView (android.widget.GridView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 BaseReadView (com.justwayward.reader.view.readview.BaseReadView)1