1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 19:42:17 +02:00

cleanup: unused code has been removed

This commit is contained in:
Nikolay Pultsin 2011-08-16 17:53:56 +01:00
parent 636548d05e
commit 17b3b6f9e8
4 changed files with 11 additions and 17 deletions

View file

@ -88,7 +88,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
if (mgr != null) {
if (mgr.mayBeAuthorised(false)) {
addMenuItem(menu, SIGNOUT_ITEM_ID, "signOut", mgr.currentUserName());
if (Util.isTopupSupported(activity, item.Link)) {
if (Util.isTopupSupported(item.Link)) {
final String account = mgr.currentAccount();
if (account != null) {
addMenuItem(menu, TOPUP_ITEM_ID, "topup", account);
@ -177,7 +177,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
userName = mgr.currentUserName();
signOut = true;
account = mgr.currentAccount();
if (account != null && Util.isTopupSupported(activity, item.Link)) {
if (account != null && Util.isTopupSupported(item.Link)) {
topup = true;
}
} else {

View file

@ -218,7 +218,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
}
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
if (Util.isTopupSupported(this, link)) {
if (Util.isTopupSupported(link)) {
final TopupActions actions = NetworkView.Instance().getTopupActions();
if (actions != null) {
actions.buildContextMenu(this, menu, link);
@ -242,7 +242,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
}
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
if (Util.isTopupSupported(this, link)) {
if (Util.isTopupSupported(link)) {
final TopupActions actions = NetworkView.Instance().getTopupActions();
if (actions != null && actions.runAction(this, link, item.getItemId())) {
return true;

View file

@ -20,7 +20,6 @@
package org.geometerplus.android.fbreader.network;
import java.util.List;
import java.util.ArrayList;
import android.app.Activity;
import android.view.View;

View file

@ -39,6 +39,8 @@ import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
import org.geometerplus.android.util.UIUtil;
import org.geometerplus.android.util.PackageUtil;
import org.geometerplus.android.fbreader.api.PluginApi;
abstract class Util implements UserRegistrationConstants {
private static final String REGISTRATION_ACTION =
"android.fbreader.action.NETWORK_LIBRARY_REGISTER";
@ -194,24 +196,17 @@ abstract class Util implements UserRegistrationConstants {
}
}
static boolean isTopupSupported(Activity activity, INetworkLink link) {
return
isTopupSupported(activity, link, BROWSER_ACTION_ID) ||
isTopupSupported(activity, link, SMS_ACTION_ID) ||
isTopupSupported(activity, link, CREDIT_CARD_ACTION_ID) ||
isTopupSupported(activity, link, SELF_SERVICE_ACTION_ID);
static boolean isTopupSupported(INetworkLink link) {
final List<PluginApi.TopupActionInfo> infos =
NetworkView.Instance().TopupActionInfos.get(link.getUrlInfo(UrlInfo.Type.Catalog).Url);
return infos != null && infos.size() > 0;
}
static boolean isTopupSupported(Activity activity, INetworkLink link, String actionId) {
if (BROWSER_ACTION_ID.equals(actionId)) {
return link.getUrl(UrlInfo.Type.TopUp) != null;
} else {
final String url = link.getUrl(UrlInfo.Type.Catalog) + "/" + actionId;
return testService(
activity,
TOPUP_ACTION,
url
);
return false;
}
}