Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2018-04-16 01:01:10 +02:00
commit c771e1c4fd
3 changed files with 6 additions and 8 deletions

View file

@ -13,7 +13,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
@ -66,6 +66,7 @@ import java.util.Locale;
import java.util.Random;
import btools.routingapp.BRouterServiceConnection;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
@ -446,6 +447,9 @@ public class AppInitializer implements IProgress {
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
app.travelDbHelper = startupInit(new TravelDbHelper(app), TravelDbHelper.class);
if (app.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
app.travelDbHelper.initTravelBooks();
}
initOpeningHoursParser();
}

View file

@ -63,7 +63,6 @@ import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.router.GeneralRouter;
import org.apache.commons.logging.Log;
@ -771,7 +770,6 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
getMyApplication().getTravelDbHelper().initTravelBooks();
MapActivity.clearPrevActivityIntent();
WikivoyageExploreDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;

View file

@ -82,13 +82,10 @@ public class TravelDbHelper {
public TravelDbHelper(OsmandApplication application) {
this.application = application;
collator = OsmAndCollator.primaryCollator();
if (application.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
initTravelBooks();
}
localDataHelper = new TravelLocalDataHelper(application);
}
public TravelLocalDataHelper getLocalDataHelper() {
initTravelBooks();
return localDataHelper;
}
@ -100,7 +97,6 @@ public class TravelDbHelper {
File[] possibleFiles = application.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR).listFiles();
String travelBook = application.getSettings().SELECTED_TRAVEL_BOOK.get();
existingTravelBooks.clear();
localDataHelper = new TravelLocalDataHelper(application);
if (possibleFiles != null) {
for (File f : possibleFiles) {
if (f.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)) {