mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
cleanup: unused code has been removed
This commit is contained in:
parent
636548d05e
commit
17b3b6f9e8
4 changed files with 11 additions and 17 deletions
|
@ -88,7 +88,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
||||||
if (mgr != null) {
|
if (mgr != null) {
|
||||||
if (mgr.mayBeAuthorised(false)) {
|
if (mgr.mayBeAuthorised(false)) {
|
||||||
addMenuItem(menu, SIGNOUT_ITEM_ID, "signOut", mgr.currentUserName());
|
addMenuItem(menu, SIGNOUT_ITEM_ID, "signOut", mgr.currentUserName());
|
||||||
if (Util.isTopupSupported(activity, item.Link)) {
|
if (Util.isTopupSupported(item.Link)) {
|
||||||
final String account = mgr.currentAccount();
|
final String account = mgr.currentAccount();
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
addMenuItem(menu, TOPUP_ITEM_ID, "topup", account);
|
addMenuItem(menu, TOPUP_ITEM_ID, "topup", account);
|
||||||
|
@ -177,7 +177,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
||||||
userName = mgr.currentUserName();
|
userName = mgr.currentUserName();
|
||||||
signOut = true;
|
signOut = true;
|
||||||
account = mgr.currentAccount();
|
account = mgr.currentAccount();
|
||||||
if (account != null && Util.isTopupSupported(activity, item.Link)) {
|
if (account != null && Util.isTopupSupported(item.Link)) {
|
||||||
topup = true;
|
topup = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
|
||||||
}
|
}
|
||||||
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
|
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
|
||||||
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
|
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
|
||||||
if (Util.isTopupSupported(this, link)) {
|
if (Util.isTopupSupported(link)) {
|
||||||
final TopupActions actions = NetworkView.Instance().getTopupActions();
|
final TopupActions actions = NetworkView.Instance().getTopupActions();
|
||||||
if (actions != null) {
|
if (actions != null) {
|
||||||
actions.buildContextMenu(this, menu, link);
|
actions.buildContextMenu(this, menu, link);
|
||||||
|
@ -242,7 +242,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
|
||||||
}
|
}
|
||||||
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
|
} else if (getCurrentTree() instanceof NetworkCatalogTree) {
|
||||||
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
|
final INetworkLink link = ((NetworkCatalogTree)getCurrentTree()).Item.Link;
|
||||||
if (Util.isTopupSupported(this, link)) {
|
if (Util.isTopupSupported(link)) {
|
||||||
final TopupActions actions = NetworkView.Instance().getTopupActions();
|
final TopupActions actions = NetworkView.Instance().getTopupActions();
|
||||||
if (actions != null && actions.runAction(this, link, item.getItemId())) {
|
if (actions != null && actions.runAction(this, link, item.getItemId())) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.android.fbreader.network;
|
package org.geometerplus.android.fbreader.network;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
|
@ -39,6 +39,8 @@ import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||||
import org.geometerplus.android.util.UIUtil;
|
import org.geometerplus.android.util.UIUtil;
|
||||||
import org.geometerplus.android.util.PackageUtil;
|
import org.geometerplus.android.util.PackageUtil;
|
||||||
|
|
||||||
|
import org.geometerplus.android.fbreader.api.PluginApi;
|
||||||
|
|
||||||
abstract class Util implements UserRegistrationConstants {
|
abstract class Util implements UserRegistrationConstants {
|
||||||
private static final String REGISTRATION_ACTION =
|
private static final String REGISTRATION_ACTION =
|
||||||
"android.fbreader.action.NETWORK_LIBRARY_REGISTER";
|
"android.fbreader.action.NETWORK_LIBRARY_REGISTER";
|
||||||
|
@ -194,24 +196,17 @@ abstract class Util implements UserRegistrationConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isTopupSupported(Activity activity, INetworkLink link) {
|
static boolean isTopupSupported(INetworkLink link) {
|
||||||
return
|
final List<PluginApi.TopupActionInfo> infos =
|
||||||
isTopupSupported(activity, link, BROWSER_ACTION_ID) ||
|
NetworkView.Instance().TopupActionInfos.get(link.getUrlInfo(UrlInfo.Type.Catalog).Url);
|
||||||
isTopupSupported(activity, link, SMS_ACTION_ID) ||
|
return infos != null && infos.size() > 0;
|
||||||
isTopupSupported(activity, link, CREDIT_CARD_ACTION_ID) ||
|
|
||||||
isTopupSupported(activity, link, SELF_SERVICE_ACTION_ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isTopupSupported(Activity activity, INetworkLink link, String actionId) {
|
static boolean isTopupSupported(Activity activity, INetworkLink link, String actionId) {
|
||||||
if (BROWSER_ACTION_ID.equals(actionId)) {
|
if (BROWSER_ACTION_ID.equals(actionId)) {
|
||||||
return link.getUrl(UrlInfo.Type.TopUp) != null;
|
return link.getUrl(UrlInfo.Type.TopUp) != null;
|
||||||
} else {
|
} else {
|
||||||
final String url = link.getUrl(UrlInfo.Type.Catalog) + "/" + actionId;
|
return false;
|
||||||
return testService(
|
|
||||||
activity,
|
|
||||||
TOPUP_ACTION,
|
|
||||||
url
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue