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


Java BookEvent类代码示例

本文整理汇总了Java中org.geometerplus.fbreader.book.BookEvent的典型用法代码示例。如果您正苦于以下问题:Java BookEvent类的具体用法?Java BookEvent怎么用?Java BookEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BookEvent类属于org.geometerplus.fbreader.book包,在下文中一共展示了BookEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public void onReceive(Context context, Intent intent) {
	if (!hasListeners()) {
		return;
	}

	try {
		final String type = intent.getStringExtra("type");
		if (LibraryService.BOOK_EVENT_ACTION.equals(intent.getAction())) {
			final Book book = SerializerUtil.deserializeBook(intent.getStringExtra("book"));
			fireBookEvent(BookEvent.valueOf(type), book);
		} else {
			fireBuildEvent(Status.valueOf(type));
		}
	} catch (Exception e) {
		// ignore
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:18,代码来源:BookCollectionShadow.java

示例2: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public boolean onBookEvent(BookEvent event, Book book) {
	switch (event) {
		case Added:
		case Updated:
		{
			// TODO: remove empty series tree after update (?)
			final SeriesInfo info = book.getSeriesInfo();
			// TODO: pass series
			return info != null && createSeriesSubTree(info.Series.getTitle());
		}
		case Removed:
			// TODO: remove empty series tree (?)
			return false;
		default:
			return false;
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:19,代码来源:SeriesListTree.java

示例3: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public boolean onBookEvent(BookEvent event, Book book) {
	switch (event) {
		case Added:
		case Updated:
		{
			// TODO: remove empty authors tree after update (?)
			final List<Author> bookAuthors = book.authors();
			boolean changed = false;
			if (bookAuthors.isEmpty()) {
				changed &= createAuthorSubTree(Author.NULL);
			} else for (Author a : bookAuthors) {
				changed &= createAuthorSubTree(a);
			}
			return changed;
		}
		case Removed:
			// TODO: remove empty authors tree (?)
			return false;
		default:
			return false;
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:24,代码来源:AuthorListTree.java

示例4: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public boolean onBookEvent(BookEvent event, Book book) {
	switch (event) {
		case Added:
			return containsBook(book) && createSubTree(book);
		case Updated:
		{
			boolean changed = removeBook(book);
			changed |= containsBook(book) && createSubTree(book);
			return changed;
		}
		case Removed:
		default:
			return super.onBookEvent(event, book);
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:17,代码来源:FilteredTree.java

示例5: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public boolean onBookEvent(BookEvent event, Book book) {
	switch (event) {
		default:
		case Added:
			return false;
		case Removed:
			return removeBook(book);
		case Updated:
		{
			boolean changed = false;
			for (FBTree tree : this) {
				if (tree instanceof BookTree) {
					final Book b = ((BookTree)tree).Book;
					if (b.equals(book)) {
						b.updateFrom(book);
						changed = true;
					}
				}
			}
			return changed;
		}
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:24,代码来源:LibraryTree.java

示例6: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public boolean onBookEvent(BookEvent event, Book book) {
	switch (event) {
		case Added:
		case Updated:
		{
			// TODO: remove empty tag trees after update (?)
			final List<Tag> bookTags = book.tags();
			boolean changed = false;
			if (bookTags.isEmpty()) {
				changed &= createTagSubTree(Tag.NULL);
			} else for (Tag t : bookTags) {
				if (t.Parent == null) {
					changed &= createTagSubTree(t);
				}
			}
			return changed;
		}
		case Removed:
			// TODO: remove empty tag trees (?)
			return false;
		default:
			return false;
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:26,代码来源:TagListTree.java

示例7: onContextItemSelected

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
private boolean onContextItemSelected(int itemId, Book book) {
	switch (itemId) {
		case OPEN_BOOK_ITEM_ID:
			CoreReadActivity.openBookActivity(this, book, null);
			return true;
		case SHARE_BOOK_ITEM_ID:
			FBUtil.shareBook(this, book);
			return true;
		case ADD_TO_FAVORITES_ITEM_ID:
			book.addLabel(Book.FAVORITE_LABEL);
			myRootTree.Collection.saveBook(book, false);
			return true;
		case REMOVE_FROM_FAVORITES_ITEM_ID:
			book.removeLabel(Book.FAVORITE_LABEL);
			myRootTree.Collection.saveBook(book, false);
			if (getCurrentTree().onBookEvent(BookEvent.Updated, book)) {
				getListAdapter().replaceAll(getCurrentTree().subTrees());
				getListView().invalidateViews();
			}
			return true;
		case MARK_AS_READ_ITEM_ID:
			book.addLabel(Book.READ_LABEL);
			myRootTree.Collection.saveBook(book, false);
			getListView().invalidateViews();
			return true;
		case MARK_AS_UNREAD_ITEM_ID:
			book.removeLabel(Book.READ_LABEL);
			myRootTree.Collection.saveBook(book, false);
			getListView().invalidateViews();
			return true;
		case DELETE_BOOK_ITEM_ID:
			tryToDeleteBook(book);
			return true;
	}
	return false;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:37,代码来源:LibraryActivity.java

示例8: onClick

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public void onClick(DialogInterface dialog, int which) {
	if (getCurrentTree() instanceof FileTree) {
		getListAdapter().remove(new FileTree((FileTree)getCurrentTree(), myBook.File));
		getListView().invalidateViews();
	} else if (getCurrentTree().onBookEvent(BookEvent.Removed, myBook)) {
		getListAdapter().replaceAll(getCurrentTree().subTrees());
		getListView().invalidateViews();
	}

	myRootTree.Collection.removeBook(myBook, true);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:12,代码来源:LibraryActivity.java

示例9: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public boolean onBookEvent(BookEvent event, Book book) {
	if (book == null) {
		return false;
	}
	switch (event) {
		case Added:
			if (myGroupByFirstLetter) {
				return createTitleSubTree(book.firstTitleLetter());
			} else {
				return createBookWithAuthorsSubTree(book);
			}
		case Removed:
			if (myGroupByFirstLetter) {
				// TODO: remove old tree (?)
				return false;
			} else {
				return super.onBookEvent(event, book);
			}
		default:
		case Updated:
			if (myGroupByFirstLetter) {
				// TODO: remove old tree (?)
				return createTitleSubTree(book.firstTitleLetter());
			} else {
				boolean changed = removeBook(book);
				changed |= createBookWithAuthorsSubTree(book);
				return changed;
			}
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:32,代码来源:TitleListTree.java

示例10: FBReaderApp

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public FBReaderApp(IBookCollection collection)
{
	Collection = collection;

	collection.addListener(new IBookCollection.Listener()
	{
		public void onBookEvent(BookEvent event, Book book)
		{
			switch (event)
			{
			case BookmarkStyleChanged:
			case BookmarksUpdated:
				if (Model != null && (book == null || book.equals(Model.Book)))
				{
					if (BookTextView.getModel() != null)
					{
						setBookmarkHighlightings(BookTextView, null);
					}
					if (FootnoteView.getModel() != null && myFootnoteModelId != null)
					{
						setBookmarkHighlightings(FootnoteView, myFootnoteModelId);
					}
				}
				break;
			case Updated:
				onBookUpdated(book);
				break;
			}
		}

		public void onBuildEvent(IBookCollection.Status status)
		{}
	});

	addAction(ActionCode.INCREASE_FONT, new ChangeFontSizeAction(this, +2));
	addAction(ActionCode.DECREASE_FONT, new ChangeFontSizeAction(this, -2));

	addAction(ActionCode.FIND_NEXT, new FindNextAction(this));
	addAction(ActionCode.FIND_PREVIOUS, new FindPreviousAction(this));
	addAction(ActionCode.CLEAR_FIND_RESULTS, new ClearFindResultsAction(this));

	addAction(ActionCode.SELECTION_CLEAR, new SelectionClearAction(this));

	addAction(ActionCode.TURN_PAGE_FORWARD, new TurnPageAction(this, true));
	addAction(ActionCode.TURN_PAGE_BACK, new TurnPageAction(this, false));

	addAction(ActionCode.MOVE_CURSOR_UP, new MoveCursorAction(this, FBView.Direction.up));
	addAction(ActionCode.MOVE_CURSOR_DOWN, new MoveCursorAction(this, FBView.Direction.down));
	addAction(ActionCode.MOVE_CURSOR_LEFT, new MoveCursorAction(this, FBView.Direction.rightToLeft));
	addAction(ActionCode.MOVE_CURSOR_RIGHT, new MoveCursorAction(this, FBView.Direction.leftToRight));

	addAction(ActionCode.VOLUME_KEY_SCROLL_FORWARD, new VolumeKeyTurnPageAction(this, true));
	addAction(ActionCode.VOLUME_KEY_SCROLL_BACK, new VolumeKeyTurnPageAction(this, false));

	addAction(ActionCode.SWITCH_TO_DAY_PROFILE, new SwitchProfileAction(this, ColorProfile.DAY));
	addAction(ActionCode.SWITCH_TO_NIGHT_PROFILE, new SwitchProfileAction(this, ColorProfile.NIGHT));

	addAction(ActionCode.EXIT, new ExitAction(this));

	BookTextView = new FBView(this);
	FootnoteView = new FBView(this);

	setView(BookTextView);
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:65,代码来源:FBReaderApp.java

示例11: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public void onBookEvent(BookEvent event, Book book) {
	if (event == BookEvent.BookmarkStyleChanged) {
		((ActionListAdapter)getListAdapter()).setStyleList(myCollection.highlightingStyles());
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:6,代码来源:StyleListActivity.java

示例12: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public void onBookEvent(BookEvent event, Book book) {
	if (getCurrentTree().onBookEvent(event, book)) {
		getListAdapter().replaceAll(getCurrentTree().subTrees());
		getListView().invalidateViews();
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:7,代码来源:LibraryActivity.java

示例13: onBookEvent

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
@Override
public void onBookEvent(BookEvent event, Book book) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:6,代码来源:BookInfoActivity.java

示例14: FBReaderApp

import org.geometerplus.fbreader.book.BookEvent; //导入依赖的package包/类
public FBReaderApp(Context context,IBookCollection collection) {
	Collection = collection;
	context=context;
	collection.addListener(new IBookCollection.Listener() {
		public void onBookEvent(BookEvent event, Book book) {
			switch (event) {
				case BookmarkStyleChanged:
				case BookmarksUpdated:
					if (Model != null && (book == null || book.equals(Model.Book))) {
						if (BookTextView.getModel() != null) { 
							setBookmarkHighlightings(BookTextView, null);
						}
						if (FootnoteView.getModel() != null && myFootnoteModelId != null) { 
							setBookmarkHighlightings(FootnoteView, myFootnoteModelId);
						}
					}
					break;
				case Updated:
					onBookUpdated(book);
					break;
			}
		}

		public void onBuildEvent(IBookCollection.Status status) {
		}
	});

	addAction(ActionCode.INCREASE_FONT, new ChangeFontSizeAction(this, +2));
	addAction(ActionCode.DECREASE_FONT, new ChangeFontSizeAction(this, -2));

	addAction(ActionCode.FIND_NEXT, new FindNextAction(this));
	addAction(ActionCode.FIND_PREVIOUS, new FindPreviousAction(this));
	addAction(ActionCode.CLEAR_FIND_RESULTS, new ClearFindResultsAction(this));

	addAction(ActionCode.SELECTION_CLEAR, new SelectionClearAction(this));

	addAction(ActionCode.TURN_PAGE_FORWARD, new TurnPageAction(this, true));
	addAction(ActionCode.TURN_PAGE_BACK, new TurnPageAction(this, false));

	addAction(ActionCode.MOVE_CURSOR_UP, new MoveCursorAction(this, FBView.Direction.up));
	addAction(ActionCode.MOVE_CURSOR_DOWN, new MoveCursorAction(this, FBView.Direction.down));
	addAction(ActionCode.MOVE_CURSOR_LEFT, new MoveCursorAction(this, FBView.Direction.rightToLeft));
	addAction(ActionCode.MOVE_CURSOR_RIGHT, new MoveCursorAction(this, FBView.Direction.leftToRight));

	addAction(ActionCode.VOLUME_KEY_SCROLL_FORWARD, new VolumeKeyTurnPageAction(this, true));
	addAction(ActionCode.VOLUME_KEY_SCROLL_BACK, new VolumeKeyTurnPageAction(this, false));

	addAction(ActionCode.SWITCH_TO_DAY_PROFILE, new SwitchProfileAction(this, ColorProfile.DAY));
	addAction(ActionCode.SWITCH_TO_NIGHT_PROFILE, new SwitchProfileAction(this, ColorProfile.NIGHT));
	
	addAction(ActionCode.SWITCH_TO_BG2,new SwitchProfileAction(this,ColorProfile.SECOND));
	addAction(ActionCode.SWITCH_TO_BG3,new SwitchProfileAction(this,ColorProfile.THIRD));
	addAction(ActionCode.JUST_REFRESH,new FBRreshAction(this,0));
	addAction(ActionCode.EXIT, new ExitAction(this));

	BookTextView = new FBView(this);
	FootnoteView = new FBView(this);

	setView(BookTextView);

}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:62,代码来源:FBReaderApp.java


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