mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
adds catalogs declared in catalog plugins
This commit is contained in:
parent
73ec3b6378
commit
ab997eba70
2 changed files with 32 additions and 4 deletions
|
@ -25,13 +25,14 @@ import android.app.Activity;
|
|||
import android.content.*;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
import org.geometerplus.zlibrary.core.network.*;
|
||||
import org.geometerplus.zlibrary.core.options.Config;
|
||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||
|
||||
import org.geometerplus.fbreader.network.*;
|
||||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
import org.geometerplus.fbreader.network.urlInfo.BookUrlInfo;
|
||||
import org.geometerplus.fbreader.network.opds.OPDSCustomNetworkLink;
|
||||
import org.geometerplus.fbreader.network.urlInfo.*;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
import org.geometerplus.android.util.PackageUtil;
|
||||
|
@ -146,7 +147,31 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
System.err.println("empty catalog infos");
|
||||
return;
|
||||
}
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
for (String u : urls) {
|
||||
if (library.getLinkByUrl(u) != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final ICustomNetworkLink link = new OPDSCustomNetworkLink(
|
||||
INetworkLink.INVALID_ID,
|
||||
INetworkLink.Type.Custom,
|
||||
null, null, null,
|
||||
new UrlInfoCollection<UrlInfoWithDate>(new UrlInfoWithDate(
|
||||
UrlInfo.Type.Catalog, u, MimeType.APP_ATOM_XML
|
||||
))
|
||||
);
|
||||
final Runnable loader = new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
link.reloadInfo(new QuietNetworkContext(), false, false);
|
||||
library.addCustomLink(link);
|
||||
} catch (ZLNetworkException e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
new Thread(loader).start();
|
||||
|
||||
System.err.println("catalog info: " + u);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue