Fix getArticleId
This commit is contained in:
parent
17fd983091
commit
bc501b609a
2 changed files with 11 additions and 7 deletions
|
@ -36,7 +36,7 @@ public interface TravelHelper {
|
||||||
|
|
||||||
String getArticleId(String title, String lang);
|
String getArticleId(String title, String lang);
|
||||||
|
|
||||||
ArrayList<String> getArticleLangs(String articleId);
|
ArrayList<String> getArticleLangs(String routeId);
|
||||||
|
|
||||||
String getGPXName(TravelArticle article);
|
String getGPXName(TravelArticle article);
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ public class TravelObfHelper implements TravelHelper {
|
||||||
private final OsmandApplication app;
|
private final OsmandApplication app;
|
||||||
|
|
||||||
private File selectedTravelBook = null;
|
private File selectedTravelBook = null;
|
||||||
private List<File> existingTravelBooks = new ArrayList<>();
|
private final List<File> existingTravelBooks = new ArrayList<>();
|
||||||
private List<TravelArticle> popularArticles = new ArrayList<>();
|
private List<TravelArticle> popularArticles = new ArrayList<>();
|
||||||
private Map<String, TravelArticle> cachedArticles;
|
private final Map<String, TravelArticle> cachedArticles;
|
||||||
private TravelLocalDataHelper localDataHelper;
|
private final TravelLocalDataHelper localDataHelper;
|
||||||
|
|
||||||
public TravelObfHelper(OsmandApplication app) {
|
public TravelObfHelper(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
@ -264,16 +264,20 @@ public class TravelObfHelper implements TravelHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArticleId(String title, String lang) {
|
public String getArticleId(String title, String lang) {
|
||||||
|
for (TravelArticle article : popularArticles) {
|
||||||
|
if (article.getTitle().equals(title)) {
|
||||||
|
return article.getRouteId();
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> getArticleLangs(String articleId) {
|
public ArrayList<String> getArticleLangs(String routeId) {
|
||||||
ArrayList<String> res = new ArrayList<>();
|
ArrayList<String> res = new ArrayList<>();
|
||||||
res.add("en");
|
res.add("en");
|
||||||
|
|
||||||
for (TravelArticle article : popularArticles) {
|
for (TravelArticle article : popularArticles) {
|
||||||
if (article.getRouteId() == articleId) {
|
if (article.getRouteId().equals(routeId)) {
|
||||||
res.add(article.getLang());
|
res.add(article.getLang());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue