mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
cleanup: no NetworkTree constructor with level parameter
This commit is contained in:
parent
85df6a5e84
commit
8001a37cec
11 changed files with 18 additions and 30 deletions
|
@ -29,8 +29,8 @@ import org.geometerplus.fbreader.network.NetworkTree;
|
|||
import org.geometerplus.android.fbreader.tree.ZLAndroidTree;
|
||||
|
||||
public class AddCustomCatalogItemTree extends NetworkTree implements ZLAndroidTree {
|
||||
public AddCustomCatalogItemTree() {
|
||||
super(1);
|
||||
public AddCustomCatalogItemTree(NetworkTree parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -99,7 +99,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
|
|||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
new RefillAccountActions().buildContextMenu(this, menu, new RefillAccountTree(myBook.Link));
|
||||
new RefillAccountActions().buildContextMenu(this, menu, myBook.Link);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -103,7 +103,7 @@ public class NetworkLibraryActivity extends NetworkBaseActivity {
|
|||
|
||||
private void prepareView() {
|
||||
if (myTree == null) {
|
||||
myTree = NetworkLibrary.Instance().getTree();
|
||||
myTree = NetworkLibrary.Instance().getRootTree();
|
||||
setListAdapter(new LibraryAdapter());
|
||||
getListView().invalidateViews();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,10 @@ class NetworkView {
|
|||
myActions.add(new AddCustomCatalogItemActions());
|
||||
myActions.trimToSize();
|
||||
|
||||
final NetworkTree root = library.getRootTree();
|
||||
mySearchItem = new SearchItemTree(root);
|
||||
myAddCustomCatalogItem = new AddCustomCatalogItemTree(root);
|
||||
|
||||
myInitialized = true;
|
||||
}
|
||||
|
||||
|
@ -313,8 +317,8 @@ class NetworkView {
|
|||
* Special view items item
|
||||
*/
|
||||
|
||||
private final SearchItemTree mySearchItem = new SearchItemTree();
|
||||
private final AddCustomCatalogItemTree myAddCustomCatalogItem = new AddCustomCatalogItemTree();
|
||||
private SearchItemTree mySearchItem;
|
||||
private AddCustomCatalogItemTree myAddCustomCatalogItem;
|
||||
|
||||
public SearchItemTree getSearchItemTree() {
|
||||
return mySearchItem;
|
||||
|
|
|
@ -41,9 +41,12 @@ class RefillAccountActions extends NetworkTreeActions {
|
|||
|
||||
@Override
|
||||
public void buildContextMenu(Activity activity, ContextMenu menu, NetworkTree tree) {
|
||||
buildContextMenu(activity, menu, ((RefillAccountTree)tree).Link);
|
||||
}
|
||||
|
||||
public void buildContextMenu(Activity activity, ContextMenu menu, INetworkLink link) {
|
||||
menu.setHeaderTitle(getTitleValue("refillTitle"));
|
||||
|
||||
final INetworkLink link = ((RefillAccountTree)tree).Link;
|
||||
if (Util.isSmsAccountRefillingSupported(activity, link)) {
|
||||
addMenuItem(menu, REFILL_VIA_SMS_ITEM_ID, "refillViaSms");
|
||||
}
|
||||
|
|
|
@ -36,15 +36,10 @@ class RefillAccountTree extends NetworkTree implements ZLAndroidTree {
|
|||
public final INetworkLink Link;
|
||||
|
||||
public RefillAccountTree(NetworkCatalogTree parentTree) {
|
||||
super(parentTree.Level + 1);
|
||||
super(parentTree);
|
||||
Link = parentTree.Item.Link;
|
||||
}
|
||||
|
||||
public RefillAccountTree(INetworkLink link) {
|
||||
super(1);
|
||||
Link = link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ZLResource.resource("networkView").getResource("refillTitle").getValue();
|
||||
|
|
|
@ -34,11 +34,10 @@ import org.geometerplus.zlibrary.ui.android.R;
|
|||
import org.geometerplus.android.fbreader.tree.ZLAndroidTree;
|
||||
|
||||
public class SearchItemTree extends NetworkTree implements ZLAndroidTree {
|
||||
|
||||
private SearchResult myResult;
|
||||
|
||||
public SearchItemTree() {
|
||||
super(1);
|
||||
public SearchItemTree(NetworkTree parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -413,11 +413,10 @@ public class NetworkLibrary {
|
|||
}
|
||||
}
|
||||
|
||||
public NetworkTree getTree() {
|
||||
public NetworkTree getRootTree() {
|
||||
return myRootTree;
|
||||
}
|
||||
|
||||
|
||||
public void simpleSearch(String pattern, final NetworkOperationData.OnNewItemListener listener) throws ZLNetworkException {
|
||||
LinkedList<ZLNetworkRequest> requestList = new LinkedList<ZLNetworkRequest>();
|
||||
LinkedList<NetworkOperationData> dataList = new LinkedList<NetworkOperationData>();
|
||||
|
|
|
@ -94,10 +94,6 @@ public abstract class NetworkTree extends FBTree {
|
|||
}
|
||||
}
|
||||
|
||||
protected NetworkTree(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
protected NetworkTree() {
|
||||
super();
|
||||
}
|
||||
|
|
|
@ -29,10 +29,6 @@ public abstract class FBTree extends ZLTree<FBTree> implements Comparable<FBTree
|
|||
private ZLImage myCover;
|
||||
private boolean myCoverRequested;
|
||||
|
||||
protected FBTree(int level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
protected FBTree() {
|
||||
super();
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@ public abstract class ZLTree<T extends ZLTree<T>> implements Iterable<T> {
|
|||
public final int Level;
|
||||
private ArrayList<T> mySubTrees;
|
||||
|
||||
protected ZLTree(int level) {
|
||||
this(level, null, 0);
|
||||
}
|
||||
|
||||
protected ZLTree() {
|
||||
this(null);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue