当前位置: 首页>>代码示例>>Java>>正文


Java Bookmark类代码示例

本文整理汇总了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);
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:26,代码来源:FBReader.java

示例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);
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:21,代码来源:FBReaderApp.java

示例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));
			}
		}
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:24,代码来源:FBReaderApp.java

示例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;
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:23,代码来源:FBReaderApp.java

示例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));
		}
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:20,代码来源:FBReaderApp.java

示例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();
		}
	});
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:17,代码来源:BookmarksActivity.java

示例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;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:18,代码来源:FBReaderApp.java

示例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));
			}
		}
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:18,代码来源:FBReaderApp.java

示例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();
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:18,代码来源:FBReaderApp.java

示例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;
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:26,代码来源:FBReaderApp.java

示例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
	);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:17,代码来源:FBReaderApp.java

示例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);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:19,代码来源:CoreReadActivity.java

示例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;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:13,代码来源:FBReaderApp.java

示例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;
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:28,代码来源:FBReaderApp.java

示例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();
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:32,代码来源:FBReaderApp.java


注:本文中的org.geometerplus.fbreader.book.Bookmark类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。