Search in sources :

Example 1 with LitResAuthenticationManager

use of org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticationManager in project FBReaderJ by geometer.

the class ListenerCallback method onReceive.

@Override
public void onReceive(Context context, final Intent intent) {
    final NetworkLibrary library = Util.networkLibrary(context);
    if (Util.SIGNIN_ACTION.equals(intent.getAction())) {
        final String url = intent.getStringExtra(CATALOG_URL);
        final INetworkLink link = library.getLinkByUrl(url);
        if (link != null) {
            final NetworkAuthenticationManager mgr = link.authenticationManager();
            if (mgr instanceof LitResAuthenticationManager) {
                new Thread(new Runnable() {

                    public void run() {
                        try {
                            processSignup((LitResAuthenticationManager) mgr, intent);
                        } catch (ZLNetworkException e) {
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
        }
    } else {
        library.fireModelChangedEvent(NetworkLibrary.ChangeListener.Code.SomeCode);
    }
}
Also used : NetworkAuthenticationManager(org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager) ZLNetworkException(org.geometerplus.zlibrary.core.network.ZLNetworkException) LitResAuthenticationManager(org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticationManager)

Aggregations

NetworkAuthenticationManager (org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager)1 LitResAuthenticationManager (org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticationManager)1 ZLNetworkException (org.geometerplus.zlibrary.core.network.ZLNetworkException)1