Removed loading third level (in future it's will be implemented) and fixed duplication of tree nodes.
This commit is contained in:
parent
dc01b7960b
commit
bb349e6b83
@ -122,9 +122,6 @@ public class MainActivity extends AppCompatActivity
|
||||
firstLevelNodes.add(new TreeNode(firstLevelObjects.get(i).getName()));
|
||||
firstLevelNodes.get(i).setLevel(0);
|
||||
firstLevelNodes.get(i).setChildren(getSecondLevelNodesByParentID(firstLevelObjects.get(i).getID()));
|
||||
for (int j = 0; j < firstLevelNodes.get(i).getChildren().size(); j++) {
|
||||
firstLevelNodes.get(i).getChildren().get(j).setChildren(getThirdLevelNodesByParentName((String) firstLevelNodes.get(i).getChildren().get(j).getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
rootNode.setChildren(firstLevelNodes);
|
||||
@ -174,18 +171,9 @@ public class MainActivity extends AppCompatActivity
|
||||
private void getTreeData(final boolean clean) throws IllegalStateException {
|
||||
mSwipeRefreshLayout.setRefreshing(true);
|
||||
if(clean) {
|
||||
for (int i = 0; i < firstLevelNodes.size(); i++) {
|
||||
firstLevelNodes.remove(i);
|
||||
}
|
||||
for (int i = 0; i < firstLevelObjects.size(); i++) {
|
||||
firstLevelObjects.remove(i);
|
||||
}
|
||||
for (int i = 0; i < secondLevelObjects.size(); i++) {
|
||||
secondLevelObjects.remove(i);
|
||||
}
|
||||
for (int i = 0; i < thirdLevelObjects.size(); i++) {
|
||||
thirdLevelObjects.remove(i);
|
||||
}
|
||||
firstLevelNodes.removeAll(firstLevelNodes);
|
||||
firstLevelObjects.removeAll(firstLevelObjects);
|
||||
secondLevelObjects.removeAll(secondLevelObjects);
|
||||
}
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String baseURL = sharedPreferences.getString("addressOfServer", "");
|
||||
@ -210,14 +198,6 @@ public class MainActivity extends AppCompatActivity
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < secondLevelObjects.size(); i++) {
|
||||
Response<List<ThirdLevelModel>> thirdLevelResponse = vrApi.getDetails(secondLevelObjects.get(i).getID()).execute();
|
||||
if(thirdLevelResponse.isSuccessful()) {
|
||||
thirdLevelObjects.addAll(thirdLevelResponse.body());
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user