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

fbreader.library package splitted into fbreader.library & fbreader.book

This commit is contained in:
Nikolay Pultsin 2013-01-13 07:02:44 +04:00
parent a787045fbf
commit 4b10755383
54 changed files with 110 additions and 92 deletions

View file

@ -33,8 +33,8 @@ import org.geometerplus.zlibrary.core.options.ZLStringOption;
import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.android.fbreader.libraryService.*;
import org.geometerplus.android.util.UIUtil;

View file

@ -39,9 +39,9 @@ import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.zlibrary.ui.android.library.*;
import org.geometerplus.zlibrary.ui.android.view.AndroidFontUtil;
import org.geometerplus.fbreader.fbreader.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.fbreader.*;
import org.geometerplus.fbreader.tips.TipsManager;
import org.geometerplus.android.fbreader.api.*;

View file

@ -29,7 +29,7 @@ import org.geometerplus.zlibrary.core.filesystem.ZLPhysicalFile;
import org.geometerplus.zlibrary.core.filetypes.FileTypeCollection;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
public abstract class FBUtil {
public static void shareBook(Activity activity, Book book) {

View file

@ -21,8 +21,8 @@ package org.geometerplus.android.fbreader;
import android.content.Intent;
import org.geometerplus.fbreader.book.SerializerUtil;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
import org.geometerplus.fbreader.library.SerializerUtil;
import org.geometerplus.android.fbreader.library.BookInfoActivity;

View file

@ -22,7 +22,7 @@ package org.geometerplus.android.fbreader;
import android.content.Intent;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
import org.geometerplus.fbreader.library.SerializerUtil;
import org.geometerplus.fbreader.book.SerializerUtil;
class ShowBookmarksAction extends FBAndroidAction {
ShowBookmarksAction(FBReader baseActivity, FBReaderApp fbreader) {

View file

@ -21,9 +21,9 @@ package org.geometerplus.android.fbreader;
import android.content.Intent;
import org.geometerplus.fbreader.book.SerializerUtil;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
import org.geometerplus.fbreader.library.SerializerUtil;
import org.geometerplus.android.fbreader.library.LibraryActivity;

View file

@ -45,7 +45,7 @@ import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.network.HtmlUtil;
import org.geometerplus.android.fbreader.*;
@ -201,7 +201,7 @@ public class BookInfoActivity extends Activity {
coverView.setVisibility(View.GONE);
coverView.setImageDrawable(null);
final ZLImage image = LibraryUtil.getCover(book);
final ZLImage image = BookUtil.getCover(book);
if (image == null) {
return;
@ -275,7 +275,7 @@ public class BookInfoActivity extends Activity {
private void setupAnnotation(Book book) {
final TextView titleView = (TextView)findViewById(R.id.book_info_annotation_title);
final TextView bodyView = (TextView)findViewById(R.id.book_info_annotation_body);
final String annotation = LibraryUtil.getAnnotation(book);
final String annotation = BookUtil.getAnnotation(book);
if (annotation == null) {
titleView.setVisibility(View.GONE);
bodyView.setVisibility(View.GONE);

View file

@ -35,6 +35,7 @@ import org.geometerplus.zlibrary.core.util.MimeType;
import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.tree.FBTree;
@ -196,7 +197,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
}
private void createBookContextMenu(ContextMenu menu, Book book) {
final ZLResource resource = LibraryUtil.resource();
final ZLResource resource = Library.resource();
menu.setHeaderTitle(book.getTitle());
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());
@ -269,7 +270,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
}
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);
item.setOnMenuItemClickListener(this);
item.setIcon(iconId);

View file

@ -35,7 +35,7 @@ import org.geometerplus.zlibrary.core.config.ZLConfig;
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
import org.geometerplus.zlibrary.text.view.ZLTextFixedPosition;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.android.util.UIUtil;
import org.geometerplus.android.util.SQLiteUtil;

View file

@ -28,7 +28,7 @@ import android.os.RemoteException;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.book.*;
public class BookCollectionShadow implements IBookCollection, ServiceConnection {
private final Context myContext;

View file

@ -29,7 +29,7 @@ import android.os.FileObserver;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.android.fbreader.library.SQLiteBooksDatabase;

View file

@ -31,8 +31,8 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.library.SerializerUtil;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.SerializerUtil;
import org.geometerplus.fbreader.formats.FormatPlugin;
import org.geometerplus.fbreader.bookmodel.BookReadingException;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
abstract class AbstractSerializer {
public abstract String serialize(Book book);

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
public final class Author {
public final String DisplayName;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
@ -33,8 +33,9 @@ import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
import org.geometerplus.fbreader.formats.*;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.formats.*;
import org.geometerplus.fbreader.library.Library;
import org.geometerplus.fbreader.Paths;
@ -114,7 +115,7 @@ public class Book {
}
final String demoPathPrefix = Paths.mainBookDirectory() + "/Demos/";
if (File.getPath().startsWith(demoPathPrefix)) {
final String demoTag = LibraryUtil.resource().getResource("demo").getValue();
final String demoTag = Library.resource().getResource("demo").getValue();
setTitle(getTitle() + " (" + demoTag + ")");
addTag(demoTag);
}
@ -300,7 +301,7 @@ public class Book {
addTag(Tag.getTag(null, tagName));
}
boolean matches(String pattern) {
public boolean matches(String pattern) {
if (myTitle != null && ZLMiscUtil.matchesIgnoreCase(myTitle, pattern)) {
return true;
}

View file

@ -17,13 +17,12 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.io.File;
import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.filesystem.ZLPhysicalFile;
import org.geometerplus.zlibrary.core.filesystem.*;
import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
@ -360,7 +359,7 @@ public class BookCollection implements IBookCollection {
// Step 4: add help file
try {
final ZLFile helpFile = Library.getHelpFile();
final ZLFile helpFile = getHelpFile();
Book helpBook = savedBooksByFileId.get(fileInfos.getId(helpFile));
if (helpBook == null) {
helpBook = new Book(helpFile);
@ -481,4 +480,24 @@ public class BookCollection implements IBookCollection {
BooksDatabase.Instance().deleteBookmark(bookmark);
}
}
public static ZLResourceFile getHelpFile() {
final Locale locale = Locale.getDefault();
ZLResourceFile file = ZLResourceFile.createResourceFile(
"data/help/MiniHelp." + locale.getLanguage() + "_" + locale.getCountry() + ".fb2"
);
if (file.exists()) {
return file;
}
file = ZLResourceFile.createResourceFile(
"data/help/MiniHelp." + locale.getLanguage() + ".fb2"
);
if (file.exists()) {
return file;
}
return ZLResourceFile.createResourceFile("data/help/MiniHelp.en.fb2");
}
}

View file

@ -17,20 +17,15 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.fbreader.formats.FormatPlugin;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
public abstract class LibraryUtil {
public static ZLResource resource() {
return ZLResource.resource("library");
}
public abstract class BookUtil {
public static ZLImage getCover(Book book) {
return book != null ? book.getCover() : null;
}

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.*;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.*;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import org.geometerplus.zlibrary.core.tree.ZLTree;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.*;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.List;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.*;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.math.BigDecimal;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.HashMap;

View file

@ -17,7 +17,7 @@
* 02110-1301, USA.
*/
package org.geometerplus.fbreader.library;
package org.geometerplus.fbreader.book;
import java.util.*;
import java.text.DateFormat;

View file

@ -23,7 +23,7 @@ import java.util.List;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.formats.FormatPlugin;
public abstract class BookModel {

View file

@ -25,7 +25,7 @@ import org.geometerplus.zlibrary.core.image.*;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
abstract class BookModelImpl extends BookModel {
protected CharStorage myInternalHyperlinks;

View file

@ -23,8 +23,8 @@ import org.geometerplus.zlibrary.core.image.*;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.book.Book;
public class JavaBookModel extends BookModelImpl {
public final ZLTextModel BookTextModel;

View file

@ -23,7 +23,7 @@ import java.util.ArrayList;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
public class NativeBookModel extends BookModelImpl {
private ZLTextModel myBookTextModel;

View file

@ -31,10 +31,8 @@ import org.geometerplus.zlibrary.core.util.ZLColor;
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
import org.geometerplus.zlibrary.text.view.*;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.bookmodel.TOCTree;
import org.geometerplus.fbreader.library.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.bookmodel.*;
public final class FBReaderApp extends ZLApplication {
public final ZLBooleanOption AllowScreenBrightnessAdjustmentOption =
@ -236,7 +234,7 @@ public final class FBReaderApp extends ZLApplication {
if (book == null) {
book = Collection.getRecentBook(0);
if (book == null || !book.File.exists()) {
book = Collection.getBookByFile(Library.getHelpFile());
book = Collection.getBookByFile(BookCollection.getHelpFile());
}
if (book == null) {
return;

View file

@ -23,9 +23,9 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.encodings.EncodingCollection;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book;
public abstract class FormatPlugin {
private final String myFileType;

View file

@ -19,7 +19,7 @@
package org.geometerplus.fbreader.formats;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
public abstract class JavaFormatPlugin extends FormatPlugin {
protected JavaFormatPlugin(String fileType) {

View file

@ -25,9 +25,9 @@ import org.geometerplus.zlibrary.core.encodings.JavaEncodingCollection;
import org.geometerplus.zlibrary.core.image.*;
import org.geometerplus.zlibrary.core.util.MimeType;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.formats.fb2.FB2NativePlugin;
import org.geometerplus.fbreader.formats.oeb.OEBNativePlugin;

View file

@ -25,9 +25,9 @@ import java.io.IOException;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.xml.*;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.Tag;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.library.Tag;
public class FB2MetaInfoReader extends ZLXMLReaderAdapter {
private final static int READ_NOTHING = 0;

View file

@ -24,9 +24,9 @@ import org.geometerplus.zlibrary.core.encodings.AutoEncodingCollection;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.formats.NativeFormatPlugin;
import org.geometerplus.fbreader.library.Book;
public class FB2NativePlugin extends NativeFormatPlugin {
public FB2NativePlugin() {

View file

@ -23,9 +23,9 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.encodings.AutoEncodingCollection;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.formats.JavaFormatPlugin;
public class FB2Plugin extends JavaFormatPlugin {

View file

@ -24,7 +24,7 @@ import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
import org.geometerplus.zlibrary.core.xml.*;
import org.geometerplus.fbreader.library.Tag;
import org.geometerplus.fbreader.book.Tag;
abstract class FB2TagManager {
private static final HashMap<String,ArrayList<Tag>> ourMap = new HashMap<String,ArrayList<Tag>>();

View file

@ -26,7 +26,7 @@ import org.geometerplus.zlibrary.core.constants.XMLNamespaces;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.xml.*;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
class OEBMetaInfoReader extends ZLXMLReaderAdapter implements XMLNamespaces {

View file

@ -27,10 +27,10 @@ import org.geometerplus.zlibrary.core.encodings.AutoEncodingCollection;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.formats.NativeFormatPlugin;
import org.geometerplus.fbreader.library.Book;
public class OEBNativePlugin extends NativeFormatPlugin {
public OEBNativePlugin() {

View file

@ -23,9 +23,9 @@ import org.geometerplus.zlibrary.core.filesystem.*;
import org.geometerplus.zlibrary.core.encodings.AutoEncodingCollection;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.formats.JavaFormatPlugin;
public class OEBPlugin extends JavaFormatPlugin {

View file

@ -28,7 +28,7 @@ import org.geometerplus.zlibrary.core.encodings.JavaEncodingCollection;
import org.geometerplus.zlibrary.core.language.ZLLanguageUtil;
import org.geometerplus.zlibrary.core.util.MimeType;
import org.geometerplus.fbreader.library.Book;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.formats.JavaFormatPlugin;

View file

@ -19,6 +19,9 @@
package org.geometerplus.fbreader.library;
import org.geometerplus.fbreader.book.Author;
import org.geometerplus.fbreader.book.Book;
public class AuthorTree extends LibraryTree {
public final Author Author;
@ -36,7 +39,7 @@ public class AuthorTree extends LibraryTree {
return
Author != null ?
Author.DisplayName :
LibraryUtil.resource().getResource("unknownAuthor").getValue();
Library.resource().getResource("unknownAuthor").getValue();
}
@Override

View file

@ -21,6 +21,7 @@ package org.geometerplus.fbreader.library;
import java.math.BigDecimal;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.tree.FBTree;
public final class BookInSeriesTree extends BookTree {

View file

@ -21,6 +21,7 @@ package org.geometerplus.fbreader.library;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.tree.FBTree;
public class BookTree extends LibraryTree {
@ -80,7 +81,7 @@ public class BookTree extends LibraryTree {
@Override
protected ZLImage createCover() {
return LibraryUtil.getCover(Book);
return BookUtil.getCover(Book);
}
@Override

View file

@ -23,6 +23,7 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.book.IBookCollection;
public class FileFirstLevelTree extends FirstLevelTree {
private final IBookCollection myCollection;
@ -38,7 +39,7 @@ public class FileFirstLevelTree extends FirstLevelTree {
private void addChild(String path, String resourceKey) {
final ZLFile file = ZLFile.createFileByPath(path);
if (file != null) {
final ZLResource resource = LibraryUtil.resource().getResource(resourceKey);
final ZLResource resource = Library.resource().getResource(resourceKey);
new FileTree(
this,
myCollection,

View file

@ -24,6 +24,9 @@ import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.BookUtil;
import org.geometerplus.fbreader.book.IBookCollection;
import org.geometerplus.fbreader.formats.PluginCollection;
import org.geometerplus.fbreader.tree.FBTree;
@ -88,7 +91,7 @@ public class FileTree extends LibraryTree {
@Override
public ZLImage createCover() {
return LibraryUtil.getCover(getBook());
return BookUtil.getCover(getBook());
}
public ZLFile getFile() {

View file

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

View file

@ -22,10 +22,16 @@ package org.geometerplus.fbreader.library;
import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.*;
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");
}
private final List<ChangeListener> myListeners = Collections.synchronizedList(new LinkedList<ChangeListener>());
public interface ChangeListener {
@ -150,26 +156,6 @@ public final class Library {
return parentTree != null ? (LibraryTree)parentTree.getSubTree(key.Id) : null;
}
public static ZLResourceFile getHelpFile() {
final Locale locale = Locale.getDefault();
ZLResourceFile file = ZLResourceFile.createResourceFile(
"data/help/MiniHelp." + locale.getLanguage() + "_" + locale.getCountry() + ".fb2"
);
if (file.exists()) {
return file;
}
file = ZLResourceFile.createResourceFile(
"data/help/MiniHelp." + locale.getLanguage() + ".fb2"
);
if (file.exists()) {
return file;
}
return ZLResourceFile.createResourceFile("data/help/MiniHelp.en.fb2");
}
private final List<?> myNullList = Collections.singletonList(null);
private LibraryTree getTagTree(Tag tag) {

View file

@ -21,6 +21,7 @@ package org.geometerplus.fbreader.library;
import java.util.*;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.tree.FBTree;
public abstract class LibraryTree extends FBTree {

View file

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

View file

@ -21,6 +21,9 @@ package org.geometerplus.fbreader.library;
import java.util.Collections;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.SeriesInfo;
public final class SeriesTree extends LibraryTree {
public final String Series;

View file

@ -19,6 +19,9 @@
package org.geometerplus.fbreader.library;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.Tag;
public final class TagTree extends LibraryTree {
public final Tag Tag;
@ -34,7 +37,7 @@ public final class TagTree extends LibraryTree {
@Override
public String getName() {
return Tag != null
? Tag.Name : LibraryUtil.resource().getResource("booksWithNoTags").getValue();
? Tag.Name : Library.resource().getResource("booksWithNoTags").getValue();
}
@Override

View file

@ -19,6 +19,8 @@
package org.geometerplus.fbreader.library;
import org.geometerplus.fbreader.book.Book;
public final class TitleTree extends LibraryTree {
static String firstTitleLetter(Book book) {
if (book == null) {