From d16f3ddebe13d0151dc28c93210e35f6b94bdaef Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 15 Apr 2018 18:31:17 +0200 Subject: [PATCH] If there is a travel book --- .../plus/wikivoyage/data/WikivoyageDbHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java index fc99270896..e588f1efb1 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/WikivoyageDbHelper.java @@ -76,17 +76,27 @@ public class WikivoyageDbHelper { private List existingTravelBooks = new ArrayList<>(); private Collator collator; private WikivoyageLocalDataHelper localDataHelper; + private boolean initialized = false; + public WikivoyageDbHelper(OsmandApplication application) { this.application = application; collator = OsmAndCollator.primaryCollator(); + if(application.getSettings().SELECTED_TRAVEL_BOOK.get() != null) { + initTravelBooks(); + } } public WikivoyageLocalDataHelper getLocalDataHelper() { + initTravelBooks(); return localDataHelper; } public void initTravelBooks() { + if(initialized) { + return; + } + initialized = true; File[] possibleFiles = application.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR).listFiles(); String travelBook = application.getSettings().SELECTED_TRAVEL_BOOK.get(); existingTravelBooks.clear();