mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
refactoring: NetworkLibrary.Instance() => Util.networkLibrary()
This commit is contained in:
parent
7302442028
commit
c758481b3f
41 changed files with 134 additions and 131 deletions
|
@ -31,8 +31,7 @@ import org.geometerplus.android.fbreader.api.FBReaderIntents;
|
|||
import org.geometerplus.android.fbreader.api.PluginApi;
|
||||
|
||||
public class AddCatalogMenuActivity extends MenuActivity {
|
||||
private final ZLResource myResource =
|
||||
NetworkLibrary.Instance().resource().getResource("addCatalog");
|
||||
private final ZLResource myResource = NetworkLibrary.resource().getResource("addCatalog");
|
||||
|
||||
private void addItem(String id, int weight) {
|
||||
myInfos.add(new PluginApi.MenuActionInfo(
|
||||
|
|
|
@ -132,7 +132,7 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
if ("opds".equals(scheme)) {
|
||||
uri = Uri.parse("http" + uri.toString().substring(scheme.length()));
|
||||
}
|
||||
final INetworkLink link = NetworkLibrary.Instance().getLinkByUrl(uri.toString());
|
||||
final INetworkLink link = Util.networkLibrary(this).getLinkByUrl(uri.toString());
|
||||
if (link instanceof ICustomNetworkLink) {
|
||||
myLink = (ICustomNetworkLink)link;
|
||||
} else {
|
||||
|
@ -192,7 +192,7 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
myLink.setSummary(summary);
|
||||
myLink.setUrl(UrlInfo.Type.Catalog, uri.toString(), MimeType.APP_ATOM_XML);
|
||||
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
library.addCustomLink(myLink);
|
||||
library.synchronize();
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public class AuthenticationActivity extends Activity {
|
|||
myCustomAuthentication = intent.getBooleanExtra(CUSTOM_AUTH_KEY, false);
|
||||
|
||||
if (myCustomAuthentication) {
|
||||
myLink = NetworkLibrary.Instance().getLinkByUrl(String.valueOf(intent.getData()));
|
||||
myLink = Util.networkLibrary(this).getLinkByUrl(String.valueOf(intent.getData()));
|
||||
if (myLink == null) {
|
||||
finish();
|
||||
return;
|
||||
|
@ -185,7 +185,7 @@ public class AuthenticationActivity extends Activity {
|
|||
mgr.logOut();
|
||||
}
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(AuthenticationActivity.this);
|
||||
library.invalidateVisibility();
|
||||
library.synchronize();
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AuthenticationActivity extends Activity {
|
|||
if (myOnSuccessRunnable != null) {
|
||||
myOnSuccessRunnable.run();
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(AuthenticationActivity.this);
|
||||
library.invalidateVisibility();
|
||||
library.synchronize();
|
||||
} catch (final ZLNetworkException e) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AuthorisationMenuActivity extends MenuActivity {
|
|||
final ZLResource resource = NetworkLibrary.resource();
|
||||
|
||||
setTitle(resource.getResource("authorisationMenuTitle").getValue());
|
||||
myLink = NetworkLibrary.Instance().getLinkByUrl(baseUrl);
|
||||
myLink = Util.networkLibrary(this).getLinkByUrl(baseUrl);
|
||||
|
||||
if (myLink.getUrlInfo(UrlInfo.Type.SignIn) != null) {
|
||||
myInfos.add(new PluginApi.MenuActionInfo(
|
||||
|
|
|
@ -76,7 +76,7 @@ public class BuyBooksActivity extends SimpleDialogActivity implements NetworkLib
|
|||
Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
|
||||
|
||||
myBookCollection.bindToService(this, null);
|
||||
myLibrary = NetworkLibrary.Instance();
|
||||
myLibrary = Util.networkLibrary(this);
|
||||
|
||||
final List<NetworkTree.Key> keys =
|
||||
(List<NetworkTree.Key>)getIntent().getSerializableExtra(
|
||||
|
@ -123,7 +123,7 @@ public class BuyBooksActivity extends SimpleDialogActivity implements NetworkLib
|
|||
|
||||
setupUI(AuthorisationState.Authorised);
|
||||
|
||||
NetworkLibrary.Instance().addChangeListener(this);
|
||||
myLibrary.addChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -229,7 +229,7 @@ public class BuyBooksActivity extends SimpleDialogActivity implements NetworkLib
|
|||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
NetworkLibrary.Instance().removeChangeListener(this);
|
||||
myLibrary.removeChangeListener(this);
|
||||
myBookCollection.unbind();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CatalogManagerActivity extends ListActivity {
|
|||
if (enabledIds.size() > 0) {
|
||||
final List<CatalogItem> cItems = new ArrayList<CatalogItem>();
|
||||
for (String id : enabledIds) {
|
||||
final NetworkTree tree = NetworkLibrary.Instance().getCatalogTreeByUrlAll(id);
|
||||
final NetworkTree tree = Util.networkLibrary(this).getCatalogTreeByUrlAll(id);
|
||||
if (tree != null && tree.getLink() != null) {
|
||||
cItems.add(new CatalogItem(id, true, tree));
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class CatalogManagerActivity extends ListActivity {
|
|||
if (disabledIds.size() > 0) {
|
||||
final TreeSet<CatalogItem> cItems = new TreeSet<CatalogItem>();
|
||||
for (String id : disabledIds) {
|
||||
final NetworkTree tree = NetworkLibrary.Instance().getCatalogTreeByUrlAll(id);
|
||||
final NetworkTree tree = Util.networkLibrary(this).getCatalogTreeByUrlAll(id);
|
||||
if (tree != null && tree.getLink() != null) {
|
||||
cItems.add(new CatalogItem(id, false, tree));
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticat
|
|||
public class ListenerCallback extends BroadcastReceiver implements UserRegistrationConstants {
|
||||
@Override
|
||||
public void onReceive(Context context, final Intent intent) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(context);
|
||||
|
||||
if (Util.SIGNIN_ACTION.equals(intent.getAction())) {
|
||||
final String url = intent.getStringExtra(CATALOG_URL);
|
||||
|
|
|
@ -95,14 +95,14 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
|
|||
}
|
||||
});
|
||||
|
||||
NetworkLibrary.Instance().addChangeListener(this);
|
||||
Util.networkLibrary(this).addChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
myNetworkContext.onResume();
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
Util.networkLibrary(this).fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,7 +120,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
|
|||
}
|
||||
myInitializerStarted = true;
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(NetworkBookInfoActivity.this);
|
||||
if (!library.isInitialized()) {
|
||||
if (SQLiteNetworkDatabase.Instance() == null) {
|
||||
new SQLiteNetworkDatabase(getApplication());
|
||||
|
@ -233,7 +233,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
|
|||
myBook.createRelatedCatalogItem(relatedInfo);
|
||||
if (catalogItem != null) {
|
||||
new OpenCatalogAction(NetworkBookInfoActivity.this, myNetworkContext)
|
||||
.run(NetworkLibrary.Instance().getFakeCatalogTree(catalogItem));
|
||||
.run(Util.networkLibrary(NetworkBookInfoActivity.this).getFakeCatalogTree(catalogItem));
|
||||
} else if (MimeType.TEXT_HTML.equals(relatedInfo.Mime)) {
|
||||
Util.openInBrowser(NetworkBookInfoActivity.this, relatedInfo.Url);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
|
|||
final int maxHeight = metrics.heightPixels * 2 / 3;
|
||||
final int maxWidth = maxHeight * 2 / 3;
|
||||
Bitmap coverBitmap = null;
|
||||
final ZLImage cover = NetworkTree.createCover(myBook, false);
|
||||
final ZLImage cover = NetworkTree.createCoverForItem(Util.networkLibrary(this), myBook, false);
|
||||
if (cover != null) {
|
||||
ZLAndroidImageData data = null;
|
||||
final ZLAndroidImageManager mgr = (ZLAndroidImageManager)ZLAndroidImageManager.Instance();
|
||||
|
@ -438,9 +438,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkLibrary.
|
|||
@Override
|
||||
protected void onStop() {
|
||||
myConnection.unbind(this);
|
||||
|
||||
NetworkLibrary.Instance().removeChangeListener(this);
|
||||
|
||||
Util.networkLibrary(this).removeChangeListener(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
super.onCreate(icicle);
|
||||
BookCollection.bindToService(this, new Runnable() {
|
||||
public void run() {
|
||||
NetworkLibrary.Instance().clearExpiredCache(25);
|
||||
Util.networkLibrary(NetworkLibraryActivity.this).clearExpiredCache(25);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -89,14 +89,15 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
BookCollection.bindToService(this, new Runnable() {
|
||||
public void run() {
|
||||
init(intent);
|
||||
NetworkLibrary.Instance().addChangeListener(NetworkLibraryActivity.this);
|
||||
final NetworkLibrary library = Util.networkLibrary(NetworkLibraryActivity.this);
|
||||
library.addChangeListener(NetworkLibraryActivity.this);
|
||||
|
||||
if (getCurrentTree() instanceof RootTree) {
|
||||
mySingleCatalog = intent.getBooleanExtra("SingleCatalog", false);
|
||||
if (!NetworkLibrary.Instance().isInitialized()) {
|
||||
if (!library.isInitialized()) {
|
||||
Util.initLibrary(NetworkLibraryActivity.this, myNetworkContext, new Runnable() {
|
||||
public void run() {
|
||||
NetworkLibrary.Instance().runBackgroundUpdate(false);
|
||||
library.runBackgroundUpdate(false);
|
||||
requestCatalogPlugins();
|
||||
if (intent != null) {
|
||||
openTreeByIntent(intent);
|
||||
|
@ -116,7 +117,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
|
||||
@Override
|
||||
protected NetworkTree getTreeByKey(FBTree.Key key) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
final NetworkTree tree = library.getTreeByKey(key);
|
||||
return tree != null ? tree : library.getRootTree();
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
super.onResume();
|
||||
myNetworkContext.onResume();
|
||||
getListView().setOnCreateContextMenuListener(this);
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
Util.networkLibrary(this).fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,7 +146,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
NetworkLibrary.Instance().removeChangeListener(this);
|
||||
Util.networkLibrary(this).removeChangeListener(this);
|
||||
BookCollection.unbind();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
@ -159,7 +160,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
final String id = uri.toString();
|
||||
addCustomLink(id, new Runnable() {
|
||||
public void run() {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(NetworkLibraryActivity.this);
|
||||
library.setLinkActive(id, true);
|
||||
library.synchronize();
|
||||
onLibraryChanged(NetworkLibrary.ChangeListener.Code.SomeCode, new Object[0]);
|
||||
|
@ -206,8 +207,9 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
{
|
||||
final ArrayList<String> myIds =
|
||||
data.getStringArrayListExtra(ENABLED_CATALOG_IDS_KEY);
|
||||
NetworkLibrary.Instance().setActiveIds(myIds);
|
||||
NetworkLibrary.Instance().synchronize();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
library.setActiveIds(myIds);
|
||||
library.synchronize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +241,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||
final NetworkItemsLoader loader =
|
||||
NetworkLibrary.Instance().getStoredLoader(getCurrentTree());
|
||||
Util.networkLibrary(this).getStoredLoader(getCurrentTree());
|
||||
if (loader != null) {
|
||||
loader.interrupt();
|
||||
}
|
||||
|
@ -391,7 +393,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
}
|
||||
|
||||
private void updateLoadingProgress() {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
final NetworkTree tree = getCurrentTree();
|
||||
final NetworkTree lTree = getLoadableNetworkTree(tree);
|
||||
final NetworkTree sTree = RunSearchAction.getSearchTree(tree);
|
||||
|
@ -536,7 +538,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
};
|
||||
|
||||
private void addCustomLink(String url, final Runnable postAction) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
if (library.getLinkByUrl(url) != null) {
|
||||
if (postAction != null) {
|
||||
runOnUiThread(postAction);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class NetworkSearchActivity extends Activity {
|
|||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
final Bundle data = intent.getBundleExtra(SearchManager.APP_DATA);
|
||||
if (data != null) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Util.networkLibrary(this);
|
||||
final NetworkTree.Key key =
|
||||
(NetworkTree.Key)data.getSerializable(NetworkLibraryActivity.TREE_KEY_KEY);
|
||||
final NetworkTree tree = library.getTreeByKey(key);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TopupMenuActivity extends MenuActivity {
|
|||
protected void init() {
|
||||
setTitle(NetworkLibrary.resource().getResource("topupTitle").getValue());
|
||||
final String url = getIntent().getData().toString();
|
||||
myLink = NetworkLibrary.Instance().getLinkByUrl(url);
|
||||
myLink = Util.networkLibrary(this).getLinkByUrl(url);
|
||||
myAmount = (Money)getIntent().getSerializableExtra(AMOUNT_KEY);
|
||||
|
||||
if (myLink.getUrlInfo(UrlInfo.Type.TopUp) != null) {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.geometerplus.android.fbreader.network;
|
|||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
|
@ -54,6 +55,10 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
return intent;
|
||||
}
|
||||
|
||||
public static NetworkLibrary networkLibrary(Context context) {
|
||||
return NetworkLibrary.Instance();
|
||||
}
|
||||
|
||||
static void initLibrary(final Activity activity, final ZLNetworkContext nc, final Runnable action) {
|
||||
Config.Instance().runOnConnect(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -63,7 +68,7 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
new SQLiteNetworkDatabase(activity.getApplication());
|
||||
}
|
||||
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = networkLibrary(activity);
|
||||
if (!library.isInitialized()) {
|
||||
try {
|
||||
library.initialize(nc);
|
||||
|
@ -109,7 +114,7 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
|
||||
public static void openInBrowser(Activity activity, String url) {
|
||||
if (url != null) {
|
||||
url = NetworkLibrary.Instance().rewriteUrl(url, true);
|
||||
url = networkLibrary(activity).rewriteUrl(url, true);
|
||||
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,15 +24,19 @@ import android.app.Activity;
|
|||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
|
||||
import org.geometerplus.android.fbreader.network.Util;
|
||||
|
||||
public abstract class Action {
|
||||
public final int Code;
|
||||
public final int IconId;
|
||||
|
||||
protected final Activity myActivity;
|
||||
protected final NetworkLibrary myLibrary;
|
||||
private final String myResourceKey;
|
||||
|
||||
protected Action(Activity activity, int code, String resourceKey, int iconId) {
|
||||
myActivity = activity;
|
||||
myLibrary = Util.networkLibrary(activity);
|
||||
Code = code;
|
||||
myResourceKey = resourceKey;
|
||||
IconId = iconId;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BuyBasketBooksAction extends CatalogAction {
|
|||
|
||||
@Override
|
||||
public boolean isEnabled(NetworkTree tree) {
|
||||
if (NetworkLibrary.Instance().getStoredLoader(tree) != null) {
|
||||
if (myLibrary.getStoredLoader(tree) != null) {
|
||||
return false;
|
||||
}
|
||||
final Set<String> bookIds = new HashSet<String>();
|
||||
|
|
|
@ -38,8 +38,8 @@ public class DisableCatalogAction extends Action {
|
|||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
NetworkLibrary.Instance().setLinkActive(tree.getLink(), false);
|
||||
NetworkLibrary.Instance().synchronize();
|
||||
myLibrary.setLinkActive(tree.getLink(), false);
|
||||
myLibrary.synchronize();
|
||||
// TODO: invalidate view
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,8 @@ public class ManageCatalogsAction extends RootAction {
|
|||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
|
||||
final ArrayList<String> ids = new ArrayList<String>(library.activeIds());
|
||||
final ArrayList<String> inactiveIds = new ArrayList<String>(library.allIds());
|
||||
final ArrayList<String> ids = new ArrayList<String>(myLibrary.activeIds());
|
||||
final ArrayList<String> inactiveIds = new ArrayList<String>(myLibrary.allIds());
|
||||
inactiveIds.removeAll(ids);
|
||||
|
||||
OrientationUtil.startActivityForResult(
|
||||
|
|
|
@ -193,7 +193,7 @@ public abstract class NetworkBookActions {
|
|||
return true;
|
||||
case ActionCode.OPEN_BASKET:
|
||||
new OpenCatalogAction(activity, new ActivityNetworkContext(activity))
|
||||
.run(NetworkLibrary.Instance().getFakeBasketTree(book.Link.getBasketItem()));
|
||||
.run(Util.networkLibrary(activity).getFakeBasketTree(book.Link.getBasketItem()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -220,7 +220,7 @@ public abstract class NetworkBookActions {
|
|||
}
|
||||
}
|
||||
|
||||
private static void tryToDeleteBook(Activity activity, final NetworkBookItem book, final boolean demo) {
|
||||
private static void tryToDeleteBook(final Activity activity, final NetworkBookItem book, final boolean demo) {
|
||||
final ZLResource dialogResource = ZLResource.resource("dialog");
|
||||
final ZLResource buttonResource = dialogResource.getResource("button");
|
||||
final ZLResource boxResource = dialogResource.getResource("deleteBookBox");
|
||||
|
@ -242,7 +242,7 @@ public abstract class NetworkBookActions {
|
|||
}
|
||||
}
|
||||
}
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
Util.networkLibrary(activity).fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(buttonResource.getResource("no").getValue(), null)
|
||||
|
|
|
@ -75,7 +75,7 @@ public class OpenCatalogAction extends Action {
|
|||
}
|
||||
|
||||
private void doExpandCatalog(final NetworkCatalogTree tree) {
|
||||
final NetworkItemsLoader loader = NetworkLibrary.Instance().getStoredLoader(tree);
|
||||
final NetworkItemsLoader loader = myLibrary.getStoredLoader(tree);
|
||||
if (loader != null && loader.canResumeLoading()) {
|
||||
doOpenTree(tree);
|
||||
} else if (loader != null) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OpenRootAction extends Action {
|
|||
}
|
||||
for (; tree != null; tree = (NetworkTree)tree.Parent) {
|
||||
if (tree instanceof RootTree) {
|
||||
return tree == NetworkLibrary.Instance().getRootTree();
|
||||
return tree == myLibrary.getRootTree();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -51,7 +51,7 @@ public class OpenRootAction extends Action {
|
|||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
final NetworkLibraryActivity activity = (NetworkLibraryActivity)myActivity;
|
||||
activity.openTree(NetworkLibrary.Instance().getRootTree());
|
||||
activity.openTree(myLibrary.getRootTree());
|
||||
activity.clearHistory();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ public class RefreshRootCatalogAction extends RootAction {
|
|||
|
||||
@Override
|
||||
public boolean isEnabled(NetworkTree tree) {
|
||||
return !NetworkLibrary.Instance().isUpdateInProgress();
|
||||
return !myLibrary.isUpdateInProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
NetworkLibrary.Instance().runBackgroundUpdate(true);
|
||||
myLibrary.runBackgroundUpdate(true);
|
||||
((NetworkLibraryActivity)myActivity).requestCatalogPlugins();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ public class ReloadCatalogAction extends CatalogAction {
|
|||
|
||||
@Override
|
||||
public boolean isEnabled(NetworkTree tree) {
|
||||
return NetworkLibrary.Instance().getStoredLoader(tree) == null;
|
||||
return myLibrary.getStoredLoader(tree) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
if (NetworkLibrary.Instance().getStoredLoader(tree) != null) {
|
||||
if (myLibrary.getStoredLoader(tree) != null) {
|
||||
return;
|
||||
}
|
||||
((NetworkCatalogTree)tree).clearCatalog();
|
||||
|
|
|
@ -40,8 +40,7 @@ public class RemoveCustomCatalogAction extends CatalogAction {
|
|||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
library.removeCustomLink((ICustomNetworkLink)tree.getLink());
|
||||
library.synchronize();
|
||||
myLibrary.removeCustomLink((ICustomNetworkLink)tree.getLink());
|
||||
myLibrary.synchronize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class RunSearchAction extends Action {
|
|||
|
||||
@Override
|
||||
public boolean isEnabled(NetworkTree tree) {
|
||||
return NetworkLibrary.Instance().getStoredLoader(getSearchTree(tree)) == null;
|
||||
return myLibrary.getStoredLoader(getSearchTree(tree)) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +75,7 @@ public class RunSearchAction extends Action {
|
|||
NetworkLibraryActivity.TREE_KEY_KEY,
|
||||
getSearchTree(tree).getUniqueKey()
|
||||
);
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = myLibrary;
|
||||
if (DeviceType.Instance().hasStandardSearchDialog()) {
|
||||
myActivity.startSearch(library.NetworkSearchPatternOption.getValue(), true, bundle, false);
|
||||
} else {
|
||||
|
|
|
@ -69,9 +69,8 @@ public class SignOutAction extends Action {
|
|||
mgr.logOut();
|
||||
myActivity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
library.invalidateVisibility();
|
||||
library.synchronize();
|
||||
myLibrary.invalidateVisibility();
|
||||
myLibrary.synchronize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -231,9 +231,9 @@ public class NetworkLibrary {
|
|||
return null;
|
||||
}
|
||||
|
||||
private final RootTree myRootAllTree = new RootTree("@AllRoot", false);
|
||||
private final RootTree myRootTree = new RootTree("@Root", false);
|
||||
private final RootTree myFakeRootTree = new RootTree("@FakeRoot", true);
|
||||
private final RootTree myRootAllTree = new RootTree(this, "@AllRoot", false);
|
||||
private final RootTree myRootTree = new RootTree(this, "@Root", false);
|
||||
private final RootTree myFakeRootTree = new RootTree(this, "@FakeRoot", true);
|
||||
|
||||
private boolean myChildrenAreInvalid = true;
|
||||
private boolean myUpdateVisibility;
|
||||
|
|
|
@ -28,16 +28,21 @@ import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
|||
import org.geometerplus.fbreader.tree.FBTree;
|
||||
|
||||
public abstract class NetworkTree extends FBTree {
|
||||
protected NetworkTree() {
|
||||
public final NetworkLibrary Library;
|
||||
|
||||
protected NetworkTree(NetworkLibrary library) {
|
||||
super();
|
||||
Library = library;
|
||||
}
|
||||
|
||||
protected NetworkTree(NetworkTree parent) {
|
||||
super(parent);
|
||||
Library = parent.Library;
|
||||
}
|
||||
|
||||
protected NetworkTree(NetworkTree parent, int position) {
|
||||
super(parent, position);
|
||||
Library = parent.Library;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +66,7 @@ public abstract class NetworkTree extends FBTree {
|
|||
return parent != null ? parent.getLink() : null;
|
||||
}
|
||||
|
||||
public static ZLImage createCover(NetworkItem item, boolean thumbnail) {
|
||||
public static ZLImage createCoverForItem(NetworkLibrary library, NetworkItem item, boolean thumbnail) {
|
||||
String coverUrl = item.getUrl(thumbnail ? UrlInfo.Type.Thumbnail : UrlInfo.Type.Image);
|
||||
if (coverUrl == null) {
|
||||
coverUrl = item.getUrl(thumbnail ? UrlInfo.Type.Image : UrlInfo.Type.Thumbnail);
|
||||
|
@ -69,12 +74,12 @@ public abstract class NetworkTree extends FBTree {
|
|||
if (coverUrl == null) {
|
||||
return null;
|
||||
}
|
||||
return createCover(coverUrl, null);
|
||||
return createCoverFromUrl(library, coverUrl, null);
|
||||
}
|
||||
|
||||
private static final String DATA_PREFIX = "data:";
|
||||
|
||||
public static ZLImage createCover(String url, MimeType mimeType) {
|
||||
public static ZLImage createCoverFromUrl(NetworkLibrary library, String url, MimeType mimeType) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -82,7 +87,7 @@ public abstract class NetworkTree extends FBTree {
|
|||
mimeType = MimeType.IMAGE_AUTO;
|
||||
}
|
||||
if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("ftp://")) {
|
||||
return NetworkLibrary.Instance().getImageByUrl(url, mimeType);
|
||||
return library.getImageByUrl(url, mimeType);
|
||||
} else if (url.startsWith(DATA_PREFIX)) {
|
||||
int commaIndex = url.indexOf(',');
|
||||
if (commaIndex == -1) {
|
||||
|
|
|
@ -55,6 +55,6 @@ public class RecentCatalogListItem extends NetworkCatalogItem {
|
|||
for (int i = 0; i < 5; ++i) {
|
||||
loader.onNewItem(new RecentCatalogItem("Catalog " + i, "Visited ..."));
|
||||
}
|
||||
loader.getTree().confirmAllItems();
|
||||
loader.Tree.confirmAllItems();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ abstract class SortedCatalogItem extends NetworkCatalogItem {
|
|||
for (NetworkItem child : myChildren) {
|
||||
loader.onNewItem(child);
|
||||
}
|
||||
loader.getTree().confirmAllItems();
|
||||
loader.Tree.confirmAllItems();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class LitResBookshelfItem extends NetworkURLCatalogItem {
|
|||
loader.onNewItem(bySeries);
|
||||
}
|
||||
}
|
||||
loader.getTree().confirmAllItems();
|
||||
loader.Tree.confirmAllItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class OPDSBasketItem extends BasketItem {
|
|||
for (String id : ids) {
|
||||
loader.onNewItem(getBook(id));
|
||||
}
|
||||
loader.getTree().confirmAllItems();
|
||||
loader.Tree.confirmAllItems();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class OPDSFeedHandler extends AbstractOPDSFeedHandler implements OPDSConstants {
|
|||
* that will be read using this instance of the reader.
|
||||
*/
|
||||
OPDSFeedHandler(String baseURL, OPDSCatalogItem.State result) {
|
||||
myCatalog = result.Loader.getTree().Item;
|
||||
myCatalog = result.Loader.Tree.Item;
|
||||
myBaseURL = baseURL;
|
||||
myData = result;
|
||||
mySkipUntilId = myData.LastLoadedId;
|
||||
|
|
|
@ -86,8 +86,8 @@ public abstract class OPDSNetworkLink extends AbstractNetworkLink {
|
|||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkCatalogItem catalogItem = state.Loader.getTree().Item;
|
||||
final NetworkLibrary library = state.Loader.Tree.Library;
|
||||
final NetworkCatalogItem catalogItem = state.Loader.Tree.Item;
|
||||
library.startLoading(catalogItem);
|
||||
url = rewriteUrl(url, false);
|
||||
return new ZLNetworkRequest.Get(url) {
|
||||
|
@ -105,7 +105,7 @@ public abstract class OPDSNetworkLink extends AbstractNetworkLink {
|
|||
// reset state to load current page from the beginning
|
||||
state.LastLoadedId = null;
|
||||
} else {
|
||||
state.Loader.getTree().confirmAllItems();
|
||||
state.Loader.Tree.confirmAllItems();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RSSChannelHandler extends AbstractRSSChannelHandler {
|
|||
* that will be read using this instance of the reader.
|
||||
*/
|
||||
RSSChannelHandler(String baseURL, RSSCatalogItem.State result) {
|
||||
myCatalog = result.Loader.getTree().Item;
|
||||
myCatalog = result.Loader.Tree.Item;
|
||||
myBaseURL = baseURL;
|
||||
myData = result;
|
||||
mySkipUntilId = myData.LastLoadedId;
|
||||
|
|
|
@ -51,8 +51,8 @@ public class RSSNetworkLink extends AbstractNetworkLink implements IPredefinedNe
|
|||
return null;
|
||||
}
|
||||
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkCatalogItem catalogItem = result.Loader.getTree().Item;
|
||||
final NetworkLibrary library = result.Loader.Tree.Library;
|
||||
final NetworkCatalogItem catalogItem = result.Loader.Tree.Item;
|
||||
library.startLoading(catalogItem);
|
||||
|
||||
return new ZLNetworkRequest.Get(url, false) {
|
||||
|
@ -68,7 +68,7 @@ public class RSSNetworkLink extends AbstractNetworkLink implements IPredefinedNe
|
|||
if (result.Loader.confirmInterruption() && result.LastLoadedId != null) {
|
||||
result.LastLoadedId = null;
|
||||
} else {
|
||||
result.Loader.getTree().confirmAllItems();
|
||||
result.Loader.Tree.confirmAllItems();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class CatalogExpander extends NetworkItemsLoader {
|
|||
|
||||
@Override
|
||||
public void doBefore() throws ZLNetworkException {
|
||||
final INetworkLink link = getTree().getLink();
|
||||
final INetworkLink link = Tree.getLink();
|
||||
if (myAuthenticate && link != null && link.authenticationManager() != null) {
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
try {
|
||||
|
@ -61,35 +61,34 @@ class CatalogExpander extends NetworkItemsLoader {
|
|||
@Override
|
||||
public void load() throws ZLNetworkException {
|
||||
if (myResumeNotLoad) {
|
||||
getTree().Item.resumeLoading(this);
|
||||
Tree.Item.resumeLoading(this);
|
||||
} else {
|
||||
getTree().Item.loadChildren(this);
|
||||
Tree.Item.loadChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish(ZLNetworkException exception, boolean interrupted) {
|
||||
if (interrupted && (!getTree().Item.supportsResumeLoading() || exception != null)) {
|
||||
getTree().clearCatalog();
|
||||
if (interrupted && (!Tree.Item.supportsResumeLoading() || exception != null)) {
|
||||
Tree.clearCatalog();
|
||||
} else {
|
||||
getTree().removeUnconfirmedItems();
|
||||
Tree.removeUnconfirmedItems();
|
||||
if (!interrupted) {
|
||||
if (exception != null) {
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(
|
||||
Tree.Library.fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.NetworkError, exception.getMessage()
|
||||
);
|
||||
} else {
|
||||
getTree().updateLoadedTime();
|
||||
if (getTree().subtrees().isEmpty()) {
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(
|
||||
Tree.updateLoadedTime();
|
||||
if (Tree.subtrees().isEmpty()) {
|
||||
Tree.Library.fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.EmptyCatalog
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
library.invalidateVisibility();
|
||||
library.synchronize();
|
||||
Tree.Library.invalidateVisibility();
|
||||
Tree.Library.synchronize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class NetworkBookTree extends NetworkTree {
|
|||
|
||||
@Override
|
||||
protected ZLImage createCover() {
|
||||
return createCover(Book, true);
|
||||
return createCoverForItem(Library, Book, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,7 +85,7 @@ public class NetworkCatalogTree extends NetworkTree {
|
|||
myChildrenItems.add((NetworkCatalogItem)item);
|
||||
}
|
||||
myUnconfirmedTrees.add(NetworkTreeFactory.createNetworkTree(this, item));
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
Library.fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,7 +108,7 @@ public class NetworkCatalogTree extends NetworkTree {
|
|||
|
||||
@Override
|
||||
protected ZLImage createCover() {
|
||||
return createCover(Item, true);
|
||||
return createCoverForItem(Library, Item, true);
|
||||
}
|
||||
|
||||
public boolean isContentValid() {
|
||||
|
@ -221,7 +221,7 @@ public class NetworkCatalogTree extends NetworkTree {
|
|||
myChildrenItems.clear();
|
||||
myLastTotalChildren = -1;
|
||||
clear();
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
Library.fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
}
|
||||
|
||||
private final Set<NetworkTree> myUnconfirmedTrees =
|
||||
|
@ -240,7 +240,7 @@ public class NetworkCatalogTree extends NetworkTree {
|
|||
public synchronized void loadMoreChildren(int currentTotal) {
|
||||
if (currentTotal == subtrees().size()
|
||||
&& myLastTotalChildren < currentTotal
|
||||
&& !NetworkLibrary.Instance().isLoadingInProgress(this)
|
||||
&& !Library.isLoadingInProgress(this)
|
||||
&& Item.canResumeLoading()) {
|
||||
myLastTotalChildren = currentTotal;
|
||||
startItemsLoader(new QuietNetworkContext(), false, true);
|
||||
|
|
|
@ -26,15 +26,14 @@ import org.geometerplus.fbreader.network.NetworkLibrary;
|
|||
import org.geometerplus.fbreader.network.NetworkItem;
|
||||
|
||||
public abstract class NetworkItemsLoader implements Runnable {
|
||||
private final NetworkCatalogTree myTree;
|
||||
|
||||
private volatile Runnable myPostRunnable;
|
||||
private volatile boolean myFinishedFlag;
|
||||
public final ZLNetworkContext NetworkContext;
|
||||
public final NetworkCatalogTree Tree;
|
||||
|
||||
protected NetworkItemsLoader(ZLNetworkContext nc, NetworkCatalogTree tree) {
|
||||
NetworkContext = nc;
|
||||
myTree = tree;
|
||||
Tree = tree;
|
||||
}
|
||||
|
||||
public final void start() {
|
||||
|
@ -43,19 +42,14 @@ public abstract class NetworkItemsLoader implements Runnable {
|
|||
loaderThread.start();
|
||||
}
|
||||
|
||||
public NetworkCatalogTree getTree() {
|
||||
return myTree;
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkLibrary library = Tree.Library;
|
||||
|
||||
synchronized (library) {
|
||||
final NetworkCatalogTree tree = getTree();
|
||||
if (library.isLoadingInProgress(tree)) {
|
||||
if (library.isLoadingInProgress(Tree)) {
|
||||
return;
|
||||
}
|
||||
library.storeLoader(tree, this);
|
||||
library.storeLoader(Tree, this);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -75,7 +69,7 @@ public abstract class NetworkItemsLoader implements Runnable {
|
|||
onFinish(e, isLoadingInterrupted());
|
||||
}
|
||||
} finally {
|
||||
library.removeStoredLoader(getTree());
|
||||
library.removeStoredLoader(Tree);
|
||||
library.fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
|
||||
synchronized (this) {
|
||||
if (myPostRunnable != null) {
|
||||
|
@ -127,7 +121,7 @@ public abstract class NetworkItemsLoader implements Runnable {
|
|||
}
|
||||
|
||||
public void onNewItem(final NetworkItem item) {
|
||||
getTree().addItem(item);
|
||||
Tree.addItem(item);
|
||||
}
|
||||
|
||||
public synchronized void setPostRunnable(Runnable action) {
|
||||
|
|
|
@ -26,7 +26,8 @@ public final class RootTree extends NetworkTree {
|
|||
|
||||
private final String myId;
|
||||
|
||||
public RootTree(String id, boolean isFake) {
|
||||
public RootTree(NetworkLibrary library, String id, boolean isFake) {
|
||||
super(library);
|
||||
IsFake = isFake;
|
||||
myId = id;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SearchCatalogTree extends NetworkCatalogTree {
|
|||
@Override
|
||||
public String getName() {
|
||||
final String pattern = ((SearchItem)Item).getPattern();
|
||||
if (pattern != null && NetworkLibrary.Instance().getStoredLoader(this) == null) {
|
||||
if (pattern != null && Library.getStoredLoader(this) == null) {
|
||||
return NetworkLibrary.resource().getResource("found").getValue();
|
||||
}
|
||||
return super.getName();
|
||||
|
@ -71,7 +71,7 @@ public class SearchCatalogTree extends NetworkCatalogTree {
|
|||
if (pattern != null) {
|
||||
return NetworkLibrary.resource().getResource("found").getResource("summary").getValue().replace("%s", pattern);
|
||||
}
|
||||
if (NetworkLibrary.Instance().getStoredLoader(this) != null) {
|
||||
if (Library.getStoredLoader(this) != null) {
|
||||
return NetworkLibrary.resource().getResource("search").getResource("summaryInProgress").getValue();
|
||||
}
|
||||
return super.getSummary();
|
||||
|
@ -96,6 +96,6 @@ public class SearchCatalogTree extends NetworkCatalogTree {
|
|||
return null;
|
||||
}
|
||||
final UrlInfo info = link.getUrlInfo(UrlInfo.Type.SearchIcon);
|
||||
return info != null ? createCover(info.Url, info.Mime) : null;
|
||||
return info != null ? createCoverFromUrl(Library, info.Url, info.Mime) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class Searcher extends NetworkItemsLoader {
|
|||
|
||||
@Override
|
||||
public void doBefore() {
|
||||
NetworkLibrary.Instance().NetworkSearchPatternOption.setValue(myPattern);
|
||||
Tree.Library.NetworkSearchPatternOption.setValue(myPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,15 +45,15 @@ class Searcher extends NetworkItemsLoader {
|
|||
|
||||
@Override
|
||||
public void load() throws ZLNetworkException {
|
||||
final SearchItem item = (SearchItem)getTree().Item;
|
||||
final SearchItem item = (SearchItem)Tree.Item;
|
||||
if (myPattern.equals(item.getPattern())) {
|
||||
if (getTree().hasChildren()) {
|
||||
if (Tree.hasChildren()) {
|
||||
myItemFound = true;
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.Found, getTree()
|
||||
Tree.Library.fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.Found, Tree
|
||||
);
|
||||
} else {
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(
|
||||
Tree.Library.fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.NotFound
|
||||
);
|
||||
}
|
||||
|
@ -65,10 +65,10 @@ class Searcher extends NetworkItemsLoader {
|
|||
@Override
|
||||
public synchronized void onNewItem(final NetworkItem item) {
|
||||
if (!myItemFound) {
|
||||
((SearchCatalogTree)getTree()).setPattern(myPattern);
|
||||
getTree().clearCatalog();
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.Found, getTree()
|
||||
((SearchCatalogTree)Tree).setPattern(myPattern);
|
||||
Tree.clearCatalog();
|
||||
Tree.Library.fireModelChangedEvent(
|
||||
NetworkLibrary.ChangeListener.Code.Found, Tree
|
||||
);
|
||||
myItemFound = true;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class Searcher extends NetworkItemsLoader {
|
|||
@Override
|
||||
protected void onFinish(ZLNetworkException exception, boolean interrupted) {
|
||||
if (!interrupted && !myItemFound) {
|
||||
NetworkLibrary.Instance().fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.NotFound);
|
||||
Tree.Library.fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.NotFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TopUpTree extends NetworkTree {
|
|||
|
||||
@Override
|
||||
protected ZLImage createCover() {
|
||||
return createCover(Item, true);
|
||||
return createCoverForItem(Library, Item, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue