本文整理汇总了Java中org.geometerplus.fbreader.book.Bookmark类的典型用法代码示例。如果您正苦于以下问题:Java Bookmark类的具体用法?Java Bookmark怎么用?Java Bookmark使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Bookmark类属于org.geometerplus.fbreader.book包,在下文中一共展示了Bookmark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openBook
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private synchronized void openBook(Intent intent, Runnable action, boolean force)
{
if (!force && myBook != null) { return; }
myBook = SerializerUtil.deserializeBook(intent.getStringExtra(BOOKMARK_KEY));
final Bookmark bookmark = SerializerUtil.deserializeBookmark(intent.getStringExtra(BOOKMARK_KEY));
String fromIntentBookKey = intent.getStringExtra(BOOK_KEY);
if (!TextUtils.isEmpty(fromIntentBookKey))
{
myBook = createBookForFile(ZLFile.createFileByPath(fromIntentBookKey));
}
else
{
if (myBook == null)
{
final Uri data = intent.getData();
if (data != null)
{
myBook = createBookForFile(ZLFile.createFileByPath(data.getPath()));
}
}
}
boolean gotoPosition = getIntent().getBooleanExtra("goto_position", true);
myFBReaderApp.openBook(myBook, bookmark, action, gotoPosition);
}
示例2: openBook
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public void openBook(final Book book, final Bookmark bookmark, final Runnable postAction, boolean gotoPosition)
{
mGotoPosition = gotoPosition;
if (book != null || Model == null)
{
runWithMessage("loadingBook", new Runnable()
{
public void run()
{
openBookInternal(book, bookmark, false);
if (book != null)
{
book.addLabel(Book.READ_LABEL);
Collection.saveBook(book);
}
}
}, postAction);
}
}
示例3: setBookmarkHighlightings
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private void setBookmarkHighlightings(ZLTextView view, String modelId)
{
view.removeHighlightings(BookmarkHighlighting.class);
for (BookmarkQuery query = new BookmarkQuery(Model.Book, 20);; query = query.next())
{
final List<Bookmark> bookmarks = Collection.bookmarks(query);
if (bookmarks.isEmpty())
{
break;
}
for (Bookmark b : bookmarks)
{
if (b.getEnd() == null)
{
b.findEnd(view);
}
if (MiscUtil.equals(modelId, b.ModelId))
{
view.addHighlighting(new BookmarkHighlighting(view, Collection, b));
}
}
}
}
示例4: runCancelAction
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public void runCancelAction(CancelMenuHelper.ActionType type, Bookmark bookmark)
{
switch (type)
{
// case library:
// runAction(ActionCode.SHOW_LIBRARY);
// break;
// case networkLibrary:
// runAction(ActionCode.SHOW_NETWORK_LIBRARY);
// break;
case previousBook:
openBook(Collection.getRecentBook(1), null, null, true);
break;
case returnTo:
Collection.deleteBookmark(bookmark);
gotoBookmark(bookmark, true);
break;
case close:
closeWindow();
break;
}
}
示例5: updateInvisibleBookmarksList
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private synchronized void updateInvisibleBookmarksList(Bookmark b)
{
if (Model != null && Model.Book != null && b != null)
{
for (Bookmark bm : invisibleBookmarks())
{
if (b.equals(bm))
{
Collection.deleteBookmark(bm);
}
}
Collection.saveBookmark(b);
final List<Bookmark> bookmarks = invisibleBookmarks();
for (int i = 3; i < bookmarks.size(); ++i)
{
Collection.deleteBookmark(bookmarks.get(i));
}
}
}
示例6: addAll
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public void addAll(final List<Bookmark> bookmarks) {
runOnUiThread(new Runnable() {
public void run() {
synchronized (myBookmarks) {
for (Bookmark b : bookmarks) {
final int position = Collections.binarySearch(
myBookmarks, b, myComparator);
if (position < 0) {
myBookmarks.add(-position - 1, b);
}
}
}
notifyDataSetChanged();
}
});
}
示例7: addSelectionBookmark
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public Bookmark addSelectionBookmark() {
final FBView fbView = getTextView();
final String text = fbView.getSelectedText();
final Bookmark bookmark = new Bookmark(
Model.Book,
fbView.getModel().getId(),
fbView.getSelectionStartPosition(),
fbView.getSelectionEndPosition(),
text,
true
);
Collection.saveBookmark(bookmark);
fbView.clearSelection();
return bookmark;
}
示例8: setBookmarkHighlightings
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private void setBookmarkHighlightings(ZLTextView view, String modelId) {
view.removeHighlightings(BookmarkHighlighting.class);
for (BookmarkQuery query = new BookmarkQuery(Model.Book, 20); ; query = query.next()) {
final List<Bookmark> bookmarks = Collection.bookmarks(query);
if (bookmarks.isEmpty()) {
break;
}
for (Bookmark b : bookmarks) {
if (b.getEnd() == null) {
b.findEnd(view);
}
if (MiscUtil.equals(modelId, b.ModelId)) {
view.addHighlighting(new BookmarkHighlighting(view, Collection, b));
}
}
}
}
示例9: gotoBookmark
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private void gotoBookmark(Bookmark bookmark) {
final String modelId = bookmark.ModelId;
if (modelId == null) {
addInvisibleBookmark();
BookTextView.gotoHighlighting(
new BookmarkHighlighting(BookTextView, Collection, bookmark)
);
setView(BookTextView);
} else {
setFootnoteModel(modelId);
FootnoteView.gotoHighlighting(
new BookmarkHighlighting(FootnoteView, Collection, bookmark)
);
setView(FootnoteView);
}
getViewWidget().repaint();
}
示例10: runCancelAction
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public void runCancelAction(int index) {
if (index < 0 || index >= myCancelActionsList.size()) {
return;
}
final CancelActionDescription description = myCancelActionsList.get(index);
switch (description.Type) {
case library:
runAction(ActionCode.SHOW_LIBRARY);
break;
case previousBook:
openBook(Collection.getRecentBook(1), null, null);
break;
case returnTo:
{
final Bookmark b = ((BookmarkDescription)description).Bookmark;
Collection.deleteBookmark(b);
gotoBookmark(b);
break;
}
case close:
closeWindow();
break;
}
}
示例11: createBookmark
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public Bookmark createBookmark(int maxLength, boolean visible) {
final FBView view = getTextView();
final ZLTextWordCursor cursor = view.getStartCursor();
if (cursor.isNull()) {
return null;
}
return Bookmark.createBookmark(
Model.Book,
view.getModel().getId(),
cursor,
maxLength,
visible
);
}
示例12: openBook
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private synchronized void openBook(Intent intent, Runnable action,
boolean force) {
if (!force && myBook != null) {
return;
}
myBook = SerializerUtil
.deserializeBook(intent.getStringExtra(BOOK_KEY));
final Bookmark bookmark = SerializerUtil.deserializeBookmark(intent
.getStringExtra(BOOKMARK_KEY));
if (myBook == null) {
final Uri data = intent.getData();
if (data != null) {
this.myBook = createBookForFile(ZLFile.createFileByPath(data
.getPath()));
}
}
myFBReaderApp.openBook(myBook, bookmark, action);
}
示例13: addSelectionBookmark
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public Bookmark addSelectionBookmark()
{
final FBView fbView = getTextView();
final String text = fbView.getSelectedText();
final Bookmark bookmark = new Bookmark(Model.Book, fbView.getModel().getId(), fbView.getSelectionStartPosition(),
fbView.getSelectionEndPosition(), text, true);
Collection.saveBookmark(bookmark);
fbView.clearSelection();
return bookmark;
}
示例14: jumpBack
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
public boolean jumpBack()
{
try
{
if (getTextView() != BookTextView)
{
showBookTextView();
return true;
}
if (myJumpEndPosition == null || myJumpTimeStamp == null) { return false; }
// more than 2 minutes ago
if (myJumpTimeStamp.getTime() + 2 * 60 * 1000 < new Date().getTime()) { return false; }
if (!myJumpEndPosition.equals(BookTextView.getStartCursor())) { return false; }
final List<Bookmark> bookmarks = invisibleBookmarks();
if (bookmarks.isEmpty()) { return false; }
final Bookmark b = bookmarks.get(0);
Collection.deleteBookmark(b);
gotoBookmark(b, true);
return true;
} finally
{
myJumpEndPosition = null;
myJumpTimeStamp = null;
}
}
示例15: gotoBookmark
import org.geometerplus.fbreader.book.Bookmark; //导入依赖的package包/类
private void gotoBookmark(Bookmark bookmark, boolean exactly)
{
final String modelId = bookmark.ModelId;
if (modelId == null)
{
addInvisibleBookmark();
if (exactly)
{
BookTextView.gotoPosition(bookmark);
}
else
{
BookTextView.gotoHighlighting(new BookmarkHighlighting(BookTextView, Collection, bookmark));
}
setView(BookTextView);
}
else
{
setFootnoteModel(modelId);
if (exactly)
{
FootnoteView.gotoPosition(bookmark);
}
else
{
FootnoteView.gotoHighlighting(new BookmarkHighlighting(FootnoteView, Collection, bookmark));
}
setView(FootnoteView);
}
getViewWidget().repaint();
}