mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
unused code has been removed
This commit is contained in:
parent
348c749054
commit
f3f228b427
3 changed files with 16 additions and 38 deletions
|
@ -72,7 +72,7 @@ class AuthenticationDialog extends NetworkDialog {
|
||||||
|
|
||||||
if (login.length() == 0) {
|
if (login.length() == 0) {
|
||||||
final String err = myResource.getResource("loginIsEmpty").getValue();
|
final String err = myResource.getResource("loginIsEmpty").getValue();
|
||||||
sendError(true, false, err);
|
sendError(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,10 +87,10 @@ class AuthenticationDialog extends NetworkDialog {
|
||||||
}
|
}
|
||||||
} catch (ZLNetworkException e) {
|
} catch (ZLNetworkException e) {
|
||||||
mgr.logOut();
|
mgr.logOut();
|
||||||
sendError(true, false, e.getMessage());
|
sendError(e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendSuccess(false);
|
sendSuccess();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
UIUtil.wait("authentication", runnable, myActivity);
|
UIUtil.wait("authentication", runnable, myActivity);
|
||||||
|
@ -103,7 +103,7 @@ class AuthenticationDialog extends NetworkDialog {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mgr.mayBeAuthorised(false)) {
|
if (mgr.mayBeAuthorised(false)) {
|
||||||
mgr.logOut();
|
mgr.logOut();
|
||||||
sendCancel(false);
|
sendCancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,41 +58,20 @@ abstract class NetworkDialog {
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class DialogHandler extends Handler {
|
private class DialogHandler extends Handler {
|
||||||
|
|
||||||
public Message obtainMessage(int code, boolean invalidateLibrary, String message) {
|
|
||||||
return obtainMessage(code, invalidateLibrary ? 1 : 0, 0, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
if (!NetworkView.Instance().isInitialized()) {
|
if (!NetworkView.Instance().isInitialized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||||
if (message.arg1 != 0) {
|
|
||||||
library.invalidateChildren();
|
|
||||||
}
|
|
||||||
library.invalidateVisibility();
|
library.invalidateVisibility();
|
||||||
library.synchronize();
|
library.synchronize();
|
||||||
NetworkView.Instance().fireModelChanged();
|
NetworkView.Instance().fireModelChanged();
|
||||||
if (message.what < 0) {
|
if (message.what < 0) {
|
||||||
if (message.what == -2) {
|
|
||||||
final ZLResource dialogResource = ZLResource.resource("dialog");
|
|
||||||
final ZLResource boxResource = dialogResource.getResource("networkError");
|
|
||||||
final ZLResource buttonResource = dialogResource.getResource("button");
|
|
||||||
new AlertDialog.Builder(myActivity)
|
|
||||||
.setTitle(boxResource.getResource("title").getValue())
|
|
||||||
.setMessage((String) message.obj)
|
|
||||||
.setIcon(0)
|
|
||||||
.setPositiveButton(buttonResource.getResource("ok").getValue(), null)
|
|
||||||
.create().show();
|
|
||||||
} else {
|
|
||||||
myErrorMessage = (String) message.obj;
|
myErrorMessage = (String) message.obj;
|
||||||
myActivity.showDialog(myId);
|
myActivity.showDialog(myId);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
} else if (message.what > 0) {
|
} else if (message.what > 0) {
|
||||||
if (myOnSuccessRunnable != null) {
|
if (myOnSuccessRunnable != null) {
|
||||||
myOnSuccessRunnable.run();
|
myOnSuccessRunnable.run();
|
||||||
|
@ -130,16 +109,16 @@ abstract class NetworkDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void sendSuccess(boolean invalidateLibrary) {
|
protected void sendSuccess() {
|
||||||
myHandler.sendMessage(myHandler.obtainMessage(1, invalidateLibrary, null));
|
myHandler.sendMessage(myHandler.obtainMessage(1, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendCancel(boolean invalidateLibrary) {
|
protected void sendCancel() {
|
||||||
myHandler.sendMessage(myHandler.obtainMessage(0, invalidateLibrary, null));
|
myHandler.sendMessage(myHandler.obtainMessage(0, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendError(boolean restart, boolean invalidateLibrary, String message) {
|
protected void sendError(String message) {
|
||||||
myHandler.sendMessage(myHandler.obtainMessage(restart ? -1 : -2, invalidateLibrary, message));
|
myHandler.sendMessage(myHandler.obtainMessage(-1, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract View createLayout();
|
protected abstract View createLayout();
|
||||||
|
|
|
@ -272,7 +272,7 @@ public class NetworkLibrary {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidateChildren() {
|
private void invalidateChildren() {
|
||||||
myChildrenAreInvalid = true;
|
myChildrenAreInvalid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,10 +369,9 @@ public class NetworkLibrary {
|
||||||
|
|
||||||
private void updateVisibility() {
|
private void updateVisibility() {
|
||||||
for (FBTree tree : myRootTree.subTrees()) {
|
for (FBTree tree : myRootTree.subTrees()) {
|
||||||
if (!(tree instanceof NetworkCatalogTree)) {
|
if (tree instanceof NetworkCatalogTree) {
|
||||||
continue;
|
((NetworkCatalogTree)tree).updateVisibility();
|
||||||
}
|
}
|
||||||
((NetworkCatalogTree) tree).updateVisibility();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue