1
0
Fork 0
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:
Nikolay Pultsin 2011-03-02 16:54:04 +00:00
parent 348c749054
commit f3f228b427
3 changed files with 16 additions and 38 deletions

View file

@ -72,7 +72,7 @@ class AuthenticationDialog extends NetworkDialog {
if (login.length() == 0) {
final String err = myResource.getResource("loginIsEmpty").getValue();
sendError(true, false, err);
sendError(err);
return;
}
@ -87,10 +87,10 @@ class AuthenticationDialog extends NetworkDialog {
}
} catch (ZLNetworkException e) {
mgr.logOut();
sendError(true, false, e.getMessage());
sendError(e.getMessage());
return;
}
sendSuccess(false);
sendSuccess();
}
};
UIUtil.wait("authentication", runnable, myActivity);
@ -103,7 +103,7 @@ class AuthenticationDialog extends NetworkDialog {
public void run() {
if (mgr.mayBeAuthorised(false)) {
mgr.logOut();
sendCancel(false);
sendCancel();
}
}
};

View file

@ -58,41 +58,20 @@ abstract class NetworkDialog {
return dlg;
}
private class DialogHandler extends Handler {
public Message obtainMessage(int code, boolean invalidateLibrary, String message) {
return obtainMessage(code, invalidateLibrary ? 1 : 0, 0, message);
}
@Override
public void handleMessage(Message message) {
if (!NetworkView.Instance().isInitialized()) {
return;
}
final NetworkLibrary library = NetworkLibrary.Instance();
if (message.arg1 != 0) {
library.invalidateChildren();
}
library.invalidateVisibility();
library.synchronize();
NetworkView.Instance().fireModelChanged();
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;
myActivity.showDialog(myId);
return;
}
} else if (message.what > 0) {
if (myOnSuccessRunnable != null) {
myOnSuccessRunnable.run();
@ -130,16 +109,16 @@ abstract class NetworkDialog {
}
protected void sendSuccess(boolean invalidateLibrary) {
myHandler.sendMessage(myHandler.obtainMessage(1, invalidateLibrary, null));
protected void sendSuccess() {
myHandler.sendMessage(myHandler.obtainMessage(1, null));
}
protected void sendCancel(boolean invalidateLibrary) {
myHandler.sendMessage(myHandler.obtainMessage(0, invalidateLibrary, null));
protected void sendCancel() {
myHandler.sendMessage(myHandler.obtainMessage(0, null));
}
protected void sendError(boolean restart, boolean invalidateLibrary, String message) {
myHandler.sendMessage(myHandler.obtainMessage(restart ? -1 : -2, invalidateLibrary, message));
protected void sendError(String message) {
myHandler.sendMessage(myHandler.obtainMessage(-1, message));
}
protected abstract View createLayout();

View file

@ -272,7 +272,7 @@ public class NetworkLibrary {
return url;
}
public void invalidateChildren() {
private void invalidateChildren() {
myChildrenAreInvalid = true;
}
@ -369,12 +369,11 @@ public class NetworkLibrary {
private void updateVisibility() {
for (FBTree tree : myRootTree.subTrees()) {
if (!(tree instanceof NetworkCatalogTree)) {
continue;
}
if (tree instanceof NetworkCatalogTree) {
((NetworkCatalogTree)tree).updateVisibility();
}
}
}
public void synchronize() {
if (myChildrenAreInvalid) {