1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

synchronization with library-service branch

This commit is contained in:
Nikolay Pultsin 2013-01-14 04:49:48 +04:00
parent fbec1dc704
commit 8b9530c36b
9 changed files with 14 additions and 14 deletions

View file

@ -188,7 +188,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
} }
private void createBookContextMenu(ContextMenu menu, Book book) { private void createBookContextMenu(ContextMenu menu, Book book) {
final ZLResource resource = LibraryUtil.resource(); final ZLResource resource = Library.resource();
menu.setHeaderTitle(book.getTitle()); menu.setHeaderTitle(book.getTitle());
menu.add(0, OPEN_BOOK_ITEM_ID, 0, resource.getResource("openBook").getValue()); menu.add(0, OPEN_BOOK_ITEM_ID, 0, resource.getResource("openBook").getValue());
menu.add(0, SHOW_BOOK_INFO_ITEM_ID, 0, resource.getResource("showBookInfo").getValue()); menu.add(0, SHOW_BOOK_INFO_ITEM_ID, 0, resource.getResource("showBookInfo").getValue());
@ -261,7 +261,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
} }
private MenuItem addMenuItem(Menu menu, int index, String resourceKey, int iconId) { private MenuItem addMenuItem(Menu menu, int index, String resourceKey, int iconId) {
final String label = LibraryUtil.resource().getResource("menu").getResource(resourceKey).getValue(); final String label = Library.resource().getResource("menu").getResource(resourceKey).getValue();
final MenuItem item = menu.add(0, index, Menu.NONE, label); final MenuItem item = menu.add(0, index, Menu.NONE, label);
item.setOnMenuItemClickListener(this); item.setOnMenuItemClickListener(this);
item.setIcon(iconId); item.setIcon(iconId);

View file

@ -38,7 +38,7 @@ public class AuthorTree extends LibraryTree {
return return
Author != null ? Author != null ?
Author.DisplayName : Author.DisplayName :
LibraryUtil.resource().getResource("unknownAuthor").getValue(); Library.resource().getResource("unknownAuthor").getValue();
} }
@Override @Override

View file

@ -190,7 +190,7 @@ public class Book {
} }
final String demoPathPrefix = Paths.mainBookDirectory() + "/Demos/"; final String demoPathPrefix = Paths.mainBookDirectory() + "/Demos/";
if (File.getPath().startsWith(demoPathPrefix)) { if (File.getPath().startsWith(demoPathPrefix)) {
final String demoTag = LibraryUtil.resource().getResource("demo").getValue(); final String demoTag = Library.resource().getResource("demo").getValue();
setTitle(getTitle() + " (" + demoTag + ")"); setTitle(getTitle() + " (" + demoTag + ")");
addTag(demoTag); addTag(demoTag);
} }

View file

@ -35,7 +35,7 @@ public class FileFirstLevelTree extends FirstLevelTree {
private void addChild(String path, String resourceKey) { private void addChild(String path, String resourceKey) {
final ZLFile file = ZLFile.createFileByPath(path); final ZLFile file = ZLFile.createFileByPath(path);
if (file != null) { if (file != null) {
final ZLResource resource = LibraryUtil.resource().getResource(resourceKey); final ZLResource resource = Library.resource().getResource(resourceKey);
new FileTree( new FileTree(
this, this,
file, file,

View file

@ -28,13 +28,13 @@ public class FirstLevelTree extends LibraryTree {
FirstLevelTree(RootTree root, int position, String id) { FirstLevelTree(RootTree root, int position, String id) {
super(root, position); super(root, position);
myId = id; myId = id;
myResource = LibraryUtil.resource().getResource(myId); myResource = Library.resource().getResource(myId);
} }
FirstLevelTree(RootTree root, String id) { FirstLevelTree(RootTree root, String id) {
super(root); super(root);
myId = id; myId = id;
myResource = LibraryUtil.resource().getResource(myId); myResource = Library.resource().getResource(myId);
} }
@Override @Override

View file

@ -23,6 +23,7 @@ import java.io.File;
import java.util.*; import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.*; import org.geometerplus.zlibrary.core.filesystem.*;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.fbreader.Paths; import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.book.*; import org.geometerplus.fbreader.book.*;
@ -30,6 +31,10 @@ import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.tree.FBTree; import org.geometerplus.fbreader.tree.FBTree;
public final class Library extends AbstractLibrary { public final class Library extends AbstractLibrary {
public static ZLResource resource() {
return ZLResource.resource("library");
}
public static final String ROOT_FOUND = "found"; public static final String ROOT_FOUND = "found";
public static final String ROOT_FAVORITES = "favorites"; public static final String ROOT_FAVORITES = "favorites";
public static final String ROOT_RECENT = "recent"; public static final String ROOT_RECENT = "recent";

View file

@ -21,16 +21,11 @@ package org.geometerplus.fbreader.library;
import org.geometerplus.zlibrary.core.filesystem.ZLFile; import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.image.ZLImage; import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.fbreader.formats.FormatPlugin; import org.geometerplus.fbreader.formats.FormatPlugin;
import org.geometerplus.fbreader.bookmodel.BookReadingException; import org.geometerplus.fbreader.bookmodel.BookReadingException;
public abstract class LibraryUtil { public abstract class LibraryUtil {
public static ZLResource resource() {
return ZLResource.resource("library");
}
public static ZLImage getCover(Book book) { public static ZLImage getCover(Book book) {
return book != null ? book.getCover() : null; return book != null ? book.getCover() : null;
} }

View file

@ -25,7 +25,7 @@ class RootTree extends LibraryTree {
@Override @Override
public String getName() { public String getName() {
return LibraryUtil.resource().getValue(); return Library.resource().getValue();
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public final class TagTree extends LibraryTree {
@Override @Override
public String getName() { public String getName() {
return Tag != null return Tag != null
? Tag.Name : LibraryUtil.resource().getResource("booksWithNoTags").getValue(); ? Tag.Name : Library.resource().getResource("booksWithNoTags").getValue();
} }
@Override @Override