mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
url rewriting for external references has been fixed
This commit is contained in:
parent
bcbcf2db42
commit
b243b2e704
2 changed files with 28 additions and 12 deletions
|
@ -227,7 +227,11 @@ public class NetworkLibrary {
|
|||
myLinks = new CompositeList(linksList, new LinksComparator());
|
||||
}
|
||||
|
||||
public void initialize() throws ZLNetworkException {
|
||||
private boolean myIsAlreadyInitialized;
|
||||
public synchronized void initialize() throws ZLNetworkException {
|
||||
if (myIsAlreadyInitialized) {
|
||||
return;
|
||||
}
|
||||
final LinksComparator comparator = new LinksComparator();
|
||||
|
||||
try {
|
||||
|
@ -243,7 +247,9 @@ public class NetworkLibrary {
|
|||
throw e;
|
||||
}
|
||||
|
||||
NetworkDatabase.Instance().loadCustomLinks(
|
||||
final NetworkDatabase db = NetworkDatabase.Instance();
|
||||
if (db != null) {
|
||||
db.loadCustomLinks(
|
||||
new NetworkDatabase.ICustomLinksHandler() {
|
||||
public void handleCustomLinkData(int id, String siteName,
|
||||
String title, String summary, String icon, Map<String, String> links) {
|
||||
|
@ -255,6 +261,7 @@ public class NetworkLibrary {
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/*testDate(new ATOMUpdated(2010, 1, 1, 1, 0, 0, 0, 2, 0),
|
||||
new ATOMUpdated(2009, 12, 31, 23, 0, 0, 0, 0, 0));
|
||||
|
@ -274,6 +281,7 @@ public class NetworkLibrary {
|
|||
new ATOMUpdated(2012, 2, 15, 23, 40, 1, 0, 3, 30));
|
||||
testDate(new ATOMUpdated(2012, 2, 15, 23, 40, 0, 0.001f, 3, 30),
|
||||
new ATOMUpdated(2012, 2, 15, 23, 40, 0, 0, 3, 30));*/
|
||||
myIsAlreadyInitialized = true;
|
||||
}
|
||||
|
||||
/*private void testDate(ATOMDateConstruct date1, ATOMDateConstruct date2) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.net.Uri;
|
|||
|
||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.R;
|
||||
import org.geometerplus.zlibrary.ui.android.view.ZLAndroidPaintContext;
|
||||
|
@ -38,6 +39,8 @@ import org.geometerplus.zlibrary.ui.android.dialogs.ZLAndroidDialogManager;
|
|||
import org.geometerplus.android.fbreader.network.BookDownloader;
|
||||
import org.geometerplus.android.fbreader.network.BookDownloaderService;
|
||||
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
|
||||
public final class ZLAndroidLibrary extends ZLibrary {
|
||||
private ZLAndroidActivity myActivity;
|
||||
private final Application myApplication;
|
||||
|
@ -81,7 +84,12 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
|||
externalUrl = false;
|
||||
}
|
||||
// FIXME: initialize network library and use rewriteUrl!!!
|
||||
//reference = NetworkLibrary.Instance().rewriteUrl(reference, externalUrl);
|
||||
final NetworkLibrary nLibrary = NetworkLibrary.Instance();
|
||||
try {
|
||||
nLibrary.initialize();
|
||||
} catch (ZLNetworkException e) {
|
||||
}
|
||||
reference = NetworkLibrary.Instance().rewriteUrl(reference, externalUrl);
|
||||
intent.setData(Uri.parse(reference));
|
||||
myActivity.startActivity(intent);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue