當前位置: 首頁>>代碼示例>>Java>>正文


Java FBTree類代碼示例

本文整理匯總了Java中org.geometerplus.fbreader.tree.FBTree的典型用法代碼示例。如果您正苦於以下問題:Java FBTree類的具體用法?Java FBTree怎麽用?Java FBTree使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FBTree類屬於org.geometerplus.fbreader.tree包,在下文中一共展示了FBTree類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onKeyDown

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	if (keyCode == KeyEvent.KEYCODE_BACK) {
		FBTree parent = null;
		while (parent == null && !myHistory.isEmpty()) {
			parent = getTreeByKey(myHistory.remove(myHistory.size() - 1));
		}
		if (parent == null) {
			parent = myCurrentTree.Parent;
		}
		if (parent != null && !isTreeInvisible(parent)) {
			openTree(parent, myCurrentTree, false);
			return true;
		}
	}

	return super.onKeyDown(keyCode, event);
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:19,代碼來源:TreeActivity.java

示例2: openTreeInternal

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
private void openTreeInternal(FBTree tree, FBTree treeToSelect, boolean storeInHistory) {
	switch (tree.getOpeningStatus()) {
		case READY_TO_OPEN:
		case ALWAYS_RELOAD_BEFORE_OPENING:
			if (storeInHistory && !myCurrentKey.equals(tree.getUniqueKey())) {
				myHistory.add(myCurrentKey);
			}
			onNewIntent(new Intent(this, getClass())
				.setAction(OPEN_TREE_ACTION)
				.putExtra(TREE_KEY_KEY, tree.getUniqueKey())
				.putExtra(
					SELECTED_TREE_KEY_KEY,
					treeToSelect != null ? treeToSelect.getUniqueKey() : null
				)
				.putExtra(HISTORY_KEY, myHistory)
			);
			break;
		case CANNOT_OPEN:
			UIUtil.showErrorMessage(TreeActivity.this, tree.getOpeningStatusMessage());
			break;
	}
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:23,代碼來源:TreeActivity.java

示例3: onBookEvent

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的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

示例4: compareTo

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
@Override
public int compareTo(FBTree tree) {
	if (tree instanceof BookInSeriesTree) {
		final BigDecimal index0 = Book.getSeriesInfo().Index;
		final BigDecimal index1 = ((BookTree)tree).Book.getSeriesInfo().Index;
		final int cmp;
		if (index0 == null) {
			cmp = index1 == null ? 0 : 1;
		} else {
			cmp = index1 == null ? -1 : index0.compareTo(index1);
		}
		if (cmp != 0) {
			return cmp;
		}
	}
	return super.compareTo(tree);
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:18,代碼來源:BookInSeriesTree.java

示例5: remove

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public void remove(final FBTree item) {
	myActivity.runOnUiThread(new Runnable() {
		public void run() {
			myItems.remove(item);
			notifyDataSetChanged();
		}
	});
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:9,代碼來源:TreeAdapter.java

示例6: add

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public void add(final FBTree item) {
	myActivity.runOnUiThread(new Runnable() {
		public void run() {
			myItems.add(item);
			notifyDataSetChanged();
		}
	});
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:9,代碼來源:TreeAdapter.java

示例7: replaceAll

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public void replaceAll(final Collection<FBTree> items, final boolean invalidateViews) {
	myActivity.runOnUiThread(new Runnable() {
		public void run() {
			synchronized (myItems) {
				myItems.clear();
				myItems.addAll(items);
			}
			notifyDataSetChanged();
			if (invalidateViews) {
				myActivity.getListView().invalidateViews();
			}
		}
	});
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:15,代碼來源:TreeAdapter.java

示例8: getFirstSelectedItem

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public FBTree getFirstSelectedItem() {
	synchronized (myItems) {
		for (FBTree t : myItems) {
			if (myActivity.isTreeSelected(t)) {
				return t;
			}
		}
	}
	return null;
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:11,代碼來源:TreeAdapter.java

示例9: openTree

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
private void openTree(final FBTree tree, final FBTree treeToSelect, final boolean storeInHistory) {
	switch (tree.getOpeningStatus()) {
		case WAIT_FOR_OPEN:
		case ALWAYS_RELOAD_BEFORE_OPENING:
			final String messageKey = tree.getOpeningStatusMessage();
			if (messageKey != null) {
				UIUtil.runWithMessage(
					TreeActivity.this, messageKey,
					new Runnable() {
						public void run() {
							tree.waitForOpening();
						}
					},
					new Runnable() {
						public void run() {
							openTreeInternal(tree, treeToSelect, storeInHistory);
						}
					},
					true
				);
			} else {
				tree.waitForOpening();
				openTreeInternal(tree, treeToSelect, storeInHistory);
			}
			break;
		default:
			openTreeInternal(tree, treeToSelect, storeInHistory);
			break;
	}
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:31,代碼來源:TreeActivity.java

示例10: init

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
protected void init(Intent intent) {
	final FBTree.Key key = (FBTree.Key)intent.getSerializableExtra(TREE_KEY_KEY);
	final FBTree.Key selectedKey = (FBTree.Key)intent.getSerializableExtra(SELECTED_TREE_KEY_KEY);
	myCurrentTree = getTreeByKey(key);
	// not myCurrentKey = key
	// because key might be null
	myCurrentKey = myCurrentTree.getUniqueKey();
	final TreeAdapter adapter = getListAdapter();
	adapter.replaceAll(myCurrentTree.subtrees(), false);
	setTitle(myCurrentTree.getTreeTitle());
	final FBTree selectedTree =
		selectedKey != null ? getTreeByKey(selectedKey) : adapter.getFirstSelectedItem();
	final int index = adapter.getIndex(selectedTree);
	if (index != -1) {
		setSelection(index);
		getListView().post(new Runnable() {
			public void run() {
				setSelection(index);
			}
		});
	}

	myHistory = (ArrayList<FBTree.Key>)intent.getSerializableExtra(HISTORY_KEY);
	if (myHistory == null) {
		myHistory = new ArrayList<FBTree.Key>();
	}
	onCurrentTreeChanged();
}
 
開發者ID:AlixMing,項目名稱:FBreader,代碼行數:29,代碼來源:TreeActivity.java

示例11: replaceAll

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public void replaceAll(final Collection<FBTree> items, final boolean force) {
	myActivity.runOnUiThread(new Runnable() {
		public void run() {
			if (force || !myItems.equals(items)) {
				synchronized (myItems) {
					myItems.clear();
					myItems.addAll(items);
				}
				notifyDataSetChanged();
			}
		}
	});
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:14,代碼來源:TreeAdapter.java

示例12: init

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
protected void init(Intent intent) {
	final FBTree.Key key = (FBTree.Key)intent.getSerializableExtra(TREE_KEY_KEY);
	final FBTree.Key selectedKey = (FBTree.Key)intent.getSerializableExtra(SELECTED_TREE_KEY_KEY);
	myCurrentTree = getTreeByKey(key);
	// not myCurrentKey = key
	// because key might be null
	myCurrentKey = myCurrentTree.getUniqueKey();
	final TreeAdapter adapter = getListAdapter();
	adapter.replaceAll(myCurrentTree.subTrees());
	setTitle(myCurrentTree.getTreeTitle());
	final FBTree selectedTree =
		selectedKey != null ? getTreeByKey(selectedKey) : adapter.getFirstSelectedItem();
	final int index = adapter.getIndex(selectedTree);
	if (index != -1) {
		setSelection(index);
		getListView().post(new Runnable() {
			public void run() {
				setSelection(index);
			}
		});
	}

	myHistory = (ArrayList<FBTree.Key>)intent.getSerializableExtra(HISTORY_KEY);
	if (myHistory == null) {
		myHistory = new ArrayList<FBTree.Key>();
	}
	onCurrentTreeChanged();
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:29,代碼來源:TreeActivity.java

示例13: getHolder

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
private CoverHolder getHolder(ImageView coverView, FBTree tree) {
	CoverHolder holder = (CoverHolder)coverView.getTag();
	if (holder == null) {
		holder = new CoverHolder(this, coverView, tree.getUniqueKey());
		coverView.setTag(holder);
	} else {
		holder.setKey(tree.getUniqueKey());
	}
	return holder;
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:11,代碼來源:CoverManager.java

示例14: trySetCoverImage

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
public boolean trySetCoverImage(ImageView coverView, FBTree tree) {
	final CoverHolder holder = getHolder(coverView, tree);

	Bitmap coverBitmap;
	try {
		coverBitmap = Cache.getBitmap(holder.Key);
	} catch (CoverCache.NullObjectException e) {
		return false;
	}

	if (coverBitmap == null) {
		final ZLImage cover = tree.getCover();
		if (cover instanceof ZLLoadableImage) {
			final ZLLoadableImage img = (ZLLoadableImage)cover;
			if (img.isSynchronized()) {
				setCoverForView(holder, img);
			} else {
				img.startSynchronization(holder.new CoverSyncRunnable(img));
			}
		} else if (cover != null) {
			coverBitmap = getBitmap(cover);
		}
	}
	if (coverBitmap != null) {
		holder.CoverView.setImageBitmap(coverBitmap);
		return true;
	}
	return false;
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:30,代碼來源:CoverManager.java

示例15: getBitmap

import org.geometerplus.fbreader.tree.FBTree; //導入依賴的package包/類
Bitmap getBitmap(FBTree.Key key) throws NullObjectException {
	final Object bitmap = myBitmaps.get(key);
	if (bitmap == NULL_BITMAP) {
		throw new NullObjectException();
	}
	return (Bitmap)bitmap;
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:8,代碼來源:CoverCache.java


注:本文中的org.geometerplus.fbreader.tree.FBTree類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。