mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
related links in network book info activity
This commit is contained in:
parent
951bfb554c
commit
7600f00b68
19 changed files with 118 additions and 30 deletions
|
@ -130,6 +130,7 @@
|
|||
<node name="indexInSeries" value="Díl v sérii:"/>
|
||||
<node name="tags" value="Štítky:"/>
|
||||
<node name="catalog" value="Katalog:"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Informace o knize"/>
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
<node name="indexInSeries" value="Seriennummer:" />
|
||||
<node name="tags" value="Tags:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Buchinformation" />
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<node name="indexInSeries" value="Index in series:" />
|
||||
<node name="tags" value="Tags:" />
|
||||
<node name="catalog" value="Catalog:" />
|
||||
<node name="extraLinks" value="Related links" />
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Book Info" />
|
||||
|
@ -179,7 +180,7 @@
|
|||
</node>
|
||||
<node name="cancelMenu">
|
||||
<node name="previousBook" value="Open previous book"/>
|
||||
<node name="returnTo" value="Return to ..."/>
|
||||
<node name="returnTo" value="Return to …"/>
|
||||
<node name="back" value="Back"/>
|
||||
<node name="forward" value="Forward"/>
|
||||
<node name="close" value="Close FBReader"/>
|
||||
|
@ -195,7 +196,7 @@
|
|||
<node name="navigate" value="Navigate">
|
||||
<node name="toc" value="Table of Contents"/>
|
||||
<node name="gotoHome" value="Go to Start of Document"/>
|
||||
<node name="gotoPageNumber" value="Go to Page..."/>
|
||||
<node name="gotoPageNumber" value="Go to Page…"/>
|
||||
<node name="gotoSectionStart" value="Go to Start of Text Section"/>
|
||||
<node name="gotoSectionEnd" value="Go to End of Text Section"/>
|
||||
<node name="nextTOCSection" value="Go to Next TOC Item"/>
|
||||
|
@ -526,7 +527,7 @@
|
|||
<node name="right_to_left" value="Right to left page scrolling"/>
|
||||
<node name="up" value="Down to up page scrolling"/>
|
||||
<node name="down" value="Up to down page scrolling"/>
|
||||
<node name="custom" value="Custom..."/>
|
||||
<node name="custom" value="Custom…"/>
|
||||
</node>
|
||||
</node>
|
||||
<node name="dictionary" value="Dictionary">
|
||||
|
@ -586,18 +587,18 @@
|
|||
</node>
|
||||
<node name="waitMessage">
|
||||
<node name="downloadingFile" value="Downloading book %s"/>
|
||||
<node name="search" value="Searching. Please, wait..."/>
|
||||
<node name="loadInfo" value="Loading information. Please, wait..."/>
|
||||
<node name="loadingBook" value="Opening book. Please, wait..."/>
|
||||
<node name="loadingBookList" value="Opening library. Please, wait..."/>
|
||||
<node name="creatingBooksDatabase" value="Creating books database. Please, wait..."/>
|
||||
<node name="updatingBooksDatabase" value="Updating books database. Please, wait..."/>
|
||||
<node name="loadingNetworkLibrary" value="Opening library. Please, wait..." />
|
||||
<node name="authentication" value="Authentication. Please, wait..." />
|
||||
<node name="signOut" value="Signing out. Please, wait..." />
|
||||
<node name="purchaseBook" value="Purchase book. Please, wait..." />
|
||||
<node name="loadingCatalogInfo" value="Loading catalog information. Please, wait..." />
|
||||
<node name="updatingCatalogsList" value="Updating catalogs list. Please, wait..."/>
|
||||
<node name="search" value="Searching. Please, wait…"/>
|
||||
<node name="loadInfo" value="Loading information. Please, wait…"/>
|
||||
<node name="loadingBook" value="Opening book. Please, wait…"/>
|
||||
<node name="loadingBookList" value="Opening library. Please, wait…"/>
|
||||
<node name="creatingBooksDatabase" value="Creating books database. Please, wait…"/>
|
||||
<node name="updatingBooksDatabase" value="Updating books database. Please, wait…"/>
|
||||
<node name="loadingNetworkLibrary" value="Opening library. Please, wait…" />
|
||||
<node name="authentication" value="Authentication. Please, wait…" />
|
||||
<node name="signOut" value="Signing out. Please, wait…" />
|
||||
<node name="purchaseBook" value="Purchase book. Please, wait…" />
|
||||
<node name="loadingCatalogInfo" value="Loading catalog information. Please, wait…" />
|
||||
<node name="updatingCatalogsList" value="Updating catalogs list. Please, wait…"/>
|
||||
</node>
|
||||
<node name="networkError">
|
||||
<node name="internalError" value="Internal server error" />
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<node name="indexInSeries" value="Index dans les séries:" />
|
||||
<node name="tags" value="Tags:" />
|
||||
<node name="catalog" value="Catalogue:"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Informations sur le livre" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Índices das series:" />
|
||||
<node name="tags" value="Etiquetas:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Información do libro" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Sorszám:" />
|
||||
<node name="tags" value="Címkék:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Könyv adatai" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Indice in serie:" />
|
||||
<node name="tags" value="Etichette:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Info Libro" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Nummer in serie:" />
|
||||
<node name="tags" value="Trefwoorden:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Boekinformatie" />
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
<node name="indexInSeries" value="Номер в серии:" />
|
||||
<node name="tags" value="Категории:" />
|
||||
<node name="catalog" value="Каталог:" />
|
||||
<node name="extraLinks" value="Ссылки" />
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Информация о книге" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="ดัชนีชุดหนังสือ:"/>
|
||||
<node name="tags" value="แท็ก:"/>
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="ข้อมูลหนังสือ"/>
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Номер у серії:" />
|
||||
<node name="tags" value="Категорії:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Інформація про книгу" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="Chỉ mục trong bộ:" />
|
||||
<node name="tags" value="Từ khóa:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="Thông tin sách" />
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<node name="indexInSeries" value="系列序号:" />
|
||||
<node name="tags" value="标签:" />
|
||||
<node name="catalog" value="Catalog:" toBeTranslated="true"/>
|
||||
<node name="extraLinks" value="Related links" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="bookInfo">
|
||||
<node name="bookInfo" value="书籍信息" />
|
||||
|
|
26
res/layout/extra_link_item.xml
Normal file
26
res/layout/extra_link_item.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/extra_link_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical|left"
|
||||
android:paddingLeft="5dip"
|
||||
android:paddingRight="8dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
/>
|
||||
<View
|
||||
android:id="@+id/extra_link_divider"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="?android:attr/listDivider"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -119,6 +119,17 @@
|
|||
android:padding="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/network_book_extra_links_title"
|
||||
style="?android:attr/listSeparatorTextViewStyle"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/network_book_extra_links"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<UrlInfo> 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))
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue