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


Java TOCTree类代码示例

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


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

示例1: init

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@AfterViews
public void init( )
{
	tv_head.setText(App.getNowReadBook().name);
	
	Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
	final FBReaderApp fbreader = (FBReaderApp) ZLApplication.Instance();
	final TOCTree root = fbreader.Model.TOCTree;
	myAdapter = new TOCAdapter(root);
	final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor();
	int index = cursor.getParagraphIndex();
	if (cursor.isEndOfParagraph())
	{
		++index;
	}
	
	TOCTree treeToSelect = fbreader.getCurrentTOCElement();
	myAdapter.selectItem(treeToSelect);
	mySelectedItem = treeToSelect;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:21,代码来源:TOCActivity.java

示例2: onContextItemSelected

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item)
{
	final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
	final TOCTree tree = (TOCTree) myAdapter.getItem(position);
	switch (item.getItemId())
	{
	case PROCESS_TREE_ITEM_ID:
		myAdapter.runTreeItem(tree);
		return true;
	case READ_BOOK_ITEM_ID:
		myAdapter.openBookText(tree);
		return true;
	}
	return super.onContextItemSelected(item);
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:17,代码来源:TOCActivity.java

示例3: getCurrentTOCElement

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
public TOCTree getCurrentTOCElement()
{
	final ZLTextWordCursor cursor = BookTextView.getStartCursor();
	if (Model == null || cursor == null) { return null; }

	int index = cursor.getParagraphIndex();
	if (cursor.isEndOfParagraph())
	{
		++index;
	}
	TOCTree treeToSelect = null;
	for (TOCTree tree : Model.TOCTree)
	{
		final TOCTree.Reference reference = tree.getReference();
		if (reference == null)
		{
			continue;
		}
		if (reference.ParagraphIndex > index)
		{
			break;
		}
		treeToSelect = tree;
	}
	return treeToSelect;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:27,代码来源:FBReaderApp.java

示例4: onCreate

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
       //
    bar=this.getActionBar();
	bar.setTitle(R.string.title_toc);
	bar.setDisplayHomeAsUpEnabled(true);
	bar.setDisplayShowHomeEnabled(true);
	bar.setDisplayShowTitleEnabled(true);
	//
	final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
	final TOCTree root = fbreader.Model.TOCTree;
	myAdapter = new TOCAdapter(root);
	final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor();
	int index = cursor.getParagraphIndex();
	if (cursor.isEndOfParagraph()) {
		++index;
	}
	TOCTree treeToSelect = fbreader.getCurrentTOCElement();
	myAdapter.selectItem(treeToSelect);
	mySelectedItem = treeToSelect;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:23,代码来源:TOCActivity.java

示例5: getCurrentTOCElement

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
public TOCTree getCurrentTOCElement() {
	final ZLTextWordCursor cursor = BookTextView.getStartCursor();
	if (Model == null || cursor == null) {
		return null;
	}

	int index = cursor.getParagraphIndex();
	if (cursor.isEndOfParagraph()) {
		++index;
	}
	TOCTree treeToSelect = null;
	for (TOCTree tree : Model.TOCTree) {
		final TOCTree.Reference reference = tree.getReference();
		if (reference == null) {
			continue;
		}
		if (reference.ParagraphIndex > index) {
			break;
		}
		treeToSelect = tree;
	}
	return treeToSelect;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:24,代码来源:FBReaderApp.java

示例6: onCreateContextMenu

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
	final int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;
	final TOCTree tree = (TOCTree) getItem(position);
	if (tree.hasChildren())
	{
		menu.setHeaderTitle(tree.getText());
		final ZLResource resource = ZLResource.resource("tocView");
		menu.add(0, PROCESS_TREE_ITEM_ID, 0, resource.getResource(isOpen(tree) ? "collapseTree" : "expandTree").getValue());
		menu.add(0, READ_BOOK_ITEM_ID, 0, resource.getResource("readText").getValue());
	}

}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:15,代码来源:TOCActivity.java

示例7: getView

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
	final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()).inflate(
			R.layout.lv_toc, parent, false);
	final TOCTree tree = (TOCTree) getItem(position);
	ViewUtil.findTextView(view, R.id.lv_tv).setText(tree.getText());
	return view;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:10,代码来源:TOCActivity.java

示例8: openBookText

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
void openBookText(TOCTree tree)
{
	final TOCTree.Reference reference = tree.getReference();
	if (reference != null)
	{
		finish();
		final FBReaderApp fbreader = (FBReaderApp) ZLApplication.Instance();
		fbreader.addInvisibleBookmark();
		fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0);
		fbreader.showBookTextView();
	}
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:13,代码来源:TOCActivity.java

示例9: runTreeItem

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
protected boolean runTreeItem(ZLTree<?> tree)
{
	if (super.runTreeItem(tree)) { return true; }
	openBookText((TOCTree) tree);
	return true;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:8,代码来源:TOCActivity.java

示例10: onContextItemSelected

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
	final int position = ((AdapterView.AdapterContextMenuInfo)item.getMenuInfo()).position;
	final TOCTree tree = (TOCTree)myAdapter.getItem(position);
	switch (item.getItemId()) {
		case PROCESS_TREE_ITEM_ID:
			myAdapter.runTreeItem(tree);
			return true;
		case READ_BOOK_ITEM_ID:
			myAdapter.openBookText(tree);
			return true;
	}
	return super.onContextItemSelected(item);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:15,代码来源:TOCActivity.java

示例11: onCreateContextMenu

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
	final int position = ((AdapterView.AdapterContextMenuInfo)menuInfo).position;
	final TOCTree tree = (TOCTree)getItem(position);
	if (tree.hasChildren()) {
		menu.setHeaderTitle(tree.getText());
		final ZLResource resource = ZLResource.resource("tocView");
		menu.add(0, PROCESS_TREE_ITEM_ID, 0, resource.getResource(isOpen(tree) ? "collapseTree" : "expandTree").getValue());
		menu.add(0, READ_BOOK_ITEM_ID, 0, resource.getResource("readText").getValue());
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:12,代码来源:TOCActivity.java

示例12: getView

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	final View view = (convertView != null) ? convertView :
		LayoutInflater.from(parent.getContext()).inflate(R.layout.toc_tree_item, parent, false);
	final TOCTree tree = (TOCTree)getItem(position);
	view.setBackgroundColor(tree == mySelectedItem ? 0xff33b5e5 : 0);
	setIcon((ImageView)view.findViewById(R.id.toc_tree_item_icon), tree);
	((TextView)view.findViewById(R.id.toc_tree_item_text)).setText(tree.getText());
	return view;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:11,代码来源:TOCActivity.java

示例13: openBookText

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
void openBookText(TOCTree tree) {
	final TOCTree.Reference reference = tree.getReference();
	if (reference != null) {
		finish();
		final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
		fbreader.addInvisibleBookmark();
		fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0);
		fbreader.showBookTextView();
	}
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:11,代码来源:TOCActivity.java

示例14: runTreeItem

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
@Override
protected boolean runTreeItem(ZLTree<?> tree) {
	if (super.runTreeItem(tree)) {
		return true;
	}
	openBookText((TOCTree)tree);
	return true;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:9,代码来源:TOCActivity.java

示例15: makeProgressText

import org.geometerplus.fbreader.bookmodel.TOCTree; //导入依赖的package包/类
private String makeProgressText(int page, int pagesNumber) {
	final StringBuilder builder = new StringBuilder();
	builder.append(page);
	builder.append("/");
	builder.append(pagesNumber);
	final TOCTree tocElement = getReader().getCurrentTOCElement();
	if (tocElement != null) {
		builder.append("  ");
		builder.append(tocElement.getText());
	}
	return builder.toString();
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:13,代码来源:NavigationPopup.java


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