From f3f228b427ee95429fbedd0ad6213b2d1a391f14 Mon Sep 17 00:00:00 2001 From: Nikolay Pultsin Date: Wed, 2 Mar 2011 16:54:04 +0000 Subject: [PATCH] unused code has been removed --- .../network/AuthenticationDialog.java | 8 ++-- .../fbreader/network/NetworkDialog.java | 39 +++++-------------- .../fbreader/network/NetworkLibrary.java | 7 ++-- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/src/org/geometerplus/android/fbreader/network/AuthenticationDialog.java b/src/org/geometerplus/android/fbreader/network/AuthenticationDialog.java index 7e7b1d0cb..1e43db96f 100644 --- a/src/org/geometerplus/android/fbreader/network/AuthenticationDialog.java +++ b/src/org/geometerplus/android/fbreader/network/AuthenticationDialog.java @@ -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(); } } }; diff --git a/src/org/geometerplus/android/fbreader/network/NetworkDialog.java b/src/org/geometerplus/android/fbreader/network/NetworkDialog.java index 45b8d4599..7b5ce0903 100644 --- a/src/org/geometerplus/android/fbreader/network/NetworkDialog.java +++ b/src/org/geometerplus/android/fbreader/network/NetworkDialog.java @@ -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; - } + 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(); diff --git a/src/org/geometerplus/fbreader/network/NetworkLibrary.java b/src/org/geometerplus/fbreader/network/NetworkLibrary.java index eb0f6ad16..6496c4f02 100644 --- a/src/org/geometerplus/fbreader/network/NetworkLibrary.java +++ b/src/org/geometerplus/fbreader/network/NetworkLibrary.java @@ -272,7 +272,7 @@ public class NetworkLibrary { return url; } - public void invalidateChildren() { + private void invalidateChildren() { myChildrenAreInvalid = true; } @@ -369,10 +369,9 @@ public class NetworkLibrary { private void updateVisibility() { for (FBTree tree : myRootTree.subTrees()) { - if (!(tree instanceof NetworkCatalogTree)) { - continue; + if (tree instanceof NetworkCatalogTree) { + ((NetworkCatalogTree)tree).updateVisibility(); } - ((NetworkCatalogTree) tree).updateVisibility(); } }