mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
code cleanup
This commit is contained in:
parent
d05318fc59
commit
592a37db4f
2 changed files with 9 additions and 11 deletions
|
@ -74,7 +74,7 @@ public class AuthenticationActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CredentialsCreator extends ZLNetworkManager.BasicCredentialsCreator {
|
static class CredentialsCreator extends ZLNetworkManager.CredentialsCreator {
|
||||||
private final Context myContext;
|
private final Context myContext;
|
||||||
|
|
||||||
CredentialsCreator(Context context) {
|
CredentialsCreator(Context context) {
|
||||||
|
@ -210,8 +210,8 @@ public class AuthenticationActivity extends Activity {
|
||||||
private void finishOk(String username, String password) {
|
private void finishOk(String username, String password) {
|
||||||
final ZLNetworkManager.CredentialsCreator creator =
|
final ZLNetworkManager.CredentialsCreator creator =
|
||||||
ZLNetworkManager.Instance().getCredentialsCreator();
|
ZLNetworkManager.Instance().getCredentialsCreator();
|
||||||
if (creator instanceof CredentialsCreator) {
|
if (creator != null) {
|
||||||
((CredentialsCreator)creator).setCredentials(username, password);
|
creator.setCredentials(username, password);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -280,8 +280,8 @@ public class AuthenticationActivity extends Activity {
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
final ZLNetworkManager.CredentialsCreator creator =
|
final ZLNetworkManager.CredentialsCreator creator =
|
||||||
ZLNetworkManager.Instance().getCredentialsCreator();
|
ZLNetworkManager.Instance().getCredentialsCreator();
|
||||||
if (creator instanceof CredentialsCreator) {
|
if (creator != null) {
|
||||||
((CredentialsCreator)creator).release();
|
creator.release();
|
||||||
}
|
}
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,11 +52,7 @@ public class ZLNetworkManager {
|
||||||
return ourManager;
|
return ourManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface CredentialsCreator {
|
public static abstract class CredentialsCreator {
|
||||||
Credentials createCredentials(String scheme, AuthScope scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class BasicCredentialsCreator implements ZLNetworkManager.CredentialsCreator {
|
|
||||||
private volatile String myUsername;
|
private volatile String myUsername;
|
||||||
private volatile String myPassword;
|
private volatile String myPassword;
|
||||||
|
|
||||||
|
@ -71,7 +67,9 @@ public class ZLNetworkManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Credentials createCredentials(String scheme, AuthScope scope) {
|
public Credentials createCredentials(String scheme, AuthScope scope) {
|
||||||
if (!"basic".equalsIgnoreCase(scope.getScheme())) {
|
final String authScheme = scope.getScheme();
|
||||||
|
if (!"basic".equalsIgnoreCase(authScheme) &&
|
||||||
|
!"digest".equalsIgnoreCase(authScheme)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue