Merge remote-tracking branch 'origin/r3.9'

This commit is contained in:
Victor Shcherb 2021-02-23 12:08:45 +02:00
commit 775719b480
6 changed files with 18 additions and 38 deletions

11
OsmAnd/.gitignore vendored
View file

@ -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

View file

@ -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)

View file

@ -948,6 +948,7 @@ public class TravelObfHelper implements TravelHelper {
}
if (!Algorithms.isEmpty(amenities)) {
article = cacheTravelArticles(reader.getFile(), amenities.get(0), lang, readGpx, callback);
break;
}
}
return article;

View file

@ -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);
}
}

View file

@ -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();

View file

@ -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<WikivoyageExploreActivity> 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();