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

renaming: NetworkLibraryItem -> NetworkItem

This commit is contained in:
Nikolay Pultsin 2011-03-06 13:19:08 +00:00
parent 5dad452668
commit 247e6937ad
25 changed files with 85 additions and 85 deletions

View file

@ -29,7 +29,7 @@ import android.os.Message;
import android.os.Handler; import android.os.Handler;
import org.geometerplus.fbreader.network.INetworkLink; import org.geometerplus.fbreader.network.INetworkLink;
import org.geometerplus.fbreader.network.NetworkLibraryItem; import org.geometerplus.fbreader.network.NetworkItem;
abstract class ItemsLoadingHandler extends Handler { abstract class ItemsLoadingHandler extends Handler {
@ -37,20 +37,20 @@ abstract class ItemsLoadingHandler extends Handler {
private static final int WHAT_UPDATE_ITEMS = 0; private static final int WHAT_UPDATE_ITEMS = 0;
private static final int WHAT_FINISHED = 1; private static final int WHAT_FINISHED = 1;
private final LinkedList<NetworkLibraryItem> myItems = new LinkedList<NetworkLibraryItem>(); private final LinkedList<NetworkItem> myItems = new LinkedList<NetworkItem>();
private final HashMap<INetworkLink, LinkedList<NetworkLibraryItem>> myUncommitedItems = new HashMap<INetworkLink, LinkedList<NetworkLibraryItem>>(); private final HashMap<INetworkLink, LinkedList<NetworkItem>> myUncommitedItems = new HashMap<INetworkLink, LinkedList<NetworkItem>>();
private final Object myItemsMonitor = new Object(); private final Object myItemsMonitor = new Object();
private volatile boolean myFinishProcessed; private volatile boolean myFinishProcessed;
private final Object myFinishMonitor = new Object(); private final Object myFinishMonitor = new Object();
public final void addItem(INetworkLink link, NetworkLibraryItem item) { public final void addItem(INetworkLink link, NetworkItem item) {
synchronized (myItemsMonitor) { synchronized (myItemsMonitor) {
myItems.add(item); myItems.add(item);
LinkedList<NetworkLibraryItem> uncommited = myUncommitedItems.get(link); LinkedList<NetworkItem> uncommited = myUncommitedItems.get(link);
if (uncommited == null) { if (uncommited == null) {
uncommited = new LinkedList<NetworkLibraryItem>(); uncommited = new LinkedList<NetworkItem>();
myUncommitedItems.put(link, uncommited); myUncommitedItems.put(link, uncommited);
} }
uncommited.add(item); uncommited.add(item);
@ -59,7 +59,7 @@ abstract class ItemsLoadingHandler extends Handler {
public final void commitItems(INetworkLink link) { public final void commitItems(INetworkLink link) {
synchronized (myItemsMonitor) { synchronized (myItemsMonitor) {
LinkedList<NetworkLibraryItem> uncommited = myUncommitedItems.get(link); LinkedList<NetworkItem> uncommited = myUncommitedItems.get(link);
if (uncommited != null) { if (uncommited != null) {
uncommited.clear(); uncommited.clear();
} }
@ -98,9 +98,9 @@ abstract class ItemsLoadingHandler extends Handler {
} }
private final void doProcessFinish(String errorMessage, boolean interrupted) { private final void doProcessFinish(String errorMessage, boolean interrupted) {
HashSet<NetworkLibraryItem> uncommitedItems = new HashSet<NetworkLibraryItem>(); HashSet<NetworkItem> uncommitedItems = new HashSet<NetworkItem>();
synchronized (myUncommitedItems) { synchronized (myUncommitedItems) {
for (LinkedList<NetworkLibraryItem> items: myUncommitedItems.values()) { for (LinkedList<NetworkItem> items: myUncommitedItems.values()) {
uncommitedItems.addAll(items); uncommitedItems.addAll(items);
} }
} }
@ -124,9 +124,9 @@ abstract class ItemsLoadingHandler extends Handler {
// callbacks // callbacks
public abstract void onUpdateItems(List<NetworkLibraryItem> items); public abstract void onUpdateItems(List<NetworkItem> items);
public abstract void afterUpdateItems(); public abstract void afterUpdateItems();
public abstract void onFinish(String errorMessage, boolean interrupted, Set<NetworkLibraryItem> uncommitedItems); public abstract void onFinish(String errorMessage, boolean interrupted, Set<NetworkItem> uncommitedItems);
@Override @Override

View file

@ -26,7 +26,7 @@ import org.geometerplus.zlibrary.core.network.ZLNetworkException;
import org.geometerplus.fbreader.network.INetworkLink; import org.geometerplus.fbreader.network.INetworkLink;
import org.geometerplus.fbreader.network.NetworkOperationData; import org.geometerplus.fbreader.network.NetworkOperationData;
import org.geometerplus.fbreader.network.NetworkLibraryItem; import org.geometerplus.fbreader.network.NetworkItem;
abstract class ItemsLoadingRunnable implements Runnable { abstract class ItemsLoadingRunnable implements Runnable {
private final ItemsLoadingHandler myHandler; private final ItemsLoadingHandler myHandler;
@ -99,7 +99,7 @@ abstract class ItemsLoadingRunnable implements Runnable {
doLoading(new NetworkOperationData.OnNewItemListener() { doLoading(new NetworkOperationData.OnNewItemListener() {
private long myUpdateTime; private long myUpdateTime;
private int myItemsNumber; private int myItemsNumber;
public void onNewItem(INetworkLink link, NetworkLibraryItem item) { public void onNewItem(INetworkLink link, NetworkItem item) {
myHandler.addItem(link, item); myHandler.addItem(link, item);
++myItemsNumber; ++myItemsNumber;
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();

View file

@ -295,8 +295,8 @@ class NetworkCatalogActions extends NetworkTreeActions {
} }
@Override @Override
public void onUpdateItems(List<NetworkLibraryItem> items) { public void onUpdateItems(List<NetworkItem> items) {
for (NetworkLibraryItem item: items) { for (NetworkItem item: items) {
myTree.ChildrenItems.add(item); myTree.ChildrenItems.add(item);
NetworkTreeFactory.createNetworkTree(myTree, item); NetworkTreeFactory.createNetworkTree(myTree, item);
} }
@ -311,7 +311,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
@Override @Override
public void onFinish(String errorMessage, boolean interrupted, public void onFinish(String errorMessage, boolean interrupted,
Set<NetworkLibraryItem> uncommitedItems) { Set<NetworkItem> uncommitedItems) {
if (interrupted && if (interrupted &&
(!myTree.Item.supportsResumeLoading() || errorMessage != null)) { (!myTree.Item.supportsResumeLoading() || errorMessage != null)) {
myTree.ChildrenItems.clear(); myTree.ChildrenItems.clear();

View file

@ -62,9 +62,9 @@ public class NetworkSearchActivity extends Activity {
} }
@Override @Override
public void onUpdateItems(List<NetworkLibraryItem> items) { public void onUpdateItems(List<NetworkItem> items) {
SearchResult result = myTree.getSearchResult(); SearchResult result = myTree.getSearchResult();
for (NetworkLibraryItem item: items) { for (NetworkItem item: items) {
if (item instanceof NetworkBookItem) { if (item instanceof NetworkBookItem) {
result.addBook((NetworkBookItem)item); result.addBook((NetworkBookItem)item);
} }
@ -81,7 +81,7 @@ public class NetworkSearchActivity extends Activity {
@Override @Override
public void onFinish(String errorMessage, boolean interrupted, public void onFinish(String errorMessage, boolean interrupted,
Set<NetworkLibraryItem> uncommitedItems) { Set<NetworkItem> uncommitedItems) {
if (interrupted) { if (interrupted) {
myTree.setSearchResult(null); myTree.setSearchResult(null);
} else { } else {

View file

@ -88,7 +88,7 @@ class NetworkView {
} }
/* /*
* NetworkLibraryItem's actions * NetworkItem's actions
*/ */
public RefillAccountActions getTopUpActions() { public RefillAccountActions getTopUpActions() {

View file

@ -25,7 +25,7 @@ import java.io.File;
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager; import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
public final class NetworkBookItem extends NetworkLibraryItem { public final class NetworkBookItem extends NetworkItem {
public static class AuthorData implements Comparable<AuthorData> { public static class AuthorData implements Comparable<AuthorData> {
public final String DisplayName; public final String DisplayName;
@ -80,7 +80,7 @@ public final class NetworkBookItem extends NetworkLibraryItem {
private final LinkedList<BookReference> myReferences; private final LinkedList<BookReference> myReferences;
/** /**
* Creates new NetworkLibraryItem instance. * Creates new NetworkItem instance.
* *
* @param link corresponding NetworkLink object. Must be not <code>null</code>. * @param link corresponding NetworkLink object. Must be not <code>null</code>.
* @param id string that uniquely identifies this book item. Must be not <code>null</code>. * @param id string that uniquely identifies this book item. Must be not <code>null</code>.

View file

@ -22,8 +22,8 @@ package org.geometerplus.fbreader.network;
import java.util.Comparator; import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
public final class NetworkBookItemComparator implements Comparator<NetworkLibraryItem> { public final class NetworkBookItemComparator implements Comparator<NetworkItem> {
public int compare(NetworkLibraryItem item0, NetworkLibraryItem item1) { public int compare(NetworkItem item0, NetworkItem item1) {
final boolean item0isABook = item0 instanceof NetworkBookItem; final boolean item0isABook = item0 instanceof NetworkBookItem;
final boolean item1isABook = item1 instanceof NetworkBookItem; final boolean item1isABook = item1 instanceof NetworkBookItem;

View file

@ -28,7 +28,7 @@ import org.geometerplus.zlibrary.core.network.ZLNetworkRequest;
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager; import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
public abstract class NetworkCatalogItem extends NetworkLibraryItem { public abstract class NetworkCatalogItem extends NetworkItem {
// catalog types: // catalog types:
public static enum CatalogType { public static enum CatalogType {

View file

@ -19,7 +19,7 @@
package org.geometerplus.fbreader.network; package org.geometerplus.fbreader.network;
public abstract class NetworkLibraryItem { public abstract class NetworkItem {
public final INetworkLink Link; public final INetworkLink Link;
public final String Title; public final String Title;
public final String Summary; public final String Summary;
@ -28,14 +28,14 @@ public abstract class NetworkLibraryItem {
//public org.geometerplus.fbreader.network.atom.ATOMEntry dbgEntry; //public org.geometerplus.fbreader.network.atom.ATOMEntry dbgEntry;
/** /**
* Creates new NetworkLibraryItem instance. * Creates new NetworkItem instance.
* *
* @param link corresponding NetworkLink object. Must be not <code>null</code>. * @param link corresponding NetworkLink object. Must be not <code>null</code>.
* @param title title of this library item. Must be not <code>null</code>. * @param title title of this library item. Must be not <code>null</code>.
* @param summary description of this library item. Can be <code>null</code>. * @param summary description of this library item. Can be <code>null</code>.
* @param cover cover url. Can be <code>null</code>. * @param cover cover url. Can be <code>null</code>.
*/ */
protected NetworkLibraryItem(INetworkLink link, String title, String summary, String cover) { protected NetworkItem(INetworkLink link, String title, String summary, String cover) {
Link = link; Link = link;
Title = title; Title = title;
Summary = summary; Summary = summary;

View file

@ -429,7 +429,7 @@ public class NetworkLibrary {
LinkedList<NetworkOperationData> dataList = new LinkedList<NetworkOperationData>(); LinkedList<NetworkOperationData> dataList = new LinkedList<NetworkOperationData>();
final NetworkOperationData.OnNewItemListener synchronizedListener = new NetworkOperationData.OnNewItemListener() { final NetworkOperationData.OnNewItemListener synchronizedListener = new NetworkOperationData.OnNewItemListener() {
public synchronized void onNewItem(INetworkLink link, NetworkLibraryItem item) { public synchronized void onNewItem(INetworkLink link, NetworkItem item) {
listener.onNewItem(link, item); listener.onNewItem(link, item);
} }
public synchronized boolean confirmInterrupt() { public synchronized boolean confirmInterrupt() {

View file

@ -25,7 +25,7 @@ import org.geometerplus.zlibrary.core.network.ZLNetworkRequest;
public class NetworkOperationData { public class NetworkOperationData {
public interface OnNewItemListener { public interface OnNewItemListener {
void onNewItem(INetworkLink link, NetworkLibraryItem item); void onNewItem(INetworkLink link, NetworkItem item);
void commitItems(INetworkLink link); void commitItems(INetworkLink link);

View file

@ -77,7 +77,7 @@ public abstract class NetworkTree extends FBTree {
super(parent, position); super(parent, position);
} }
public static ZLImage createCover(NetworkLibraryItem item) { public static ZLImage createCover(NetworkItem item) {
if (item.Cover == null) { if (item.Cover == null) {
return null; return null;
} }
@ -121,7 +121,7 @@ public abstract class NetworkTree extends FBTree {
} }
public abstract NetworkLibraryItem getHoldedItem(); public abstract NetworkItem getHoldedItem();
private Key myKey; private Key myKey;
/** /**
@ -146,13 +146,13 @@ public abstract class NetworkTree extends FBTree {
*/ */
protected abstract String getStringId(); protected abstract String getStringId();
public void removeItems(Set<NetworkLibraryItem> items) { public void removeItems(Set<NetworkItem> items) {
if (items.isEmpty() || subTrees().isEmpty()) { if (items.isEmpty() || subTrees().isEmpty()) {
return; return;
} }
final LinkedList<FBTree> treesList = new LinkedList<FBTree>(); final LinkedList<FBTree> treesList = new LinkedList<FBTree>();
for (FBTree tree: subTrees()) { for (FBTree tree: subTrees()) {
final NetworkLibraryItem treeItem = ((NetworkTree)tree).getHoldedItem(); final NetworkItem treeItem = ((NetworkTree)tree).getHoldedItem();
if (treeItem != null && items.contains(treeItem)) { if (treeItem != null && items.contains(treeItem)) {
treesList.add(tree); treesList.add(tree);
items.remove(treeItem); items.remove(treeItem);

View file

@ -21,7 +21,7 @@ package org.geometerplus.fbreader.network;
import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.zlibrary.core.resources.ZLResource;
public class TopUpItem extends NetworkLibraryItem { public class TopUpItem extends NetworkItem {
public TopUpItem(INetworkLink link, String cover) { public TopUpItem(INetworkLink link, String cover) {
super( super(
link, link,

View file

@ -39,7 +39,7 @@ public class LitResAuthenticationManager extends NetworkAuthenticationManager {
private String myInitializedDataSid; private String myInitializedDataSid;
private String myAccount; private String myAccount;
private final HashMap<String, NetworkLibraryItem> myPurchasedBooks = new HashMap<String, NetworkLibraryItem>(); private final HashMap<String, NetworkItem> myPurchasedBooks = new HashMap<String, NetworkItem>();
public LitResAuthenticationManager(INetworkLink link, String sslCertificate) { public LitResAuthenticationManager(INetworkLink link, String sslCertificate) {
super(link, sslCertificate); super(link, sslCertificate);
@ -352,7 +352,7 @@ public class LitResAuthenticationManager extends NetworkAuthenticationManager {
return new LitResNetworkRequest( return new LitResNetworkRequest(
LitResUtil.url(Link, query), LitResUtil.url(Link, query),
SSLCertificate, SSLCertificate,
new LitResXMLReader(Link, new LinkedList<NetworkLibraryItem>()) new LitResXMLReader(Link, new LinkedList<NetworkItem>())
); );
} }
@ -363,7 +363,7 @@ public class LitResAuthenticationManager extends NetworkAuthenticationManager {
private void loadPurchasedBooksOnSuccess(LitResNetworkRequest purchasedBooksRequest) { private void loadPurchasedBooksOnSuccess(LitResNetworkRequest purchasedBooksRequest) {
LitResXMLReader reader = (LitResXMLReader)purchasedBooksRequest.Reader; LitResXMLReader reader = (LitResXMLReader)purchasedBooksRequest.Reader;
myPurchasedBooks.clear(); myPurchasedBooks.clear();
for (NetworkLibraryItem item: reader.Books) { for (NetworkItem item: reader.Books) {
if (item instanceof NetworkBookItem) { if (item instanceof NetworkBookItem) {
NetworkBookItem book = (NetworkBookItem)item; NetworkBookItem book = (NetworkBookItem)item;
myPurchasedBooks.put(book.Id, book); myPurchasedBooks.put(book.Id, book);

View file

@ -27,16 +27,16 @@ import org.geometerplus.zlibrary.core.network.ZLNetworkException;
import org.geometerplus.fbreader.network.*; import org.geometerplus.fbreader.network.*;
abstract class SortedCatalogItem extends NetworkCatalogItem { abstract class SortedCatalogItem extends NetworkCatalogItem {
private final List<NetworkLibraryItem> myChildren = new LinkedList<NetworkLibraryItem>(); private final List<NetworkItem> myChildren = new LinkedList<NetworkItem>();
private SortedCatalogItem(NetworkCatalogItem parent, ZLResource resource, List<NetworkLibraryItem> children) { private SortedCatalogItem(NetworkCatalogItem parent, ZLResource resource, List<NetworkItem> children) {
super(parent.Link, resource.getValue(), resource.getResource("summary").getValue(), "", parent.URLByType); super(parent.Link, resource.getValue(), resource.getResource("summary").getValue(), "", parent.URLByType);
for (NetworkLibraryItem child : children) { for (NetworkItem child : children) {
if (accepts(child)) { if (accepts(child)) {
myChildren.add(child); myChildren.add(child);
} }
} }
final Comparator<NetworkLibraryItem> comparator = getComparator(); final Comparator<NetworkItem> comparator = getComparator();
if (comparator != null) { if (comparator != null) {
Collections.sort(myChildren, comparator); Collections.sort(myChildren, comparator);
} }
@ -46,12 +46,12 @@ abstract class SortedCatalogItem extends NetworkCatalogItem {
return myChildren.isEmpty(); return myChildren.isEmpty();
} }
protected abstract Comparator<NetworkLibraryItem> getComparator(); protected abstract Comparator<NetworkItem> getComparator();
protected boolean accepts(NetworkLibraryItem item) { protected boolean accepts(NetworkItem item) {
return item instanceof NetworkBookItem; return item instanceof NetworkBookItem;
} }
public SortedCatalogItem(NetworkCatalogItem parent, String resourceKey, List<NetworkLibraryItem> children) { public SortedCatalogItem(NetworkCatalogItem parent, String resourceKey, List<NetworkItem> children) {
this(parent, ZLResource.resource("networkView").getResource(resourceKey), children); this(parent, ZLResource.resource("networkView").getResource(resourceKey), children);
} }
@ -61,7 +61,7 @@ abstract class SortedCatalogItem extends NetworkCatalogItem {
@Override @Override
public void loadChildren(NetworkOperationData.OnNewItemListener listener) throws ZLNetworkException { public void loadChildren(NetworkOperationData.OnNewItemListener listener) throws ZLNetworkException {
for (NetworkLibraryItem child : myChildren) { for (NetworkItem child : myChildren) {
listener.onNewItem(Link, child); listener.onNewItem(Link, child);
} }
listener.commitItems(Link); listener.commitItems(Link);
@ -69,25 +69,25 @@ abstract class SortedCatalogItem extends NetworkCatalogItem {
} }
class ByAuthorCatalogItem extends SortedCatalogItem { class ByAuthorCatalogItem extends SortedCatalogItem {
ByAuthorCatalogItem(NetworkCatalogItem parent, List<NetworkLibraryItem> children) { ByAuthorCatalogItem(NetworkCatalogItem parent, List<NetworkItem> children) {
super(parent, "byAuthor", children); super(parent, "byAuthor", children);
} }
@Override @Override
protected Comparator<NetworkLibraryItem> getComparator() { protected Comparator<NetworkItem> getComparator() {
return new NetworkBookItemComparator(); return new NetworkBookItemComparator();
} }
} }
class ByTitleCatalogItem extends SortedCatalogItem { class ByTitleCatalogItem extends SortedCatalogItem {
ByTitleCatalogItem(NetworkCatalogItem parent, List<NetworkLibraryItem> children) { ByTitleCatalogItem(NetworkCatalogItem parent, List<NetworkItem> children) {
super(parent, "byTitle", children); super(parent, "byTitle", children);
} }
@Override @Override
protected Comparator<NetworkLibraryItem> getComparator() { protected Comparator<NetworkItem> getComparator() {
return new Comparator<NetworkLibraryItem>() { return new Comparator<NetworkItem>() {
public int compare(NetworkLibraryItem item0, NetworkLibraryItem item1) { public int compare(NetworkItem item0, NetworkItem item1) {
return item0.Title.compareTo(item1.Title); return item0.Title.compareTo(item1.Title);
} }
}; };
@ -95,14 +95,14 @@ class ByTitleCatalogItem extends SortedCatalogItem {
} }
class ByDateCatalogItem extends SortedCatalogItem { class ByDateCatalogItem extends SortedCatalogItem {
ByDateCatalogItem(NetworkCatalogItem parent, List<NetworkLibraryItem> children) { ByDateCatalogItem(NetworkCatalogItem parent, List<NetworkItem> children) {
super(parent, "byDate", children); super(parent, "byDate", children);
} }
@Override @Override
protected Comparator<NetworkLibraryItem> getComparator() { protected Comparator<NetworkItem> getComparator() {
return new Comparator<NetworkLibraryItem>() { return new Comparator<NetworkItem>() {
public int compare(NetworkLibraryItem item0, NetworkLibraryItem item1) { public int compare(NetworkItem item0, NetworkItem item1) {
return 0; return 0;
} }
}; };
@ -110,14 +110,14 @@ class ByDateCatalogItem extends SortedCatalogItem {
} }
class BySeriesCatalogItem extends SortedCatalogItem { class BySeriesCatalogItem extends SortedCatalogItem {
BySeriesCatalogItem(NetworkCatalogItem parent, List<NetworkLibraryItem> children) { BySeriesCatalogItem(NetworkCatalogItem parent, List<NetworkItem> children) {
super(parent, "bySeries", children); super(parent, "bySeries", children);
} }
@Override @Override
protected Comparator<NetworkLibraryItem> getComparator() { protected Comparator<NetworkItem> getComparator() {
return new Comparator<NetworkLibraryItem>() { return new Comparator<NetworkItem>() {
public int compare(NetworkLibraryItem item0, NetworkLibraryItem item1) { public int compare(NetworkItem item0, NetworkItem item1) {
final NetworkBookItem book0 = (NetworkBookItem)item0; final NetworkBookItem book0 = (NetworkBookItem)item0;
final NetworkBookItem book1 = (NetworkBookItem)item1; final NetworkBookItem book1 = (NetworkBookItem)item1;
int diff = book0.SeriesTitle.compareTo(book1.SeriesTitle); int diff = book0.SeriesTitle.compareTo(book1.SeriesTitle);
@ -130,7 +130,7 @@ class BySeriesCatalogItem extends SortedCatalogItem {
} }
@Override @Override
protected boolean accepts(NetworkLibraryItem item) { protected boolean accepts(NetworkItem item) {
return return
item instanceof NetworkBookItem && item instanceof NetworkBookItem &&
((NetworkBookItem)item).SeriesTitle != null; ((NetworkBookItem)item).SeriesTitle != null;
@ -166,11 +166,11 @@ public class LitResBookshelfItem extends NetworkCatalogItem {
} finally { } finally {
myForceReload = true; myForceReload = true;
// TODO: implement asynchronous loading // TODO: implement asynchronous loading
ArrayList<NetworkLibraryItem> children = ArrayList<NetworkItem> children =
new ArrayList<NetworkLibraryItem>(mgr.purchasedBooks()); new ArrayList<NetworkItem>(mgr.purchasedBooks());
if (children.size() <= 5) { if (children.size() <= 5) {
Collections.sort(children, new NetworkBookItemComparator()); Collections.sort(children, new NetworkBookItemComparator());
for (NetworkLibraryItem item : children) { for (NetworkItem item : children) {
listener.onNewItem(Link, item); listener.onNewItem(Link, item);
} }
} else { } else {

View file

@ -31,7 +31,7 @@ import org.geometerplus.fbreader.network.opds.HtmlToString;
class LitResXMLReader extends LitResAuthenticationXMLReader { class LitResXMLReader extends LitResAuthenticationXMLReader {
public final INetworkLink Link; public final INetworkLink Link;
public final List<NetworkLibraryItem> Books; public final List<NetworkItem> Books;
private int myIndex; private int myIndex;
@ -55,7 +55,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
private HashMap<Integer, String> myURLByType = new HashMap<Integer, String>(); // TODO: remove private HashMap<Integer, String> myURLByType = new HashMap<Integer, String>(); // TODO: remove
private LinkedList<BookReference> myReferences = new LinkedList<BookReference>(); private LinkedList<BookReference> myReferences = new LinkedList<BookReference>();
public LitResXMLReader(INetworkLink link, List<NetworkLibraryItem> books) { public LitResXMLReader(INetworkLink link, List<NetworkItem> books) {
super(link.getSiteName()); super(link.getSiteName());
Link = link; Link = link;
Books = books; Books = books;

View file

@ -42,7 +42,7 @@ class NetworkOPDSFeedReader implements OPDSFeedReader, OPDSConstants, MimeTypes
private int myItemsToLoad = -1; private int myItemsToLoad = -1;
/** /**
* Creates new OPDSFeedReader instance that can be used to get NetworkLibraryItem objects from OPDS feeds. * Creates new OPDSFeedReader instance that can be used to get NetworkItem objects from OPDS feeds.
* *
* @param baseURL string that contains URL of the OPDS feed, that will be read using this instance of the reader * @param baseURL string that contains URL of the OPDS feed, that will be read using this instance of the reader
* @param result network results buffer. Must be created using OPDSNetworkLink corresponding to the OPDS feed, * @param result network results buffer. Must be created using OPDSNetworkLink corresponding to the OPDS feed,
@ -203,7 +203,7 @@ class NetworkOPDSFeedReader implements OPDSFeedReader, OPDSConstants, MimeTypes
} }
} }
NetworkLibraryItem item; NetworkItem item;
if (hasBookLink) { if (hasBookLink) {
item = readBookItem(entry); item = readBookItem(entry);
} else { } else {
@ -218,7 +218,7 @@ class NetworkOPDSFeedReader implements OPDSFeedReader, OPDSConstants, MimeTypes
private static final String AuthorPrefix = "author:"; private static final String AuthorPrefix = "author:";
private static final String AuthorsPrefix = "authors:"; private static final String AuthorsPrefix = "authors:";
private NetworkLibraryItem readBookItem(OPDSEntry entry) { private NetworkItem readBookItem(OPDSEntry entry) {
final OPDSNetworkLink opdsNetworkLink = (OPDSNetworkLink)myData.Link; final OPDSNetworkLink opdsNetworkLink = (OPDSNetworkLink)myData.Link;
/*final String date; /*final String date;
if (entry.DCIssued != null) { if (entry.DCIssued != null) {
@ -368,7 +368,7 @@ class NetworkOPDSFeedReader implements OPDSFeedReader, OPDSConstants, MimeTypes
} }
} }
private NetworkLibraryItem readCatalogItem(OPDSEntry entry) { private NetworkItem readCatalogItem(OPDSEntry entry) {
final OPDSNetworkLink opdsLink = (OPDSNetworkLink)myData.Link; final OPDSNetworkLink opdsLink = (OPDSNetworkLink)myData.Link;
String coverURL = null; String coverURL = null;
String url = null; String url = null;

View file

@ -21,7 +21,7 @@ package org.geometerplus.fbreader.network.tree;
import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.fbreader.network.NetworkLibraryItem; import org.geometerplus.fbreader.network.NetworkItem;
import org.geometerplus.fbreader.network.NetworkTree; import org.geometerplus.fbreader.network.NetworkTree;
public class AddCustomCatalogItemTree extends NetworkTree { public class AddCustomCatalogItemTree extends NetworkTree {
@ -40,7 +40,7 @@ public class AddCustomCatalogItemTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return null; return null;
} }

View file

@ -120,7 +120,7 @@ public class NetworkAuthorTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return null; return null;
} }

View file

@ -69,7 +69,7 @@ public class NetworkBookTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return Book; return Book;
} }

View file

@ -29,7 +29,7 @@ import org.geometerplus.fbreader.network.*;
public class NetworkCatalogTree extends NetworkTree { public class NetworkCatalogTree extends NetworkTree {
public final NetworkCatalogItem Item; public final NetworkCatalogItem Item;
public final ArrayList<NetworkLibraryItem> ChildrenItems = new ArrayList<NetworkLibraryItem>(); public final ArrayList<NetworkItem> ChildrenItems = new ArrayList<NetworkItem>();
private long myLoadedTime = -1; private long myLoadedTime = -1;
@ -86,7 +86,7 @@ public class NetworkCatalogTree extends NetworkTree {
int nodeCount = 0; int nodeCount = 0;
for (int i = 0; i < ChildrenItems.size(); ++i) { for (int i = 0; i < ChildrenItems.size(); ++i) {
NetworkLibraryItem currentItem = ChildrenItems.get(i); NetworkItem currentItem = ChildrenItems.get(i);
if (!(currentItem instanceof NetworkCatalogItem)) { if (!(currentItem instanceof NetworkCatalogItem)) {
continue; continue;
} }
@ -158,12 +158,12 @@ public class NetworkCatalogTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return Item; return Item;
} }
@Override @Override
public void removeItems(Set<NetworkLibraryItem> items) { public void removeItems(Set<NetworkItem> items) {
ChildrenItems.removeAll(items); ChildrenItems.removeAll(items);
super.removeItems(items); super.removeItems(items);
} }

View file

@ -87,12 +87,12 @@ public class NetworkSeriesTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return null; return null;
} }
@Override @Override
public void removeItems(Set<NetworkLibraryItem> items) { public void removeItems(Set<NetworkItem> items) {
super.removeItems(items); super.removeItems(items);
if (subTrees().isEmpty()) { if (subTrees().isEmpty()) {
removeSelf(); removeSelf();

View file

@ -25,11 +25,11 @@ import org.geometerplus.fbreader.network.*;
public class NetworkTreeFactory { public class NetworkTreeFactory {
public static NetworkTree createNetworkTree(NetworkCatalogTree parent, NetworkLibraryItem item) { public static NetworkTree createNetworkTree(NetworkCatalogTree parent, NetworkItem item) {
return createNetworkTree(parent, item, -1); return createNetworkTree(parent, item, -1);
} }
public static NetworkTree createNetworkTree(NetworkCatalogTree parent, NetworkLibraryItem item, int position) { public static NetworkTree createNetworkTree(NetworkCatalogTree parent, NetworkItem item, int position) {
final int subtreesSize = parent.subTrees().size(); final int subtreesSize = parent.subTrees().size();
if (position == -1) { if (position == -1) {
position = subtreesSize; position = subtreesSize;

View file

@ -19,7 +19,7 @@
package org.geometerplus.fbreader.network.tree; package org.geometerplus.fbreader.network.tree;
import org.geometerplus.fbreader.network.NetworkLibraryItem; import org.geometerplus.fbreader.network.NetworkItem;
import org.geometerplus.fbreader.network.NetworkTree; import org.geometerplus.fbreader.network.NetworkTree;
public final class RootTree extends NetworkTree { public final class RootTree extends NetworkTree {
@ -29,7 +29,7 @@ public final class RootTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return null; return null;
} }

View file

@ -90,7 +90,7 @@ public class SearchItemTree extends NetworkTree {
} }
@Override @Override
public NetworkLibraryItem getHoldedItem() { public NetworkItem getHoldedItem() {
return null; return null;
} }