public List<CancelActionDescription> getCancelActionsList() { myCancelActionsList.clear(); if (ShowLibraryInCancelMenuOption.getValue()) { myCancelActionsList.add(new CancelActionDescription(CancelActionType.library, null)); } if (ShowNetworkLibraryInCancelMenuOption.getValue()) { myCancelActionsList.add(new CancelActionDescription(CancelActionType.networkLibrary, null)); } if (ShowPreviousBookInCancelMenuOption.getValue()) { final Book previousBook = Library.Instance().getPreviousBook(); if (previousBook != null) { myCancelActionsList.add( new CancelActionDescription(CancelActionType.previousBook, previousBook.getTitle())); } } if (ShowPositionsInCancelMenuOption.getValue()) { if (Model != null && Model.Book != null) { for (Bookmark bookmark : Library.Instance().invisibleBookmarks(Model.Book)) { myCancelActionsList.add(new BookmarkDescription(bookmark)); } } } myCancelActionsList.add(new CancelActionDescription(CancelActionType.close, null)); return myCancelActionsList; }
public boolean onStylusRelease(int x, int y) { if (super.onStylusRelease(x, y)) { return false; } ZLTextElementArea area = getElementByCoordinates(x, y); if (area != null) { ZLTextElement element = area.Element; if ((element instanceof ZLTextImageElement) || (element instanceof ZLTextWord)) { final ZLTextWordCursor cursor = new ZLTextWordCursor(StartCursor); cursor.moveToParagraph(area.ParagraphIndex); cursor.moveToParagraphStart(); final int elementIndex = area.TextElementIndex; byte hyperlinkKind = FBTextKind.REGULAR; String id = null; for (int i = 0; i < elementIndex; ++i) { ZLTextElement e = cursor.getElement(); if (e instanceof ZLTextControlElement) { if (e instanceof ZLTextHyperlinkControlElement) { final ZLTextHyperlinkControlElement control = (ZLTextHyperlinkControlElement) e; hyperlinkKind = control.Kind; id = control.Label; } else { final ZLTextControlElement control = (ZLTextControlElement) e; if (!control.IsStart && (control.Kind == hyperlinkKind)) { hyperlinkKind = FBTextKind.REGULAR; id = null; } } } cursor.nextWord(); } if (id != null) { switch (hyperlinkKind) { case FBTextKind.EXTERNAL_HYPERLINK: if (OpenInBrowserOption.getValue()) { ZLibrary.Instance().openInBrowser(id); } return true; case FBTextKind.FOOTNOTE: case FBTextKind.INTERNAL_HYPERLINK: ((FBReader) Application).tryOpenFootnote(id); return true; } } } } return false; }