diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java index 4bb0248b74..506d03cd78 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java @@ -51,8 +51,8 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag return; } - WikivoyageJsonParser.ContentsContainer contentsContainer = WikivoyageJsonParser.parseJsonContents(contentsJson); - if (contentsContainer == null) { + WikivoyageJsonParser.ContentsItem contentsItem = WikivoyageJsonParser.parseJsonContents(contentsJson); + if (contentsItem == null) { return; } @@ -60,8 +60,8 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag final LinkedHashMap> listDataChild = new LinkedHashMap>(); map = new LinkedHashMap<>(); - for (int i = 0; i < contentsContainer.getChildItems().size(); i++) { - WikivoyageJsonParser.ContentsContainer Header = contentsContainer.getChildItems().get(i); + for (int i = 0; i < contentsItem.getChildItems().size(); i++) { + WikivoyageJsonParser.ContentsItem Header = contentsItem.getChildItems().get(i); listDataHeader.add(Header.getName()); map.put(Header.getName(), Header.getLink()); @@ -69,9 +69,9 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag ArrayList subHeaders = new ArrayList<>(); for (int j = 0; j < Header.getChildItems().size(); j++) { - WikivoyageJsonParser.ContentsContainer subHeader = Header.getChildItems().get(j); - subHeaders.add(subHeader.getName()); - map.put(subHeader.getName(), subHeader.getLink()); + WikivoyageJsonParser.ContentsItem subHeaderItem = Header.getChildItems().get(j); + subHeaders.add(subHeaderItem.getName()); + map.put(subHeaderItem.getName(), subHeaderItem.getLink()); } listDataChild.put(Header.getName(), subHeaders); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageJsonParser.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageJsonParser.java index bb923958cd..036b83d4ed 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageJsonParser.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageJsonParser.java @@ -16,7 +16,7 @@ public class WikivoyageJsonParser { private static final String LINK = "link"; @Nullable - public static ContentsContainer parseJsonContents(String contentsJson) { + public static ContentsItem parseJsonContents(String contentsJson) { JSONObject jArray; JSONObject reader; @@ -29,15 +29,15 @@ public class WikivoyageJsonParser { return null; } - ContentsContainer topContentsContainer = new ContentsContainer(HEADERS, null); + ContentsItem topContentsItem = new ContentsItem(HEADERS, null); for (int i = 0; i < jArray.length(); i++) { try { String link = ""; JSONObject jsonHeader = jArray.getJSONObject(jArray.names().getString(i)); link = jsonHeader.getString(LINK); - ContentsContainer contentsHeaderContainer = new ContentsContainer(jArray.names().getString(i), link); - topContentsContainer.childItems.add(contentsHeaderContainer); - contentsHeaderContainer.setParent(topContentsContainer); + ContentsItem contentsHeaderItem = new ContentsItem(jArray.names().getString(i), link); + topContentsItem.childItems.add(contentsHeaderItem); + contentsHeaderItem.setParent(topContentsItem); JSONArray jsonSubheaders = jsonHeader.getJSONArray(SUBHEADERS); List subheaderNames = null; @@ -50,35 +50,35 @@ public class WikivoyageJsonParser { subheaderNames.add(jsonSubheader.names().getString(0)); link = jsonSubheaderLink.getString(LINK); - ContentsContainer contentsSubHeaderContainer = new ContentsContainer(jsonSubheader.names().getString(0), link); - contentsHeaderContainer.childItems.add(contentsSubHeaderContainer); - contentsSubHeaderContainer.setParent(topContentsContainer); + ContentsItem contentsSubHeaderContainer = new ContentsItem(jsonSubheader.names().getString(0), link); + contentsHeaderItem.childItems.add(contentsSubHeaderContainer); + contentsSubHeaderContainer.setParent(topContentsItem); } } catch (JSONException e) { e.printStackTrace(); } } - return topContentsContainer; + return topContentsItem; } - public static class ContentsContainer { + public static class ContentsItem { - ArrayList childItems = new ArrayList<>(); - ContentsContainer parent; + private ArrayList childItems = new ArrayList<>(); + private ContentsItem parent; - String name; - String link; + private String name; + private String link; - public ContentsContainer(String name, String link) { + public ContentsItem(String name, String link) { this.name = name; this.link = link; } - public ArrayList getChildItems() { + public ArrayList getChildItems() { return childItems; } - public void setChildItems(ArrayList childItems) { + public void setChildItems(ArrayList childItems) { this.childItems = childItems; } @@ -99,11 +99,11 @@ public class WikivoyageJsonParser { this.link = link; } - public ContentsContainer getParent() { + public ContentsItem getParent() { return parent; } - public void setParent(ContentsContainer parent) { + public void setParent(ContentsItem parent) { this.parent = parent; } }