mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
user registration/signing in refactoring (in progress)
This commit is contained in:
parent
aaae97c551
commit
b483946d4d
10 changed files with 164 additions and 268 deletions
|
@ -20,17 +20,12 @@
|
|||
package org.geometerplus.android.fbreader.network;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.*;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.geometerplus.zlibrary.core.money.Money;
|
||||
|
||||
import org.geometerplus.fbreader.network.INetworkLink;
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
|
@ -42,9 +37,7 @@ import org.geometerplus.android.util.PackageUtil;
|
|||
|
||||
import org.geometerplus.android.fbreader.api.PluginApi;
|
||||
|
||||
public class AccountMenuActivity extends ListActivity implements AdapterView.OnItemClickListener {
|
||||
private static final String ACCOUNT_ACTION = "android.fbreader.action.network.ACCOUNT";
|
||||
|
||||
public class AccountMenuActivity extends MenuActivity {
|
||||
public static void runMenu(Context context, INetworkLink link) {
|
||||
context.startActivity(
|
||||
Util.intentByLink(new Intent(context, AccountMenuActivity.class), link)
|
||||
|
@ -52,16 +45,13 @@ public class AccountMenuActivity extends ListActivity implements AdapterView.OnI
|
|||
}
|
||||
|
||||
private INetworkLink myLink;
|
||||
private List<PluginApi.MenuActionInfo> myInfos;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
protected void init() {
|
||||
setTitle(NetworkLibrary.resource().getResource("accountTitle").getValue());
|
||||
final String url = getIntent().getData().toString();
|
||||
myLink = NetworkLibrary.Instance().getLinkByUrl(url);
|
||||
|
||||
myInfos = new ArrayList<PluginApi.MenuActionInfo>();
|
||||
if (myLink.getUrlInfo(UrlInfo.Type.SignIn) != null) {
|
||||
myInfos.add(new PluginApi.MenuActionInfo(
|
||||
Uri.parse(url + "/signIn"),
|
||||
|
@ -69,112 +59,36 @@ public class AccountMenuActivity extends ListActivity implements AdapterView.OnI
|
|||
0
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
startActivityForResult(new Intent(ACCOUNT_ACTION, getIntent().getData()), 0);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
if (myInfos.size() == 1) {
|
||||
runAccountDialog(myInfos.get(0));
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setListAdapter(new ActionListAdapter());
|
||||
getListView().setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
runAccountDialog(myInfos.get(position));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (intent != null) {
|
||||
final List<PluginApi.MenuActionInfo> actions =
|
||||
intent.<PluginApi.MenuActionInfo>getParcelableArrayListExtra(
|
||||
PluginApi.PluginInfo.KEY
|
||||
);
|
||||
if (actions != null) {
|
||||
myInfos.addAll(actions);
|
||||
}
|
||||
if (myInfos.size() == 0) {
|
||||
finish();
|
||||
return;
|
||||
} else if (myInfos.size() == 1) {
|
||||
runAccountDialog(myInfos.get(0));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Collections.sort(myInfos);
|
||||
((ActionListAdapter)getListAdapter()).notifyDataSetChanged();
|
||||
getListView().invalidateViews();
|
||||
}
|
||||
protected String getAction() {
|
||||
return "android.fbreader.action.network.ACCOUNT";
|
||||
}
|
||||
|
||||
private void runAccountDialog(final PluginApi.MenuActionInfo info) {
|
||||
@Override
|
||||
protected void runItem(final PluginApi.MenuActionInfo info) {
|
||||
try {
|
||||
doAction(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
final NetworkAuthenticationManager mgr = myLink.authenticationManager();
|
||||
if (info.getId().toString().endsWith("/signIn")) {
|
||||
// TODO: put amount
|
||||
if (mgr != null) {
|
||||
//Util.openInBrowser(TopupMenuActivity.this, mgr.topupLink());
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
final Intent intent = new Intent(TOPUP_ACTION, info.getId());
|
||||
if (mgr != null) {
|
||||
for (Map.Entry<String,String> entry : mgr.getTopupData().entrySet()) {
|
||||
intent.putExtra(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
intent.putExtra(AMOUNT_KEY, myAmount);
|
||||
if (PackageUtil.canBeStarted(TopupMenuActivity.this, intent, true)) {
|
||||
startActivity(intent);
|
||||
}
|
||||
*/
|
||||
}
|
||||
} catch (ActivityNotFoundException e) {
|
||||
final NetworkAuthenticationManager mgr = myLink.authenticationManager();
|
||||
if (info.getId().toString().endsWith("/signIn")) {
|
||||
Util.runAuthenticationDialog(AccountMenuActivity.this, myLink, new Runnable() {
|
||||
public void run() {
|
||||
//runOnUiThread(buyDialogRunnable);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final Intent intent = new Intent(getAction(), info.getId());
|
||||
if (mgr != null) {
|
||||
for (Map.Entry<String,String> entry : mgr.getAccountData().entrySet()) {
|
||||
intent.putExtra(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (PackageUtil.canBeStarted(AccountMenuActivity.this, intent, true)) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
private void doAction(final Runnable action) {
|
||||
final NetworkAuthenticationManager mgr = myLink.authenticationManager();
|
||||
if (mgr.mayBeAuthorised(false)) {
|
||||
action.run();
|
||||
} else {
|
||||
Util.runAuthenticationDialog(this, myLink, action);
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionListAdapter extends BaseAdapter {
|
||||
public final int getCount() {
|
||||
return myInfos.size();
|
||||
}
|
||||
|
||||
public final Integer getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public final long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, final ViewGroup parent) {
|
||||
final View view = convertView != null
|
||||
? convertView
|
||||
: LayoutInflater.from(parent.getContext()).inflate(R.layout.menu_item, parent, false);
|
||||
((TextView)view).setText(myInfos.get(position).MenuItemName);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
113
src/org/geometerplus/android/fbreader/network/MenuActivity.java
Normal file
113
src/org/geometerplus/android/fbreader/network/MenuActivity.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2011 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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 java.util.*;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.R;
|
||||
|
||||
import org.geometerplus.android.fbreader.api.PluginApi;
|
||||
|
||||
abstract class MenuActivity extends ListActivity implements AdapterView.OnItemClickListener {
|
||||
protected List<PluginApi.MenuActionInfo> myInfos;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
myInfos = new ArrayList<PluginApi.MenuActionInfo>();
|
||||
|
||||
init();
|
||||
|
||||
try {
|
||||
startActivityForResult(new Intent(getAction(), getIntent().getData()), 0);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
if (myInfos.size() == 1) {
|
||||
runItem(myInfos.get(0));
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setListAdapter(new ActionListAdapter());
|
||||
getListView().setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
runItem(myInfos.get(position));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (intent != null) {
|
||||
final List<PluginApi.MenuActionInfo> actions =
|
||||
intent.<PluginApi.MenuActionInfo>getParcelableArrayListExtra(
|
||||
PluginApi.PluginInfo.KEY
|
||||
);
|
||||
if (actions != null) {
|
||||
myInfos.addAll(actions);
|
||||
}
|
||||
if (myInfos.size() == 0) {
|
||||
finish();
|
||||
return;
|
||||
} else if (myInfos.size() == 1) {
|
||||
runItem(myInfos.get(0));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Collections.sort(myInfos);
|
||||
((ActionListAdapter)getListAdapter()).notifyDataSetChanged();
|
||||
getListView().invalidateViews();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void init();
|
||||
protected abstract String getAction();
|
||||
protected abstract void runItem(final PluginApi.MenuActionInfo info);
|
||||
|
||||
private class ActionListAdapter extends BaseAdapter {
|
||||
public final int getCount() {
|
||||
return myInfos.size();
|
||||
}
|
||||
|
||||
public final PluginApi.MenuActionInfo getItem(int position) {
|
||||
return myInfos.get(position);
|
||||
}
|
||||
|
||||
public final long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, final ViewGroup parent) {
|
||||
final View view = convertView != null
|
||||
? convertView
|
||||
: LayoutInflater.from(parent.getContext()).inflate(R.layout.menu_item, parent, false);
|
||||
((TextView)view).setText(getItem(position).MenuItemName);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,10 +22,8 @@ package org.geometerplus.android.fbreader.network;
|
|||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.*;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
|
@ -42,8 +40,7 @@ import org.geometerplus.android.util.PackageUtil;
|
|||
|
||||
import org.geometerplus.android.fbreader.api.PluginApi;
|
||||
|
||||
public class TopupMenuActivity extends ListActivity implements AdapterView.OnItemClickListener {
|
||||
private static final String TOPUP_ACTION = "android.fbreader.action.network.TOPUP";
|
||||
public class TopupMenuActivity extends MenuActivity {
|
||||
private static final String AMOUNT_KEY = "topup:amount";
|
||||
private static final String CURRENCY_KEY = "topup:currency";
|
||||
|
||||
|
@ -63,18 +60,15 @@ public class TopupMenuActivity extends ListActivity implements AdapterView.OnIte
|
|||
}
|
||||
|
||||
private INetworkLink myLink;
|
||||
private List<PluginApi.MenuActionInfo> myInfos;
|
||||
private BigDecimal myAmount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
protected void init() {
|
||||
setTitle(NetworkLibrary.resource().getResource("topupTitle").getValue());
|
||||
final String url = getIntent().getData().toString();
|
||||
myLink = NetworkLibrary.Instance().getLinkByUrl(url);
|
||||
myAmount = (BigDecimal)getIntent().getSerializableExtra(AMOUNT_KEY);
|
||||
|
||||
myInfos = new ArrayList<PluginApi.MenuActionInfo>();
|
||||
if (myLink.getUrlInfo(UrlInfo.Type.TopUp) != null) {
|
||||
myInfos.add(new PluginApi.MenuActionInfo(
|
||||
Uri.parse(url + "/browser"),
|
||||
|
@ -82,51 +76,15 @@ public class TopupMenuActivity extends ListActivity implements AdapterView.OnIte
|
|||
100
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
startActivityForResult(new Intent(TOPUP_ACTION, getIntent().getData()), 0);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
if (myInfos.size() == 1) {
|
||||
runTopupDialog(myInfos.get(0));
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setListAdapter(new ActionListAdapter());
|
||||
getListView().setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
runTopupDialog(myInfos.get(position));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (intent != null) {
|
||||
final List<PluginApi.MenuActionInfo> actions =
|
||||
intent.<PluginApi.MenuActionInfo>getParcelableArrayListExtra(
|
||||
PluginApi.PluginInfo.KEY
|
||||
);
|
||||
if (actions != null) {
|
||||
myInfos.addAll(actions);
|
||||
}
|
||||
if (myInfos.size() == 0) {
|
||||
finish();
|
||||
return;
|
||||
} else if (myInfos.size() == 1) {
|
||||
runTopupDialog(myInfos.get(0));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Collections.sort(myInfos);
|
||||
((ActionListAdapter)getListAdapter()).notifyDataSetChanged();
|
||||
getListView().invalidateViews();
|
||||
}
|
||||
protected String getAction() {
|
||||
return "android.fbreader.action.network.TOPUP";
|
||||
}
|
||||
|
||||
private void runTopupDialog(final PluginApi.MenuActionInfo info) {
|
||||
@Override
|
||||
protected void runItem(final PluginApi.MenuActionInfo info) {
|
||||
try {
|
||||
doTopup(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -138,7 +96,7 @@ public class TopupMenuActivity extends ListActivity implements AdapterView.OnIte
|
|||
Util.openInBrowser(TopupMenuActivity.this, mgr.topupLink());
|
||||
}
|
||||
} else {
|
||||
final Intent intent = new Intent(TOPUP_ACTION, info.getId());
|
||||
final Intent intent = new Intent(getAction(), info.getId());
|
||||
if (mgr != null) {
|
||||
for (Map.Entry<String,String> entry : mgr.getTopupData().entrySet()) {
|
||||
intent.putExtra(entry.getKey(), entry.getValue());
|
||||
|
@ -166,26 +124,4 @@ public class TopupMenuActivity extends ListActivity implements AdapterView.OnIte
|
|||
Util.runAuthenticationDialog(this, myLink, action);
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionListAdapter extends BaseAdapter {
|
||||
public final int getCount() {
|
||||
return myInfos.size();
|
||||
}
|
||||
|
||||
public final Integer getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public final long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, final ViewGroup parent) {
|
||||
final View view = convertView != null
|
||||
? convertView
|
||||
: LayoutInflater.from(parent.getContext()).inflate(R.layout.menu_item, parent, false);
|
||||
((TextView)view).setText(myInfos.get(position).MenuItemName);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package org.geometerplus.android.fbreader.network;
|
||||
|
||||
public interface UserRegistrationConstants {
|
||||
String SIGNUP_URL = "signupUrl";
|
||||
|
||||
String USER_REGISTRATION_USERNAME = "userName";
|
||||
String USER_REGISTRATION_PASSWORD = "password";
|
||||
String USER_REGISTRATION_EMAIL = "eMail";
|
||||
|
|
|
@ -35,10 +35,7 @@ import org.geometerplus.android.util.UIUtil;
|
|||
import org.geometerplus.android.util.PackageUtil;
|
||||
|
||||
public abstract class Util implements UserRegistrationConstants {
|
||||
private static final String REGISTRATION_ACTION =
|
||||
"android.fbreader.action.NETWORK_LIBRARY_REGISTER";
|
||||
private static final String AUTO_SIGNIN_ACTION =
|
||||
"android.fbreader.action.NETWORK_LIBRARY_AUTOSIGNIN";
|
||||
static final String ACCOUNT_ACTION = "android.fbreader.action.network.ACCOUNT";
|
||||
|
||||
public static Intent intentByLink(Intent intent, INetworkLink link) {
|
||||
if (link != null) {
|
||||
|
@ -71,25 +68,18 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
public static boolean isRegistrationSupported(Activity activity, INetworkLink link) {
|
||||
return testService(
|
||||
activity,
|
||||
REGISTRATION_ACTION,
|
||||
link.getUrl(UrlInfo.Type.SignUp)
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean isAutoSignInSupported(Activity activity, INetworkLink link) {
|
||||
return testService(
|
||||
activity,
|
||||
AUTO_SIGNIN_ACTION,
|
||||
link.getUrl(UrlInfo.Type.SignUp)
|
||||
ACCOUNT_ACTION,
|
||||
link.getUrl(UrlInfo.Type.Catalog) + "/register"
|
||||
);
|
||||
}
|
||||
|
||||
public static void runRegistrationDialog(Activity activity, INetworkLink link) {
|
||||
try {
|
||||
final Intent intent = new Intent(
|
||||
REGISTRATION_ACTION,
|
||||
Uri.parse(link.getUrl(UrlInfo.Type.SignUp))
|
||||
ACCOUNT_ACTION,
|
||||
Uri.parse(link.getUrl(UrlInfo.Type.Catalog) + "/register")
|
||||
);
|
||||
intent.putExtra(UserRegistrationConstants.SIGNUP_URL, link.getUrl(UrlInfo.Type.SignUp));
|
||||
if (PackageUtil.canBeStarted(activity, intent, true)) {
|
||||
activity.startActivityForResult(intent, NetworkLibraryActivity.SIGNUP_CODE);
|
||||
}
|
||||
|
@ -97,19 +87,6 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
}
|
||||
}
|
||||
|
||||
public static void runAutoSignInDialog(Activity activity, INetworkLink link) {
|
||||
try {
|
||||
final Intent intent = new Intent(
|
||||
AUTO_SIGNIN_ACTION,
|
||||
Uri.parse(link.getUrl(UrlInfo.Type.SignIn))
|
||||
);
|
||||
if (PackageUtil.canBeStarted(activity, intent, true)) {
|
||||
activity.startActivityForResult(intent, NetworkLibraryActivity.AUTO_SIGNIN_CODE);
|
||||
}
|
||||
} catch (ActivityNotFoundException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void runAuthenticationDialog(Activity activity, INetworkLink link, Runnable onSuccess) {
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
|
||||
|
|
|
@ -363,59 +363,6 @@ public abstract class NetworkBookActions {
|
|||
buyDialogRunnable.run();
|
||||
} else {
|
||||
AccountMenuActivity.runMenu(activity, book.Link);
|
||||
/*
|
||||
final String signInKey = "signIn";
|
||||
final String registerKey = "signUp";
|
||||
final String quickBuyKey = "quickBuy";
|
||||
|
||||
final ArrayList<String> items = new ArrayList<String>();
|
||||
items.add(signInKey);
|
||||
if (Util.isRegistrationSupported(activity, book.Link)) {
|
||||
items.add(registerKey);
|
||||
}
|
||||
if (Util.isAutoSignInSupported(activity, book.Link)) {
|
||||
items.add(quickBuyKey);
|
||||
}
|
||||
|
||||
if (items.size() > 1) {
|
||||
final ZLResource box = dialogResource.getResource("purchaseActions");
|
||||
|
||||
CharSequence[] names = new CharSequence[items.size()];
|
||||
for (int i = 0; i < names.length; ++i) {
|
||||
names[i] = box.getResource(items.get(i)).getValue();
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(activity)
|
||||
.setIcon(0)
|
||||
.setTitle(box.getResource("title").getValue())
|
||||
.setItems(names, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final String item = items.get(which);
|
||||
if (signInKey.equals(item)) {
|
||||
Util.runAuthenticationDialog(activity, book.Link, new Runnable() {
|
||||
public void run() {
|
||||
activity.runOnUiThread(buyDialogRunnable);
|
||||
}
|
||||
});
|
||||
} else if (registerKey.equals(item)) {
|
||||
Util.runRegistrationDialog(activity, book.Link);
|
||||
// TODO: buy on success
|
||||
} else if (quickBuyKey.equals(item)) {
|
||||
Util.runAutoSignInDialog(activity, book.Link);
|
||||
// TODO: buy on success
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(buttonResource.getResource("cancel").getValue(), null)
|
||||
.create().show();
|
||||
} else {
|
||||
Util.runAuthenticationDialog(activity, book.Link, new Runnable() {
|
||||
public void run() {
|
||||
activity.runOnUiThread(buyDialogRunnable);
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
} catch (ZLNetworkException e) {
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.geometerplus.android.fbreader.network.action;
|
|||
import android.app.Activity;
|
||||
|
||||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogTree;
|
||||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
|
||||
import org.geometerplus.android.fbreader.network.Util;
|
||||
|
@ -34,7 +34,7 @@ public class SignInAction extends Action {
|
|||
|
||||
@Override
|
||||
public boolean isVisible(NetworkTree tree) {
|
||||
if (!(tree instanceof NetworkCatalogRootTree)) {
|
||||
if (!(tree instanceof NetworkCatalogTree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import android.app.Activity;
|
|||
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogTree;
|
||||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
|
@ -35,7 +35,7 @@ public class SignOutAction extends Action {
|
|||
|
||||
@Override
|
||||
public boolean isVisible(NetworkTree tree) {
|
||||
if (!(tree instanceof NetworkCatalogRootTree)) {
|
||||
if (!(tree instanceof NetworkCatalogTree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import android.app.Activity;
|
|||
|
||||
import org.geometerplus.fbreader.network.INetworkLink;
|
||||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogTree;
|
||||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
|
||||
import org.geometerplus.android.fbreader.network.Util;
|
||||
|
@ -35,7 +35,7 @@ public class SignUpAction extends Action {
|
|||
|
||||
@Override
|
||||
public boolean isVisible(NetworkTree tree) {
|
||||
if (!(tree instanceof NetworkCatalogRootTree)) {
|
||||
if (!(tree instanceof NetworkCatalogTree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.geometerplus.zlibrary.core.money.Money;
|
|||
import org.geometerplus.fbreader.network.*;
|
||||
import org.geometerplus.fbreader.network.opds.OPDSNetworkLink;
|
||||
import org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticationManager;
|
||||
import org.geometerplus.fbreader.network.urlInfo.BookUrlInfo;
|
||||
import org.geometerplus.fbreader.network.urlInfo.*;
|
||||
|
||||
public abstract class NetworkAuthenticationManager {
|
||||
private static final HashMap<String, NetworkAuthenticationManager> ourManagers = new HashMap<String, NetworkAuthenticationManager>();
|
||||
|
@ -107,6 +107,13 @@ public abstract class NetworkAuthenticationManager {
|
|||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/*
|
||||
* sign up
|
||||
*/
|
||||
public Map<String,String> getAccountData() {
|
||||
return Collections.singletonMap("signupUrl", Link.getUrl(UrlInfo.Type.SignUp));
|
||||
}
|
||||
|
||||
/*
|
||||
* Password Recovery
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue