mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
authorization while adding catalog fix
This commit is contained in:
parent
d8e8521dc1
commit
fba4df1d88
4 changed files with 25 additions and 3 deletions
|
@ -30,6 +30,7 @@ import android.widget.TextView;
|
|||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkManager;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.R;
|
||||
|
||||
|
@ -39,9 +40,13 @@ import org.geometerplus.fbreader.network.urlInfo.*;
|
|||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class AddCustomCatalogActivity extends Activity {
|
||||
public static String EDIT_KEY = "EditNotAdd";
|
||||
|
||||
protected static final int BASIC_AUTHENTICATION_CODE = 1;
|
||||
|
||||
private ZLResource myResource;
|
||||
private volatile ICustomNetworkLink myLink;
|
||||
private boolean myEditNotAdd;
|
||||
|
@ -221,7 +226,6 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
textUrl = "http://" + textUrl;
|
||||
uri = Uri.parse(textUrl);
|
||||
}
|
||||
|
||||
setTextById(R.id.add_custom_catalog_url, textUrl);
|
||||
final String siteName = uri.getHost();
|
||||
if (isEmptyString(siteName)) {
|
||||
|
@ -233,7 +237,6 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
myLink = new OPDSCustomNetworkLink(
|
||||
ICustomNetworkLink.INVALID_ID, siteName, null, null, null, infos
|
||||
);
|
||||
|
||||
final Runnable loadInfoRunnable = new Runnable() {
|
||||
private String myError;
|
||||
|
||||
|
@ -260,4 +263,22 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
};
|
||||
UIUtil.wait("loadingCatalogInfo", loadInfoRunnable, this);
|
||||
}
|
||||
|
||||
private final AuthenticationActivity.CredentialsCreator myCredentialsCreator =
|
||||
new AuthenticationActivity.CredentialsCreator(this, BASIC_AUTHENTICATION_CODE);
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
switch (requestCode) {
|
||||
case BASIC_AUTHENTICATION_CODE:
|
||||
myCredentialsCreator.onDataReceived(resultCode, intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
ZLNetworkManager.Instance().setCredentialsCreator(myCredentialsCreator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,3 +304,4 @@ public class AuthenticationActivity extends Activity {
|
|||
super.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
}
|
||||
|
||||
public static void runAuthenticationDialog(Activity activity, INetworkLink link, Runnable onSuccess) {
|
||||
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
|
||||
final Intent intent = intentByLink(new Intent(activity, AuthenticationActivity.class), link);
|
||||
|
|
|
@ -99,7 +99,6 @@ public class OPDSCustomNetworkLink extends OPDSNetworkLink implements ICustomNet
|
|||
public void reloadInfo(final boolean urlsOnly) throws ZLNetworkException {
|
||||
final LinkedList<String> opensearchDescriptionURLs = new LinkedList<String>();
|
||||
final List<OpenSearchDescription> descriptions = Collections.synchronizedList(new LinkedList<OpenSearchDescription>());
|
||||
|
||||
ZLNetworkException error = null;
|
||||
try {
|
||||
ZLNetworkManager.Instance().perform(new ZLNetworkRequest(getUrl(UrlInfo.Type.Catalog)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue