mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
cleanup
This commit is contained in:
parent
c5f9ea0bd4
commit
77705fa133
3 changed files with 9 additions and 28 deletions
|
@ -234,15 +234,11 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
}
|
||||
|
||||
setTextById(R.id.add_custom_catalog_url, textUrl);
|
||||
String siteName = uri.getHost();
|
||||
final String siteName = uri.getHost();
|
||||
if (isEmptyString(siteName)) {
|
||||
setErrorByKey("invalidUrl");
|
||||
return;
|
||||
}
|
||||
|
||||
if (siteName.startsWith("www.")) {
|
||||
siteName = siteName.substring(4);
|
||||
}
|
||||
final HashMap<String,UrlInfo> infos = new HashMap<String,UrlInfo>();
|
||||
infos.put(INetworkLink.URL_MAIN, new UrlInfo(textUrl));
|
||||
myLink = new OPDSCustomLink(
|
||||
|
|
|
@ -499,26 +499,4 @@ public class NetworkLibrary {
|
|||
NetworkDatabase.Instance().deleteCustomLink(link);
|
||||
invalidateChildren();
|
||||
}
|
||||
|
||||
public boolean hasCustomLinkTitle(String title, INetworkLink exceptFor) {
|
||||
synchronized (myLinks) {
|
||||
for (INetworkLink link : myLinks) {
|
||||
if (link != exceptFor && link.getTitle().equals(title)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasCustomLinkSite(String siteName, INetworkLink exceptFor) {
|
||||
synchronized (myLinks) {
|
||||
for (INetworkLink link : myLinks) {
|
||||
if (link != exceptFor && link.getSiteName().equals(siteName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,15 @@ public class OPDSCustomLink extends OPDSNetworkLink implements ICustomNetworkLin
|
|||
|
||||
private boolean myHasChanges;
|
||||
|
||||
private static String removeWWWPrefix(String siteName) {
|
||||
if (siteName != null && siteName.startsWith("www.")) {
|
||||
return siteName.substring(4);
|
||||
}
|
||||
return siteName;
|
||||
}
|
||||
|
||||
public OPDSCustomLink(int id, String siteName, String title, String summary, Map<String,UrlInfo> infos) {
|
||||
super(siteName, title, summary, null, infos, false);
|
||||
super(removeWWWPrefix(siteName), title, summary, null, infos, false);
|
||||
myId = id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue