From a06749b0e397bda55b74cee994b9575cc06c5239 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Mon, 21 Dec 2020 11:02:45 +0200 Subject: [PATCH] Add language show saved articles --- .../osmand/plus/wikivoyage/data/TravelLocalDataHelper.java | 5 +++-- .../src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java | 2 +- .../plus/wikivoyage/explore/SavedArticlesTabFragment.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index 881f6cba02..26e6b06582 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -163,9 +163,10 @@ public class TravelLocalDataHelper { } @Nullable - public TravelArticle getSavedArticle(String routeId) { + public TravelArticle getSavedArticle(String routeId, String lang) { for (TravelArticle article : savedArticles) { - if (article.routeId != null && article.routeId.equals(routeId)) { + if (article.routeId != null && article.routeId.equals(routeId) + && article.lang != null && article.lang.equals(lang)) { article.content = article.fullContent; return article; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 2ff29d1a33..1b94b138ac 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -174,7 +174,7 @@ public class TravelObfHelper implements TravelHelper { if (article != null) { return getArticleByIdFromTravelBooks(routeId, lang); } - return localDataHelper.getSavedArticle(routeId); + return localDataHelper.getSavedArticle(routeId, lang); } public TravelArticle getArticleByIdFromTravelBooks(final String routeId, final String lang) { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java index bb058c04e0..14790abfec 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java @@ -161,7 +161,7 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav } TravelArticle oldArticle = (TravelArticle) oldItem; TravelArticle newArticle = (TravelArticle) newItem; - return oldArticle.getRouteId() != null && newArticle.getRouteId() != null && + return oldArticle.getRouteId() != null && oldArticle.getLang() != null && oldArticle.getRouteId().equals(newArticle.getRouteId()) && oldArticle.getLang().equals(newArticle.getLang()); }