From 4c7779c813d5e81f42e69e9841fc088fac28a53a Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Wed, 18 Apr 2018 22:50:32 +0300 Subject: [PATCH] Show the "is part of" in corresponding language in wikivoyage search list --- .../net/osmand/plus/wikivoyage/data/TravelDbHelper.java | 9 +++++---- .../plus/wikivoyage/data/WikivoyageSearchResult.java | 4 ++-- .../wikivoyage/search/SearchRecyclerViewAdapter.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index 933ac1ac8e..d7b9ededc8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -184,7 +184,7 @@ public class TravelDbHelper { rs.cityId = cursor.getLong(0); rs.articleTitles.add(cursor.getString(1)); rs.langs.add(cursor.getString(2)); - rs.isPartOf = cursor.getString(3); + rs.isPartOf.add(cursor.getString(3)); rs.imageTitle = cursor.getString(4); res.add(rs); } while (cursor.moveToNext()); @@ -237,6 +237,7 @@ public class TravelDbHelper { } prev.articleTitles.add(insInd, rs.articleTitles.get(0)); prev.langs.add(insInd, rs.langs.get(0)); + prev.isPartOf.add(insInd, rs.isPartOf.get(0)); } else { wikivoyage.put(rs.cityId, rs); } @@ -287,11 +288,11 @@ public class TravelDbHelper { rs.cityId = cursor.getLong(0); rs.articleTitles.add(cursor.getString(1)); rs.langs.add(cursor.getString(2)); - rs.isPartOf = cursor.getString(3); - List l = navMap.get(rs.isPartOf); + rs.isPartOf.add(cursor.getString(3)); + List l = navMap.get(rs.isPartOf.get(0)); if (l == null) { l = new ArrayList<>(); - navMap.put(rs.isPartOf, l); + navMap.put(rs.isPartOf.get(0), l); } l.add(rs); } while (cursor.moveToNext()); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java index ab50ba563c..2188c99934 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageSearchResult.java @@ -12,7 +12,7 @@ public class WikivoyageSearchResult { long cityId; List articleTitles = new ArrayList<>(); List langs = new ArrayList<>(); - String isPartOf; + List isPartOf = new ArrayList<>(); String imageTitle; public long getCityId() { @@ -27,7 +27,7 @@ public class WikivoyageSearchResult { return langs; } - public String getIsPartOf() { + public List getIsPartOf() { return isPartOf; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java index 161a143951..893f345a46 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/search/SearchRecyclerViewAdapter.java @@ -82,7 +82,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter