diff --git a/OsmAnd/.gitignore b/OsmAnd/.gitignore index 3149fb4209..a4e941e9d2 100644 --- a/OsmAnd/.gitignore +++ b/OsmAnd/.gitignore @@ -39,11 +39,7 @@ mx_* valgrind/ bin/ dist/ -assets/specialphrases/* -assets/voice/* -assets/fonts/* -assets/feature_articles/* -assets/World_basemap_mini* + gen/ local.properties raw/ @@ -56,6 +52,11 @@ out/ use/ osmand.properties osmand.xml +assets/specialphrases/* +assets/voice/* +assets/fonts/* +assets/feature_articles/* +assets/*.obf assets/style.css assets/poi_categories.json assets/help/*.html diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java index a346f496eb..ca438b02eb 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java @@ -159,7 +159,8 @@ public class TravelArticle { System.err.println(e.getMessage()); } String prefix = thumbnail ? THUMB_PREFIX : REGULAR_PREFIX; - return IMAGE_ROOT_URL + "thumb/" + hash[0] + "/" + hash[1] + "/" + imageTitle + "/" + prefix + imageTitle; + String suffix = imageTitle.endsWith(".svg") ? ".png" : ""; + return IMAGE_ROOT_URL + "thumb/" + hash[0] + "/" + hash[1] + "/" + imageTitle + "/" + prefix + imageTitle + suffix; } @Size(2) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 6fb0bb8623..390100c7c7 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -943,6 +943,7 @@ public class TravelObfHelper implements TravelHelper { } if (!Algorithms.isEmpty(amenities)) { article = cacheTravelArticles(reader.getFile(), amenities.get(0), lang, readGpx, callback); + break; } } return article; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 1d6d86daa2..396da70e43 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -49,7 +49,6 @@ import java.util.List; import static net.osmand.plus.download.DownloadResources.WIKIVOYAGE_FILE_FILTER; import static net.osmand.plus.resources.ResourceManager.DEFAULT_WIKIVOYAGE_TRAVEL_OBF; -import static net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity.*; public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEvents, TravelLocalDataHelper.Listener { @@ -95,10 +94,6 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv if (app != null) { app.getTravelHelper().getBookmarksHelper().addListener(this); } - WikivoyageExploreActivity exploreActivity = getExploreActivity(); - if (exploreActivity != null) { - exploreActivity.onTabFragmentResume(this); - } } @Override @@ -141,7 +136,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv app.getTravelHelper().initializeDataOnAppStartup(); WikivoyageExploreActivity exploreActivity = getExploreActivity(); if (exploreActivity != null) { - exploreActivity.populateData(); + exploreActivity.populateData(true); } } else { removeRedundantCards(); @@ -194,8 +189,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv travelButtonCard.setListener(new TravelNeededMapsCard.CardListener() { @Override public void onPrimaryButtonClick() { - if (activity instanceof WikivoyageExploreActivity) { - new LoadWikivoyageData((WikivoyageExploreActivity) activity, false).execute(); + WikivoyageExploreActivity exploreActivity = getExploreActivity(); + if (exploreActivity != null) { + exploreActivity.populateData(false); } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java index 95aec13970..6eec7fb9e3 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesTabFragment.java @@ -1,6 +1,5 @@ package net.osmand.plus.wikivoyage.explore; -import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -80,10 +79,6 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav if (dataHelper != null) { dataHelper.addListener(this); } - WikivoyageExploreActivity exploreActivity = getExploreActivity(); - if (exploreActivity != null) { - exploreActivity.onTabFragmentResume(this); - } } @Override @@ -105,16 +100,6 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Trav } } - @Nullable - private WikivoyageExploreActivity getExploreActivity() { - Activity activity = getActivity(); - if (activity != null && activity instanceof WikivoyageExploreActivity) { - return (WikivoyageExploreActivity) activity; - } else { - return null; - } - } - public void invalidateAdapter() { if (adapter != null) { adapter.notifyDataSetChanged(); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java index 29add9c1a7..3bfa4b7a14 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java @@ -156,7 +156,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv }); updateSearchBarVisibility(); - populateData(); + populateData(true); } @Override @@ -249,7 +249,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv invalidateTabAdapters(); break; case WikivoyageOptionsBottomSheetDialogFragment.TRAVEL_BOOK_CHANGED: - populateData(); + populateData(true); break; } } @@ -313,7 +313,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv return ContextCompat.getColor(app, colorId); } - public void populateData() { + public void populateData(final boolean resetData) { switchProgressBarVisibility(true); if (app.isApplicationInitializing()) { final WeakReference activityRef = new WeakReference<>(this); @@ -326,12 +326,12 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv public void onFinish(AppInitializer init) { WikivoyageExploreActivity activity = activityRef.get(); if (AndroidUtils.isActivityNotDestroyed(activity)) { - new LoadWikivoyageData(activity,true).execute(); + new LoadWikivoyageData(activity, resetData).execute(); } } }); } else { - new LoadWikivoyageData(this,true).execute(); + new LoadWikivoyageData(this, resetData).execute(); } } @@ -371,10 +371,6 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv } } - public void onTabFragmentResume(Fragment fragment) { - updateFragments(); - } - @Override public void savedArticlesUpdated() { updateFragments();