cleaned some code
This commit is contained in:
parent
6169fe89d0
commit
cf77d0b445
2 changed files with 17 additions and 17 deletions
|
@ -60,16 +60,16 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
|
||||||
final LinkedHashMap<String, List<String>> listDataChild = new LinkedHashMap<String, List<String>>();
|
final LinkedHashMap<String, List<String>> listDataChild = new LinkedHashMap<String, List<String>>();
|
||||||
map = new LinkedHashMap<>();
|
map = new LinkedHashMap<>();
|
||||||
|
|
||||||
for (int i = 0; i < contentsContainer.getChilds().size(); i++) {
|
for (int i = 0; i < contentsContainer.getChildItems().size(); i++) {
|
||||||
WikivoyageJsonParser.ContentsContainer Header = contentsContainer.getChilds().get(i);
|
WikivoyageJsonParser.ContentsContainer Header = contentsContainer.getChildItems().get(i);
|
||||||
listDataHeader.add(Header.getName());
|
listDataHeader.add(Header.getName());
|
||||||
map.put(Header.getName(), Header.getLink());
|
map.put(Header.getName(), Header.getLink());
|
||||||
|
|
||||||
if (Header.getChilds() != null && !Header.getChilds().isEmpty()) {
|
if (Header.getChildItems() != null && !Header.getChildItems().isEmpty()) {
|
||||||
ArrayList<String> subHeaders = new ArrayList<>();
|
ArrayList<String> subHeaders = new ArrayList<>();
|
||||||
|
|
||||||
for (int j = 0; j < Header.getChilds().size(); j++) {
|
for (int j = 0; j < Header.getChildItems().size(); j++) {
|
||||||
WikivoyageJsonParser.ContentsContainer subHeader = Header.getChilds().get(j);
|
WikivoyageJsonParser.ContentsContainer subHeader = Header.getChildItems().get(j);
|
||||||
subHeaders.add(subHeader.getName());
|
subHeaders.add(subHeader.getName());
|
||||||
map.put(subHeader.getName(), subHeader.getLink());
|
map.put(subHeader.getName(), subHeader.getLink());
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class WikivoyageJsonParser {
|
||||||
JSONObject jsonHeader = jArray.getJSONObject(jArray.names().getString(i));
|
JSONObject jsonHeader = jArray.getJSONObject(jArray.names().getString(i));
|
||||||
link = jsonHeader.getString(LINK);
|
link = jsonHeader.getString(LINK);
|
||||||
ContentsContainer contentsHeaderContainer = new ContentsContainer(jArray.names().getString(i), link);
|
ContentsContainer contentsHeaderContainer = new ContentsContainer(jArray.names().getString(i), link);
|
||||||
topContentsContainer.childs.add(contentsHeaderContainer);
|
topContentsContainer.childItems.add(contentsHeaderContainer);
|
||||||
contentsHeaderContainer.setParent(topContentsContainer);
|
contentsHeaderContainer.setParent(topContentsContainer);
|
||||||
|
|
||||||
JSONArray jsonSubheaders = jsonHeader.getJSONArray(SUBHEADERS);
|
JSONArray jsonSubheaders = jsonHeader.getJSONArray(SUBHEADERS);
|
||||||
|
@ -51,7 +51,7 @@ public class WikivoyageJsonParser {
|
||||||
link = jsonSubheaderLink.getString(LINK);
|
link = jsonSubheaderLink.getString(LINK);
|
||||||
|
|
||||||
ContentsContainer contentsSubHeaderContainer = new ContentsContainer(jsonSubheader.names().getString(0), link);
|
ContentsContainer contentsSubHeaderContainer = new ContentsContainer(jsonSubheader.names().getString(0), link);
|
||||||
contentsHeaderContainer.childs.add(contentsSubHeaderContainer);
|
contentsHeaderContainer.childItems.add(contentsSubHeaderContainer);
|
||||||
contentsSubHeaderContainer.setParent(topContentsContainer);
|
contentsSubHeaderContainer.setParent(topContentsContainer);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -63,18 +63,23 @@ public class WikivoyageJsonParser {
|
||||||
|
|
||||||
public static class ContentsContainer {
|
public static class ContentsContainer {
|
||||||
|
|
||||||
ArrayList<ContentsContainer> childs = new ArrayList<>();
|
ArrayList<ContentsContainer> childItems = new ArrayList<>();
|
||||||
ContentsContainer parent;
|
ContentsContainer parent;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String link;
|
String link;
|
||||||
|
|
||||||
public ArrayList<ContentsContainer> getChilds() {
|
public ContentsContainer(String name, String link) {
|
||||||
return childs;
|
this.name = name;
|
||||||
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChilds(ArrayList<ContentsContainer> childs) {
|
public ArrayList<ContentsContainer> getChildItems() {
|
||||||
this.childs = childs;
|
return childItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildItems(ArrayList<ContentsContainer> childItems) {
|
||||||
|
this.childItems = childItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,10 +106,5 @@ public class WikivoyageJsonParser {
|
||||||
public void setParent(ContentsContainer parent) {
|
public void setParent(ContentsContainer parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentsContainer(String name, String link) {
|
|
||||||
this.name = name;
|
|
||||||
this.link = link;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue