void openBookText(TOCTree tree) { final TOCTree.Reference reference = tree.getReference(); if (reference != null) { finish(); final FBReaderApp fbreader = (FBReaderApp) ZLApplication.Instance(); fbreader.addInvisibleBookmark(); fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0); fbreader.showBookTextView(); } }
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); // bar = this.getActionBar(); bar.setTitle(R.string.title_toc); bar.setDisplayHomeAsUpEnabled(true); bar.setDisplayShowHomeEnabled(true); bar.setDisplayShowTitleEnabled(true); // final FBReaderApp fbreader = (FBReaderApp) ZLApplication.Instance(); final TOCTree root = fbreader.Model.TOCTree; myAdapter = new TOCAdapter(root); final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor(); int index = cursor.getParagraphIndex(); if (cursor.isEndOfParagraph()) { ++index; } TOCTree treeToSelect = fbreader.getCurrentTOCElement(); myAdapter.selectItem(treeToSelect); mySelectedItem = treeToSelect; }