diff --git a/TODO.CustomCatalog b/TODO.CustomCatalog new file mode 100644 index 000000000..faee9c60e --- /dev/null +++ b/TODO.CustomCatalog @@ -0,0 +1,3 @@ +* hide keyboard after link loading +* custom link editing +* start FBReader in new task diff --git a/src/org/geometerplus/android/fbreader/network/AddCustomCatalogActivity.java b/src/org/geometerplus/android/fbreader/network/AddCustomCatalogActivity.java index 81078a286..e1512ec50 100644 --- a/src/org/geometerplus/android/fbreader/network/AddCustomCatalogActivity.java +++ b/src/org/geometerplus/android/fbreader/network/AddCustomCatalogActivity.java @@ -41,7 +41,7 @@ import org.geometerplus.android.util.UIUtil; public class AddCustomCatalogActivity extends Activity { private ZLResource myResource; - private String myURL; + private ICustomNetworkLink myLink; @Override public void onCreate(Bundle icicle) { @@ -63,28 +63,7 @@ public class AddCustomCatalogActivity extends Activity { setupButton( R.id.add_custom_catalog_ok_button, "ok", new View.OnClickListener() { public void onClick(View view) { - if (isEmptyString(myURL)) { - final String url = getTextById(R.id.add_custom_catalog_url); - if (isEmptyString(url)) { - setErrorByKey("urlIsEmpty"); - } else { - try { - Uri uri = Uri.parse(url); - if (isEmptyString(uri.getScheme())) { - uri = Uri.parse("http://" + url); - } - if (isEmptyString(uri.getHost())) { - setErrorByKey("invalidUrl"); - } else { - loadInfoByUri(uri); - } - } catch (Throwable t) { - setErrorByKey("invalidUrl"); - } - } - } else { - gotoNetworkLibrary(); - } + onOkButton(); } } ); @@ -101,11 +80,54 @@ public class AddCustomCatalogActivity extends Activity { loadInfoByUri(uri); setExtraFieldsVisibility(true); } else { - myURL = null; + myLink = null; setExtraFieldsVisibility(false); } } + private void onOkButton() { + final String textUrl = getTextById(R.id.add_custom_catalog_url); + if (isEmptyString(textUrl)) { + setErrorByKey("urlIsEmpty"); + return; + } + + final String title = getTextById(R.id.add_custom_catalog_title); + final String summary = getTextById(R.id.add_custom_catalog_summary); + Uri uri = null; + try { + uri = Uri.parse(textUrl); + if (isEmptyString(uri.getScheme())) { + uri = Uri.parse("http://" + textUrl); + } + if (isEmptyString(uri.getHost())) { + setErrorByKey("invalidUrl"); + return; + } + } catch (Throwable t) { + setErrorByKey("invalidUrl"); + return; + } + if (myLink == null) { + loadInfoByUri(uri); + } else if (isEmptyString(title)) { + setErrorByKey("titleIsEmpty"); + } else { + startActivity( + new Intent( + NetworkLibraryActivity.ADD_CATALOG, + uri, + AddCustomCatalogActivity.this, + NetworkLibraryActivity.class + ) + .putExtra(NetworkLibraryActivity.ADD_CATALOG_TITLE_KEY, title) + .putExtra(NetworkLibraryActivity.ADD_CATALOG_SUMMARY_KEY, summary) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP) + ); + finish(); + } + } + private boolean isEmptyString(String s) { return s == null || s.length() == 0; } @@ -120,14 +142,6 @@ public class AddCustomCatalogActivity extends Activity { }); } - private void gotoNetworkLibrary() { - startActivity( - new Intent(AddCustomCatalogActivity.this, NetworkLibraryActivity.class) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP) - ); - finish(); - } - private void setTextById(int id, String text) { ((TextView)findViewById(id)).setText(text); } @@ -197,15 +211,15 @@ public class AddCustomCatalogActivity extends Activity { } private void loadInfoByUri(Uri uri) { - myURL = uri.toString(); + String textUrl = uri.toString(); if (isEmptyString(uri.getScheme())) { - myURL = "http://" + myURL; - uri = Uri.parse(myURL); + textUrl = "http://" + textUrl; + uri = Uri.parse(textUrl); } else if ("opds".equals(uri.getScheme())) { - myURL = "http" + uri.toString().substring(4); + textUrl = "http" + uri.toString().substring(4); } - setTextById(R.id.add_custom_catalog_url, myURL); + setTextById(R.id.add_custom_catalog_url, textUrl); String siteName = uri.getHost(); if (isEmptyString(siteName)) { setErrorByKey("invalidUrl"); @@ -215,8 +229,7 @@ public class AddCustomCatalogActivity extends Activity { if (siteName.startsWith("www.")) { siteName = siteName.substring(4); } - final ICustomNetworkLink link = - OPDSLinkReader.createCustomLinkWithoutInfo(siteName, myURL); + myLink = OPDSLinkReader.createCustomLink(siteName, null, null, textUrl); final Runnable loadInfoRunnable = new Runnable() { private String myError; @@ -224,15 +237,15 @@ public class AddCustomCatalogActivity extends Activity { public void run() { try { myError = null; - link.reloadInfo(); + myLink.reloadInfo(); } catch (ZLNetworkException e) { myError = e.getMessage(); } runOnUiThread(new Runnable() { public void run() { if (myError == null) { - setTextById(R.id.add_custom_catalog_title, link.getTitle()); - setTextById(R.id.add_custom_catalog_summary, link.getSummary()); + setTextById(R.id.add_custom_catalog_title, myLink.getTitle()); + setTextById(R.id.add_custom_catalog_summary, myLink.getSummary()); setExtraFieldsVisibility(true); } else { runErrorDialog(myError); diff --git a/src/org/geometerplus/android/fbreader/network/CustomCatalogDialog.java b/src/org/geometerplus/android/fbreader/network/CustomCatalogDialog.java deleted file mode 100644 index 944c2122c..000000000 --- a/src/org/geometerplus/android/fbreader/network/CustomCatalogDialog.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2010-2011 Geometer Plus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -package org.geometerplus.android.fbreader.network; - -import android.app.Dialog; -import android.app.AlertDialog; -import android.net.Uri; -import android.os.Handler; -import android.os.Message; -import android.view.View; -import android.widget.TextView; -import android.content.DialogInterface; - -import org.geometerplus.zlibrary.core.resources.ZLResource; -import org.geometerplus.zlibrary.core.network.ZLNetworkException; - -import org.geometerplus.zlibrary.ui.android.R; - -import org.geometerplus.android.util.UIUtil; - -import org.geometerplus.fbreader.network.*; -import org.geometerplus.fbreader.network.opds.OPDSLinkReader; - - -class CustomCatalogDialog extends NetworkDialog { - - private String myTitle; - private String myUrl; - private String mySummary; - - private boolean myLinkWithoutInfo; - - public CustomCatalogDialog() { - super("CustomCatalogDialog"); - } - - @Override - protected void clearData() { - myTitle = myUrl = mySummary = null; - myLinkWithoutInfo = false; - } - - @Override - protected View createLayout() { - final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_custom_catalog_dialog, null); - - ((TextView) layout.findViewById(R.id.network_catalog_title_text)).setText(myResource.getResource("catalogTitle").getValue()); - ((TextView) layout.findViewById(R.id.network_catalog_url_text)).setText(myResource.getResource("catalogUrl").getValue()); - ((TextView) layout.findViewById(R.id.network_catalog_summary_text)).setText(myResource.getResource("catalogSummary").getValue()); - ((TextView) layout.findViewById(R.id.network_catalog_title_example)).setText(myResource.getResource("catalogTitleExample").getValue()); - ((TextView) layout.findViewById(R.id.network_catalog_url_example)).setText(myResource.getResource("catalogUrlExample").getValue()); - ((TextView) layout.findViewById(R.id.network_catalog_summary_example)).setText(myResource.getResource("catalogSummaryExample").getValue()); - - return layout; - } - - @Override - protected void onPositive(DialogInterface dialog) { - AlertDialog alert = (AlertDialog) dialog; - myTitle = ((TextView) alert.findViewById(R.id.network_catalog_title)).getText().toString().trim(); - myUrl = ((TextView) alert.findViewById(R.id.network_catalog_url)).getText().toString().trim(); - mySummary = ((TextView) alert.findViewById(R.id.network_catalog_summary)).getText().toString().trim(); - - if (myTitle.length() == 0) { - myTitle = null; - if (myLink != null) { - final String err = myResource.getResource("titleIsEmpty").getValue(); - sendError(true, false, err); - return; - } - } - if (myUrl.length() == 0) { - myUrl = null; - final String err = myResource.getResource("urlIsEmpty").getValue(); - sendError(true, false, err); - return; - } - if (mySummary.length() == 0) { - mySummary = null; - } - - Uri uri = Uri.parse(myUrl); - if (uri.getScheme() == null) { - myUrl = "http://" + myUrl; - uri = Uri.parse(myUrl); - } - - String siteName = uri.getHost(); - if (siteName == null) { - final String err = myResource.getResource("invalidUrl").getValue(); - sendError(true, false, err); - return; - } - if (siteName.startsWith("www.")) { - siteName = siteName.substring(4); - } - - final NetworkLibrary library = NetworkLibrary.Instance(); - if (myLink != null && library.hasCustomLinkTitle(myTitle, myLink)) { - final String err = myResource.getResource("titleAlreadyExists").getValue(); - sendError(true, false, err); - return; - } - if (library.hasCustomLinkSite(siteName, myLink)) { - final String err = myResource.getResource("siteAlreadyExists").getValue(); - sendError(true, false, err); - return; - } - - if (myLink != null) { - final ICustomNetworkLink link = (ICustomNetworkLink) myLink; - link.setSiteName(siteName); - link.setTitle(myTitle); - link.setSummary(mySummary); - link.setLink(INetworkLink.URL_MAIN, myUrl); - - if (myLinkWithoutInfo) { - NetworkLibrary.Instance().addCustomLink(link); - myLinkWithoutInfo = false; - } else { - link.saveLink(); - } - sendSuccess(true); - return; - } - - myLinkWithoutInfo = true; - myLink = OPDSLinkReader.createCustomLinkWithoutInfo(siteName, myUrl); - - final Handler handler = new Handler() { - public void handleMessage(Message msg) { - final String err = (String) msg.obj; - if (err != null) { - final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - if (which == DialogInterface.BUTTON_NEGATIVE) { - sendSuccess(true); - } else { - if (which == DialogInterface.BUTTON_NEUTRAL) { - myLinkWithoutInfo = false; - myLink = null; - } - sendError(true, false, null); - } - } - }; - final ZLResource dialogResource = ZLResource.resource("dialog"); - final ZLResource boxResource = dialogResource.getResource("networkError"); - final ZLResource buttonResource = dialogResource.getResource("button"); - new AlertDialog.Builder(myActivity) - .setTitle(boxResource.getResource("title").getValue()) - .setMessage(err) - .setIcon(0) - .setPositiveButton(buttonResource.getResource("continue").getValue(), listener) - .setNeutralButton(buttonResource.getResource("editUrl").getValue(), listener) - .setNegativeButton(buttonResource.getResource("cancel").getValue(), listener) - .setOnCancelListener(new DialogInterface.OnCancelListener() { - public void onCancel(DialogInterface dialog) { - listener.onClick(dialog, DialogInterface.BUTTON_NEGATIVE); - } - }) - .create().show(); - } else { - sendError(true, false, null); - } - } - }; - - final Runnable loadInfoRunnable = new Runnable() { - public void run() { - String error = null; - try { - ((ICustomNetworkLink)myLink).reloadInfo(); - } catch (ZLNetworkException e) { - error = e.getMessage(); - } - handler.sendMessage(handler.obtainMessage(0, error)); - } - }; - UIUtil.wait("loadingCatalogInfo", loadInfoRunnable, myActivity); - } - - @Override - protected void onNegative(DialogInterface dialog) { - sendCancel(false); - } - - @Override - public void prepareDialogInternal(Dialog dialog) { - if (myLink != null) { - if (myTitle == null) myTitle = myLink.getTitle(); - if (myUrl == null) myUrl = myLink.getLink(INetworkLink.URL_MAIN); - if (mySummary == null) mySummary = myLink.getSummary(); - } - ((TextView) dialog.findViewById(R.id.network_catalog_title)).setText(myTitle); - ((TextView) dialog.findViewById(R.id.network_catalog_url)).setText(myUrl); - ((TextView) dialog.findViewById(R.id.network_catalog_summary)).setText(mySummary); - - final int examplesVisibility = (myLink == null || myLinkWithoutInfo) ? View.VISIBLE : View.GONE; - dialog.findViewById(R.id.network_catalog_title_example).setVisibility(examplesVisibility); - dialog.findViewById(R.id.network_catalog_url_example).setVisibility(examplesVisibility); - dialog.findViewById(R.id.network_catalog_summary_example).setVisibility(examplesVisibility); - - final int groupsVisibility = (myLink != null) ? View.VISIBLE : View.GONE; - dialog.findViewById(R.id.network_catalog_title_group).setVisibility(groupsVisibility); - dialog.findViewById(R.id.network_catalog_summary_group).setVisibility(groupsVisibility); - - final TextView error = (TextView) dialog.findViewById(R.id.network_catalog_error); - if (myErrorMessage == null) { - error.setVisibility(View.GONE); - error.setText(""); - } else { - error.setVisibility(View.VISIBLE); - error.setText(myErrorMessage); - } - - View dlgView = dialog.findViewById(R.id.network_custom_catalog_dialog); - dlgView.invalidate(); - dlgView.requestLayout(); - } -} diff --git a/src/org/geometerplus/android/fbreader/network/NetworkCatalogActions.java b/src/org/geometerplus/android/fbreader/network/NetworkCatalogActions.java index 2fe1265e6..5347765eb 100644 --- a/src/org/geometerplus/android/fbreader/network/NetworkCatalogActions.java +++ b/src/org/geometerplus/android/fbreader/network/NetworkCatalogActions.java @@ -246,7 +246,7 @@ class NetworkCatalogActions extends NetworkTreeActions { new RefillAccountActions().runStandalone(activity, ((RefillAccountTree)activity.getDefaultTree()).Link); return true; case CUSTOM_CATALOG_EDIT: - NetworkDialog.show(activity, NetworkDialog.DIALOG_CUSTOM_CATALOG, ((NetworkCatalogTree)tree).Item.Link, null); + //NetworkDialog.show(activity, NetworkDialog.DIALOG_CUSTOM_CATALOG, ((NetworkCatalogTree)tree).Item.Link, null); return true; case CUSTOM_CATALOG_REMOVE: removeCustomLink((ICustomNetworkLink)((NetworkCatalogTree)tree).Item.Link); diff --git a/src/org/geometerplus/android/fbreader/network/NetworkDialog.java b/src/org/geometerplus/android/fbreader/network/NetworkDialog.java index 5a9347a77..45b8d4599 100644 --- a/src/org/geometerplus/android/fbreader/network/NetworkDialog.java +++ b/src/org/geometerplus/android/fbreader/network/NetworkDialog.java @@ -39,7 +39,6 @@ abstract class NetworkDialog { // dialog identifiers public static final int DIALOG_AUTHENTICATION = 0; - public static final int DIALOG_CUSTOM_CATALOG = 1; private static final TreeMap ourInstances = new TreeMap(); @@ -50,9 +49,6 @@ abstract class NetworkDialog { case DIALOG_AUTHENTICATION: dlg = new AuthenticationDialog(); break; - case DIALOG_CUSTOM_CATALOG: - dlg = new CustomCatalogDialog(); - break; } if (dlg != null) { dlg.myId = id; diff --git a/src/org/geometerplus/android/fbreader/network/NetworkLibraryActivity.java b/src/org/geometerplus/android/fbreader/network/NetworkLibraryActivity.java index e4b74009d..23c822f40 100644 --- a/src/org/geometerplus/android/fbreader/network/NetworkLibraryActivity.java +++ b/src/org/geometerplus/android/fbreader/network/NetworkLibraryActivity.java @@ -24,6 +24,7 @@ import java.util.*; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -40,9 +41,17 @@ import org.geometerplus.android.util.UIUtil; import org.geometerplus.fbreader.network.NetworkTree; import org.geometerplus.fbreader.network.NetworkLibrary; +import org.geometerplus.fbreader.network.ICustomNetworkLink; +import org.geometerplus.fbreader.network.opds.OPDSLinkReader; public class NetworkLibraryActivity extends NetworkBaseActivity { + final static String ADD_CATALOG = "android.fbreader.action.ADD_CATALOG"; + + final static String ADD_CATALOG_TITLE_KEY = "title"; + final static String ADD_CATALOG_SUMMARY_KEY = "summary"; + private NetworkTree myTree; + private volatile Intent myIntent; @Override public void onCreate(Bundle icicle) { @@ -50,6 +59,40 @@ public class NetworkLibraryActivity extends NetworkBaseActivity { requestWindowFeature(Window.FEATURE_NO_TITLE); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); + + myIntent = getIntent(); + } + + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + + processIntent(intent); + } + + private void processIntent(Intent intent) { + if (ADD_CATALOG.equals(intent.getAction())) { + final Uri uri = intent.getData(); + final String title = intent.getStringExtra(ADD_CATALOG_TITLE_KEY); + final String summary = intent.getStringExtra(ADD_CATALOG_SUMMARY_KEY); + if (uri != null && title != null) { + final ICustomNetworkLink link = OPDSLinkReader.createCustomLink( + uri.getHost(), title, summary, uri.toString() + ); + if (link != null) { + runOnUiThread(new Runnable() { + public void run() { + final NetworkLibrary library = NetworkLibrary.Instance(); + library.addCustomLink(link); + library.updateChildren(); + library.synchronize(); + NetworkView.Instance().fireModelChangedAsync(); + getListView().invalidateViews(); + } + }); + } + } + } } private void prepareView() { @@ -74,6 +117,10 @@ public class NetworkLibraryActivity extends NetworkBaseActivity { } } else { prepareView(); + if (myIntent != null) { + processIntent(myIntent); + myIntent = null; + } } } @@ -114,6 +161,10 @@ public class NetworkLibraryActivity extends NetworkBaseActivity { String error = null; try { NetworkView.Instance().initialize(); + if (myActivity.myIntent != null) { + myActivity.processIntent(myActivity.myIntent); + myActivity.myIntent = null; + } } catch (ZLNetworkException e) { error = e.getMessage(); } diff --git a/src/org/geometerplus/android/fbreader/network/SQLiteNetworkDatabase.java b/src/org/geometerplus/android/fbreader/network/SQLiteNetworkDatabase.java index 3c3abf2bb..324b4b36f 100644 --- a/src/org/geometerplus/android/fbreader/network/SQLiteNetworkDatabase.java +++ b/src/org/geometerplus/android/fbreader/network/SQLiteNetworkDatabase.java @@ -41,7 +41,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase { private void migrate() { final int version = myDatabase.getVersion(); - final int currentCodeVersion = 1; + final int currentCodeVersion = 2; if (version >= currentCodeVersion) { return; } @@ -49,12 +49,14 @@ class SQLiteNetworkDatabase extends NetworkDatabase { switch (version) { case 0: createTables(); + case 1: + updateTables1(); } myDatabase.setTransactionSuccessful(); myDatabase.endTransaction(); myDatabase.execSQL("VACUUM"); - myDatabase.setVersion(currentCodeVersion); + //myDatabase.setVersion(currentCodeVersion); } protected void executeAsATransaction(Runnable actions) { @@ -155,7 +157,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase { if (dbValue == null) { if (myInsertCustomLinkUrlStatement == null) { myInsertCustomLinkUrlStatement = myDatabase.compileStatement( - "INSERT INTO CustomLinkUrls(url,link_id,key) VALUES (?,?,?)"); + "INSERT OR REPLACE INTO CustomLinkUrls(url,link_id,key) VALUES (?,?,?)"); } urlStatement = myInsertCustomLinkUrlStatement; } else if (!value.equals(dbValue)) { @@ -230,4 +232,17 @@ class SQLiteNetworkDatabase extends NetworkDatabase { "url TEXT NOT NULL," + "CONSTRAINT CustomLinkUrls_PK PRIMARY KEY (key, link_id))"); } + + private void updateTables1() { + myDatabase.execSQL("ALTER TABLE CustomLinks RENAME TO CustomLinks_Obsolete"); + myDatabase.execSQL( + "CREATE TABLE CustomLinks(" + + "link_id INTEGER PRIMARY KEY," + + "title TEXT NOT NULL," + + "site_name TEXT NOT NULL," + + "summary TEXT," + + "icon TEXT)"); + myDatabase.execSQL("INSERT INTO CustomLinks (link_id,title,site_name,summary,icon) SELECT link_id,title,site_name,summary,icon FROM CustomLinks_Obsolete"); + myDatabase.execSQL("DROP TABLE CustomLinks_Obsolete"); + } } diff --git a/src/org/geometerplus/fbreader/network/NetworkLibrary.java b/src/org/geometerplus/fbreader/network/NetworkLibrary.java index 7f276b73f..20610314c 100644 --- a/src/org/geometerplus/fbreader/network/NetworkLibrary.java +++ b/src/org/geometerplus/fbreader/network/NetworkLibrary.java @@ -303,11 +303,6 @@ public class NetworkLibrary { myUpdateVisibility = true; } - - private static boolean linksEqual(INetworkLink l1, INetworkLink l2) { - return l1 == l2 || l1.getSiteName().equals(l2.getSiteName()); - } - private static boolean linkIsInvalid(INetworkLink link, INetworkLink nodeLink) { if (link instanceof ICustomNetworkLink) { if (link != nodeLink) { @@ -347,7 +342,7 @@ public class NetworkLibrary { continue; } final INetworkLink nodeLink = ((NetworkCatalogTree) currentNode).Item.Link; - if (linksEqual(link, nodeLink)) { + if (link == nodeLink) { if (linkIsInvalid(link, nodeLink)) { toRemove.add(currentNode); } else { @@ -360,7 +355,7 @@ public class NetworkLibrary { INetworkLink newNodeLink = null; for (int j = i; j < links.size(); ++j) { final INetworkLink jlnk = links.get(j); - if (linksEqual(nodeLink, jlnk)) { + if (nodeLink == jlnk) { newNodeLink = jlnk; break; } diff --git a/src/org/geometerplus/fbreader/network/opds/OPDSCustomLink.java b/src/org/geometerplus/fbreader/network/opds/OPDSCustomLink.java index ada9d7aa7..1af974740 100644 --- a/src/org/geometerplus/fbreader/network/opds/OPDSCustomLink.java +++ b/src/org/geometerplus/fbreader/network/opds/OPDSCustomLink.java @@ -33,9 +33,7 @@ import org.geometerplus.fbreader.network.ICustomNetworkLink; import org.geometerplus.fbreader.network.INetworkLink; import org.geometerplus.fbreader.network.NetworkException; - class OPDSCustomLink extends OPDSNetworkLink implements ICustomNetworkLink { - private int myId; private SaveLinkListener myListener; diff --git a/src/org/geometerplus/fbreader/network/opds/OPDSLinkReader.java b/src/org/geometerplus/fbreader/network/opds/OPDSLinkReader.java index e8933fadf..4c1a31325 100644 --- a/src/org/geometerplus/fbreader/network/opds/OPDSLinkReader.java +++ b/src/org/geometerplus/fbreader/network/opds/OPDSLinkReader.java @@ -46,10 +46,10 @@ public class OPDSLinkReader { return new OPDSCustomLink(id, siteName, title, summary, icon, links); } - public static ICustomNetworkLink createCustomLinkWithoutInfo(String siteName, String url) { + public static ICustomNetworkLink createCustomLink(String siteName, String title, String summary, String url) { final HashMap links = new HashMap(); links.put(INetworkLink.URL_MAIN, url); - return new OPDSCustomLink(ICustomNetworkLink.INVALID_ID, siteName, null, null, null, links); + return new OPDSCustomLink(ICustomNetworkLink.INVALID_ID, siteName, title, summary, null, links); } public static final int CACHE_LOAD = 0;