diff --git a/assets/resources/application/cs.xml b/assets/resources/application/cs.xml
index 1a5b838fa..7f7d52185 100644
--- a/assets/resources/application/cs.xml
+++ b/assets/resources/application/cs.xml
@@ -130,6 +130,7 @@
+
diff --git a/assets/resources/application/de.xml b/assets/resources/application/de.xml
index f2b8e90e1..943d1b38f 100644
--- a/assets/resources/application/de.xml
+++ b/assets/resources/application/de.xml
@@ -127,6 +127,7 @@
+
diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml
index 08b0381ac..473ee4e92 100644
--- a/assets/resources/application/en.xml
+++ b/assets/resources/application/en.xml
@@ -129,6 +129,7 @@
+
@@ -179,7 +180,7 @@
-
+
@@ -195,7 +196,7 @@
-
+
@@ -526,7 +527,7 @@
-
+
@@ -586,18 +587,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/resources/application/fr.xml b/assets/resources/application/fr.xml
index 11998b21a..3486dd166 100644
--- a/assets/resources/application/fr.xml
+++ b/assets/resources/application/fr.xml
@@ -129,6 +129,7 @@
+
diff --git a/assets/resources/application/gl.xml b/assets/resources/application/gl.xml
index 30c7ac018..7741bf670 100644
--- a/assets/resources/application/gl.xml
+++ b/assets/resources/application/gl.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/hu.xml b/assets/resources/application/hu.xml
index 02d590167..3158ff021 100644
--- a/assets/resources/application/hu.xml
+++ b/assets/resources/application/hu.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/it.xml b/assets/resources/application/it.xml
index d7630550a..4a64aeb63 100644
--- a/assets/resources/application/it.xml
+++ b/assets/resources/application/it.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/nl.xml b/assets/resources/application/nl.xml
index 25951a246..e1732b213 100644
--- a/assets/resources/application/nl.xml
+++ b/assets/resources/application/nl.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/ru.xml b/assets/resources/application/ru.xml
index a96c84641..304eaa893 100644
--- a/assets/resources/application/ru.xml
+++ b/assets/resources/application/ru.xml
@@ -125,6 +125,7 @@
+
diff --git a/assets/resources/application/th.xml b/assets/resources/application/th.xml
index 6a58944a8..3a2eda8dd 100644
--- a/assets/resources/application/th.xml
+++ b/assets/resources/application/th.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/uk.xml b/assets/resources/application/uk.xml
index 672208b10..c62c16959 100644
--- a/assets/resources/application/uk.xml
+++ b/assets/resources/application/uk.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/vi.xml b/assets/resources/application/vi.xml
index 076e7f52c..e8459e11a 100644
--- a/assets/resources/application/vi.xml
+++ b/assets/resources/application/vi.xml
@@ -126,6 +126,7 @@
+
diff --git a/assets/resources/application/zh.xml b/assets/resources/application/zh.xml
index cd700377a..74f87c687 100644
--- a/assets/resources/application/zh.xml
+++ b/assets/resources/application/zh.xml
@@ -126,6 +126,7 @@
+
diff --git a/res/layout/extra_link_item.xml b/res/layout/extra_link_item.xml
new file mode 100644
index 000000000..54f915154
--- /dev/null
+++ b/res/layout/extra_link_item.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
diff --git a/res/layout/network_book.xml b/res/layout/network_book.xml
index 034318973..d2473e391 100644
--- a/res/layout/network_book.xml
+++ b/res/layout/network_book.xml
@@ -119,6 +119,17 @@
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
+
+
+
diff --git a/src/org/geometerplus/android/fbreader/network/NetworkBookActions.java b/src/org/geometerplus/android/fbreader/network/NetworkBookActions.java
index 7f2bc0937..ae69ccd18 100644
--- a/src/org/geometerplus/android/fbreader/network/NetworkBookActions.java
+++ b/src/org/geometerplus/android/fbreader/network/NetworkBookActions.java
@@ -237,7 +237,7 @@ class NetworkBookActions extends NetworkTreeActions {
}
}
- static boolean runActionStatic(Activity activity, final NetworkBookTree tree, int actionCode) {
+ static boolean runActionStatic(final Activity activity, final NetworkBookTree tree, int actionCode) {
switch (actionCode) {
case SHOW_BOOK_ACTIVITY_ITEM_ID:
if (tree.Book.isFullyLoaded()) {
@@ -250,9 +250,13 @@ class NetworkBookActions extends NetworkTreeActions {
} catch (ZLNetworkException e) {
e.printStackTrace();
}
+ activity.runOnUiThread(new Runnable() {
+ public void run() {
+ Util.openTree(activity, tree);
+ }
+ });
}
}, activity);
- Util.openTree(activity, tree);
}
return true;
default:
diff --git a/src/org/geometerplus/android/fbreader/network/NetworkBookInfoActivity.java b/src/org/geometerplus/android/fbreader/network/NetworkBookInfoActivity.java
index 13addfd63..a732a4a64 100644
--- a/src/org/geometerplus/android/fbreader/network/NetworkBookInfoActivity.java
+++ b/src/org/geometerplus/android/fbreader/network/NetworkBookInfoActivity.java
@@ -19,26 +19,22 @@
package org.geometerplus.android.fbreader.network;
-import java.util.Set;
+import java.util.*;
import android.app.Activity;
-import android.app.Dialog;
import android.os.Bundle;
import android.util.DisplayMetrics;
-import android.view.View;
-import android.view.ContextMenu;
-import android.view.MenuItem;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
+import android.view.*;
+import android.widget.*;
import android.content.Intent;
import android.graphics.Bitmap;
import org.geometerplus.zlibrary.ui.android.R;
-import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.zlibrary.core.image.ZLLoadableImage;
+import org.geometerplus.zlibrary.core.resources.ZLResource;
+import org.geometerplus.zlibrary.core.util.MimeType;
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager;
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
@@ -47,6 +43,7 @@ import org.geometerplus.zlibrary.ui.android.network.SQLiteCookieDatabase;
import org.geometerplus.fbreader.network.NetworkTree;
import org.geometerplus.fbreader.network.NetworkBookItem;
import org.geometerplus.fbreader.network.tree.NetworkBookTree;
+import org.geometerplus.fbreader.network.urlInfo.*;
public class NetworkBookInfoActivity extends Activity implements NetworkView.EventListener {
private NetworkBookItem myBook;
@@ -98,6 +95,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
setTitle(myBook.Title);
setupDescription();
+ setupExtraLinks();
setupInfo();
setupCover();
setupButtons();
@@ -149,6 +147,38 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
setTextById(R.id.network_book_description, description);
}
+ private final void setupExtraLinks() {
+ final List extraLinks = myBook.getAllInfos(UrlInfo.Type.Related);
+ if (extraLinks.isEmpty()) {
+ findViewById(R.id.network_book_extra_links_title).setVisibility(View.GONE);
+ findViewById(R.id.network_book_extra_links).setVisibility(View.GONE);
+ } else {
+ setTextFromResource(R.id.network_book_extra_links_title, "extraLinks");
+ final LinearLayout extraLinkSection =
+ (LinearLayout)findViewById(R.id.network_book_extra_links);
+ final LayoutInflater inflater = getLayoutInflater();
+ View linkView = null;
+ for (UrlInfo info : extraLinks) {
+ if (!(info instanceof RelatedUrlInfo)) {
+ continue;
+ }
+ final RelatedUrlInfo relatedInfo = (RelatedUrlInfo)info;
+ linkView = inflater.inflate(R.layout.extra_link_item, extraLinkSection, false);
+ linkView.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View view) {
+ if (MimeType.TEXT_HTML.equals(relatedInfo.Mime)) {
+ Util.openInBrowser(NetworkBookInfoActivity.this, relatedInfo.Url);
+ }
+ System.err.println(relatedInfo.Url);
+ }
+ });
+ ((TextView)linkView.findViewById(R.id.extra_link_title)).setText(relatedInfo.Title);
+ extraLinkSection.addView(linkView);
+ }
+ linkView.findViewById(R.id.extra_link_divider).setVisibility(View.GONE);
+ }
+ }
+
private void setPairLabelTextFromResource(int id, String resourceKey) {
final LinearLayout layout = (LinearLayout)findViewById(id);
((TextView)layout.findViewById(R.id.book_info_key))
diff --git a/src/org/geometerplus/fbreader/network/opds/OPDSBookItem.java b/src/org/geometerplus/fbreader/network/opds/OPDSBookItem.java
index 032d8541a..3121614f5 100644
--- a/src/org/geometerplus/fbreader/network/opds/OPDSBookItem.java
+++ b/src/org/geometerplus/fbreader/network/opds/OPDSBookItem.java
@@ -128,9 +128,9 @@ public class OPDSBookItem extends NetworkBookItem implements OPDSConstants {
UrlInfo.Type.BookBuy, price, false);
}
} else if (referenceType == UrlInfo.Type.Related) {
- urls.addInfo(new TitledUrlInfo(referenceType, link.getTitle(), href));
+ urls.addInfo(new RelatedUrlInfo(referenceType, link.getTitle(), type, href));
} else if (referenceType == UrlInfo.Type.Comments) {
- urls.addInfo(new TitledUrlInfo(referenceType, link.getTitle(), href));
+ urls.addInfo(new RelatedUrlInfo(referenceType, link.getTitle(), type, href));
} else if (referenceType == UrlInfo.Type.TOC) {
urls.addInfo(new UrlInfo(referenceType, href));
} else if (referenceType != null) {
diff --git a/src/org/geometerplus/fbreader/network/urlInfo/TitledUrlInfo.java b/src/org/geometerplus/fbreader/network/urlInfo/RelatedUrlInfo.java
similarity index 81%
rename from src/org/geometerplus/fbreader/network/urlInfo/TitledUrlInfo.java
rename to src/org/geometerplus/fbreader/network/urlInfo/RelatedUrlInfo.java
index f5923420e..5871bf440 100644
--- a/src/org/geometerplus/fbreader/network/urlInfo/TitledUrlInfo.java
+++ b/src/org/geometerplus/fbreader/network/urlInfo/RelatedUrlInfo.java
@@ -19,13 +19,17 @@
package org.geometerplus.fbreader.network.urlInfo;
-public class TitledUrlInfo extends UrlInfo {
+import org.geometerplus.zlibrary.core.util.MimeType;
+
+public class RelatedUrlInfo extends UrlInfo {
private static final long serialVersionUID = -893514485257788098L;
public final String Title;
+ public final MimeType Mime;
- public TitledUrlInfo(Type type, String title, String url) {
+ public RelatedUrlInfo(Type type, String title, MimeType mime, String url) {
super(type, url);
Title = title;
+ Mime = mime;
}
}