mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
Memory usage fix: 9MB --> 6MB
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1171 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
17c0ee0145
commit
32f8462eb2
6 changed files with 33 additions and 26 deletions
|
@ -54,6 +54,9 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
|
||||
private ZLTreeAdapter myAdapter;
|
||||
|
||||
private int dbgCatalogsCounter;
|
||||
private int dbgBooksCounter;
|
||||
|
||||
public NetworkCatalogActions(NetworkLibraryActivity activity, ZLTreeAdapter adapter) {
|
||||
super(activity);
|
||||
myAdapter = adapter;
|
||||
|
@ -221,9 +224,13 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
tree.ChildrenItems.add(item);
|
||||
NetworkTreeFactory.createNetworkTree(tree, item);
|
||||
tree.updateAccountDependents();
|
||||
if (!hasMessages(0)) {
|
||||
myAdapter.resetTree();
|
||||
|
||||
if (item instanceof NetworkCatalogItem) {
|
||||
++dbgCatalogsCounter;
|
||||
} if (item instanceof NetworkBookItem) {
|
||||
++dbgBooksCounter;
|
||||
}
|
||||
myAdapter.resetTree();
|
||||
if (expand) {
|
||||
// If catalog loading started => Tree must be expanded after the first item has been loaded
|
||||
myAdapter.expandOrCollapseTree(tree);
|
||||
|
@ -234,6 +241,8 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
public void handleMessage(Message message) {
|
||||
afterUpdateCatalog((String) message.obj, tree.ChildrenItems.size() == 0);
|
||||
endProgressNotification(tree);
|
||||
System.err.println("FBREADER -- dbgCatalogsCounter = " + dbgCatalogsCounter);
|
||||
System.err.println("FBREADER -- dbgBooksCounter = " + dbgBooksCounter);
|
||||
}
|
||||
};
|
||||
new Thread(new Runnable() {
|
||||
|
@ -281,9 +290,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
tree.ChildrenItems.add(item);
|
||||
NetworkTreeFactory.createNetworkTree(tree, item);
|
||||
tree.updateAccountDependents();
|
||||
if (!hasMessages(0)) {
|
||||
myAdapter.resetTree();
|
||||
}
|
||||
myAdapter.resetTree();
|
||||
if (expand) {
|
||||
// If catalog loading started => Tree must be expanded after the first item has been loaded
|
||||
myAdapter.expandOrCollapseTree(tree);
|
||||
|
|
|
@ -38,8 +38,8 @@ public class NetworkBookItem extends NetworkLibraryItem {
|
|||
* @param sortKey string that defines sorting order of book's authors. Must be not <code>null</code>.
|
||||
*/
|
||||
public AuthorData(String displayName, String sortKey) {
|
||||
DisplayName = displayName;
|
||||
SortKey = sortKey;
|
||||
DisplayName = displayName.intern();
|
||||
SortKey = sortKey.intern();
|
||||
}
|
||||
|
||||
public int compareTo(AuthorData data) {
|
||||
|
@ -67,10 +67,10 @@ public class NetworkBookItem extends NetworkLibraryItem {
|
|||
|
||||
public final int Index;
|
||||
public final String Id;
|
||||
public final String Language;
|
||||
public final String Date;
|
||||
public final List<AuthorData> Authors;
|
||||
public final List<String> Tags;
|
||||
//public final String Language;
|
||||
//public final String Date;
|
||||
public final LinkedList<AuthorData> Authors;
|
||||
//public final LinkedList<String> Tags;
|
||||
public final String SeriesTitle;
|
||||
public final int IndexInSeries;
|
||||
|
||||
|
@ -84,27 +84,27 @@ public class NetworkBookItem extends NetworkLibraryItem {
|
|||
* @param index sequence number of this book in corresponding catalog
|
||||
* @param title title of this book. Must be not <code>null</code>.
|
||||
* @param summary description of this book. Can be <code>null</code>.
|
||||
* @param langage string specifies language of this book. Can be <code>null</code>.
|
||||
* @param date string specifies release date of this book. Can be <code>null</code>.
|
||||
* //@param langage string specifies language of this book. Can be <code>null</code>.
|
||||
* //@param date string specifies release date of this book. Can be <code>null</code>.
|
||||
* @param authors list of book authors. Should contain at least one author.
|
||||
* @param tags list of book tags. Must be not <code>null</code> (can be empty).
|
||||
* //@param tags list of book tags. Must be not <code>null</code> (can be empty).
|
||||
* @param seriesTitle title of this book's series. Can be <code>null</code>.
|
||||
* @param indexInSeries sequence number of this book within book's series. Ignored if seriesTitle is <code>null</code>.
|
||||
* @param linkByType map contains URLs and their types. Must be not <code>null</code>.
|
||||
* @param references list of references related to this book. Must be not <code>null</code>.
|
||||
*/
|
||||
public NetworkBookItem(NetworkLink link, String id, int index,
|
||||
String title, String summary, String language, String date,
|
||||
List<AuthorData> authors, List<String> tags, String seriesTitle, int indexInSeries,
|
||||
String title, String summary, /*String language, String date,*/
|
||||
List<AuthorData> authors, /*List<String> tags,*/ String seriesTitle, int indexInSeries,
|
||||
Map<Integer, Link> linkByType,
|
||||
List<BookReference> references) {
|
||||
super(link, title, summary, linkByType);
|
||||
Index = index;
|
||||
Id = id;
|
||||
Language = language;
|
||||
Date = date;
|
||||
//Language = language;
|
||||
//Date = date;
|
||||
Authors = new LinkedList<AuthorData>(authors);
|
||||
Tags = new LinkedList<String>(tags);
|
||||
//Tags = new LinkedList<String>(tags);
|
||||
SeriesTitle = seriesTitle;
|
||||
IndexInSeries = indexInSeries;
|
||||
myReferences = new LinkedList(references);
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class NetworkTree extends FBTree {
|
|||
}
|
||||
|
||||
public static ZLImage createCover(String url, String mimeType) {
|
||||
if (url == null) {
|
||||
/*if (url == null) {
|
||||
return null;
|
||||
}
|
||||
if (mimeType == null) {
|
||||
|
@ -74,7 +74,7 @@ public abstract class NetworkTree extends FBTree {
|
|||
img.setData(url.substring(commaIndex + 1));
|
||||
return img;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,10 +260,10 @@ class NetworkOPDSFeedReader implements OPDSFeedReader {
|
|||
myIndex++,
|
||||
entry.Title,
|
||||
entry.Summary,
|
||||
entry.DCLanguage,
|
||||
date,
|
||||
//entry.DCLanguage,
|
||||
//date,
|
||||
authors,
|
||||
tags,
|
||||
//tags,
|
||||
entry.SeriesTitle,
|
||||
entry.SeriesIndex,
|
||||
urlMap,
|
||||
|
|
|
@ -367,7 +367,7 @@ class OPDSXMLReader extends ZLXMLReaderAdapter {
|
|||
tag = tag.intern();
|
||||
}
|
||||
|
||||
String bufferContent = myBuffer.toString().trim();
|
||||
String bufferContent = myBuffer.toString().trim().intern();
|
||||
if (bufferContent.length() == 0) {
|
||||
bufferContent = null;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public abstract class FBTree extends ZLTree<FBTree> implements Comparable<FBTree
|
|||
public final ZLImage getCover() {
|
||||
if (!myCoverRequested) {
|
||||
myCover = createCover();
|
||||
if (myCover == null) {
|
||||
if (myCover == null && Parent != null) {
|
||||
myCover = Parent.getCover();
|
||||
}
|
||||
myCoverRequested = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue