mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 19:42:17 +02:00
class Library has gone
This commit is contained in:
parent
fda55ae93d
commit
98806a06ec
10 changed files with 19 additions and 57 deletions
|
@ -205,7 +205,7 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createBookContextMenu(ContextMenu menu, Book book) {
|
private void createBookContextMenu(ContextMenu menu, Book book) {
|
||||||
final ZLResource resource = Library.resource();
|
final ZLResource resource = LibraryTree.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());
|
||||||
|
@ -272,7 +272,7 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = Library.resource().getResource("menu").getResource(resourceKey).getValue();
|
final String label = LibraryTree.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);
|
||||||
|
|
|
@ -24,10 +24,6 @@ import android.app.SearchManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.library.Library;
|
|
||||||
|
|
||||||
public class LibrarySearchActivity extends Activity {
|
public class LibrarySearchActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||||
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
|
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
|
||||||
|
@ -36,7 +37,6 @@ import org.geometerplus.zlibrary.text.view.ZLTextPosition;
|
||||||
import org.geometerplus.fbreader.Paths;
|
import org.geometerplus.fbreader.Paths;
|
||||||
import org.geometerplus.fbreader.bookmodel.BookReadingException;
|
import org.geometerplus.fbreader.bookmodel.BookReadingException;
|
||||||
import org.geometerplus.fbreader.formats.*;
|
import org.geometerplus.fbreader.formats.*;
|
||||||
import org.geometerplus.fbreader.library.Library;
|
|
||||||
|
|
||||||
public class Book {
|
public class Book {
|
||||||
public static Book getByFile(ZLFile bookFile) {
|
public static Book getByFile(ZLFile bookFile) {
|
||||||
|
@ -164,7 +164,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 = Library.resource().getResource("demo").getValue();
|
final String demoTag = ZLResource.resource("library").getResource("demo").getValue();
|
||||||
setTitle(getTitle() + " (" + demoTag + ")");
|
setTitle(getTitle() + " (" + demoTag + ")");
|
||||||
addTag(demoTag);
|
addTag(demoTag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class AuthorTree extends LibraryTree {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return Author.NULL.equals(Author)
|
return Author.NULL.equals(Author)
|
||||||
? Library.resource().getResource("unknownAuthor").getValue() : Author.DisplayName;
|
? resource().getResource("unknownAuthor").getValue() : Author.DisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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 = Library.resource().getResource(resourceKey);
|
final ZLResource resource = resource().getResource(resourceKey);
|
||||||
new FileTree(
|
new FileTree(
|
||||||
this,
|
this,
|
||||||
file,
|
file,
|
||||||
|
|
|
@ -28,13 +28,13 @@ abstract 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 = Library.resource().getResource(myId);
|
myResource = resource().getResource(myId);
|
||||||
}
|
}
|
||||||
|
|
||||||
FirstLevelTree(RootTree root, String id) {
|
FirstLevelTree(RootTree root, String id) {
|
||||||
super(root);
|
super(root);
|
||||||
myId = id;
|
myId = id;
|
||||||
myResource = Library.resource().getResource(myId);
|
myResource = resource().getResource(myId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2007-2013 Geometer Plus <contact@geometerplus.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.geometerplus.fbreader.library;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.book.*;
|
|
||||||
import org.geometerplus.fbreader.tree.FBTree;
|
|
||||||
|
|
||||||
public final class Library {
|
|
||||||
public static ZLResource resource() {
|
|
||||||
return ZLResource.resource("library");
|
|
||||||
}
|
|
||||||
|
|
||||||
public final RootTree RootTree;
|
|
||||||
|
|
||||||
public Library(IBookCollection collection) {
|
|
||||||
RootTree = new RootTree(collection);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,10 +21,18 @@ package org.geometerplus.fbreader.library;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.book.*;
|
import org.geometerplus.fbreader.book.*;
|
||||||
import org.geometerplus.fbreader.tree.FBTree;
|
import org.geometerplus.fbreader.tree.FBTree;
|
||||||
|
|
||||||
public abstract class LibraryTree extends FBTree {
|
public abstract class LibraryTree extends FBTree {
|
||||||
|
public static ZLResource resource() {
|
||||||
|
return ZLResource.resource("library");
|
||||||
|
}
|
||||||
|
|
||||||
|
public final IBookCollection Collection;
|
||||||
|
|
||||||
static final String ROOT_FOUND = "found";
|
static final String ROOT_FOUND = "found";
|
||||||
static final String ROOT_FAVORITES = "favorites";
|
static final String ROOT_FAVORITES = "favorites";
|
||||||
static final String ROOT_RECENT = "recent";
|
static final String ROOT_RECENT = "recent";
|
||||||
|
@ -34,8 +42,6 @@ public abstract class LibraryTree extends FBTree {
|
||||||
static final String ROOT_BY_TAG = "byTag";
|
static final String ROOT_BY_TAG = "byTag";
|
||||||
static final String ROOT_FILE_TREE = "fileTree";
|
static final String ROOT_FILE_TREE = "fileTree";
|
||||||
|
|
||||||
public final IBookCollection Collection;
|
|
||||||
|
|
||||||
protected LibraryTree(IBookCollection collection) {
|
protected LibraryTree(IBookCollection collection) {
|
||||||
super();
|
super();
|
||||||
Collection = collection;
|
Collection = collection;
|
||||||
|
|
|
@ -55,12 +55,12 @@ public class RootTree extends LibraryTree {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return Library.resource().getValue();
|
return resource().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return Library.resource().getValue();
|
return resource().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,8 +40,7 @@ public final class TagTree extends LibraryTree {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return Tag.NULL.equals(Tag)
|
return Tag.NULL.equals(Tag) ? resource().getResource("booksWithNoTags").getValue() : Tag.Name;
|
||||||
? Library.resource().getResource("booksWithNoTags").getValue() : Tag.Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue