Fix wiki issues
This commit is contained in:
parent
caa20dcb3b
commit
4335926c8b
4 changed files with 25 additions and 15 deletions
|
@ -267,9 +267,7 @@ public class AppInitializer implements IProgress {
|
|||
app.favorites = startupInit(new FavouritesDbHelper(app), FavouritesDbHelper.class);
|
||||
app.waypointHelper = startupInit(new WaypointHelper(app), WaypointHelper.class);
|
||||
app.regions = startupInit(new OsmandRegions(), OsmandRegions.class);
|
||||
String lang = osmandSettings.PREFERRED_LOCALE.get();
|
||||
String clang = "".equals(lang) ? new Locale(lang).getLanguage() : lang;
|
||||
app.regions.setLocale(clang);
|
||||
app.regions.setLocale(app.getLanguage());
|
||||
app.poiFilters = startupInit(new PoiFiltersHelper(app), PoiFiltersHelper.class);
|
||||
app.rendererRegistry = startupInit(new RendererRegistry(app), RendererRegistry.class);
|
||||
app.targetPointsHelper = startupInit(new TargetPointsHelper(app), TargetPointsHelper.class);
|
||||
|
|
|
@ -78,7 +78,6 @@ public class OsmandApplication extends Application {
|
|||
Handler uiHandler;
|
||||
|
||||
NavigationService navigationService;
|
||||
private Locale preferredLocale = null;
|
||||
|
||||
// start variables
|
||||
ResourceManager resourceManager;
|
||||
|
@ -101,6 +100,7 @@ public class OsmandApplication extends Application {
|
|||
|
||||
|
||||
RoutingConfiguration.Builder defaultRoutingConfig;
|
||||
private Locale preferredLocale = null;
|
||||
private Locale defaultLocale;
|
||||
private File externalStorageDirectory;
|
||||
|
||||
|
@ -131,11 +131,11 @@ public class OsmandApplication extends Application {
|
|||
osmandSettings = appCustomization.getOsmandSettings();
|
||||
externalStorageDirectory = osmandSettings.getExternalStorageDirectory();
|
||||
|
||||
checkPreferredLocale();
|
||||
appInitializer.onCreateApplication();
|
||||
// if(!osmandSettings.FOLLOW_THE_ROUTE.get()) {
|
||||
// targetPointsHelper.clearPointToNavigate(false);
|
||||
// }
|
||||
checkPreferredLocale();
|
||||
startApplication();
|
||||
System.out.println("Time to start application " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
|
||||
timeToStart = System.currentTimeMillis();
|
||||
|
@ -623,6 +623,13 @@ public class OsmandApplication extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
if(preferredLocale != null) {
|
||||
return preferredLocale.getLanguage();
|
||||
}
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
|
||||
public RoutingConfiguration.Builder getDefaultRoutingConfig() {
|
||||
if(defaultRoutingConfig == null) {
|
||||
defaultRoutingConfig = appInitializer.getLazyDefaultRoutingConfig();
|
||||
|
|
|
@ -598,17 +598,20 @@ public class DownloadIndexesThread {
|
|||
File file = new File(((AssetIndexItem) item).getDestFile());
|
||||
oldItemSize = file.length();
|
||||
} else {
|
||||
oldItemSize = new File(item.getType().getDownloadFolder(app, item), sfName +"/_config.p").length();
|
||||
File fl = new File(item.getType().getDownloadFolder(app, item), sfName +"/_config.p");
|
||||
if (fl.exists()) {
|
||||
oldItemSize = fl.length();
|
||||
try {
|
||||
InputStream is = ctx.getAssets().open("voice/" + sfName + "/config.p");
|
||||
if (is != null) {
|
||||
oldItemSize = is.available();
|
||||
itemSize = is.available();
|
||||
is.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (itemSize != oldItemSize){
|
||||
|
|
|
@ -337,9 +337,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
public static void showDescriptionDialog(Context ctx, OsmandApplication app, Amenity a) {
|
||||
String lang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||
if (a.getType().isWiki()) {
|
||||
// First choice to display wiki article in should be the selected OsmAnd locale (not the map display language)
|
||||
//showWiki(ctx, app, a, lang);
|
||||
showWiki(ctx, app, a, app.getSettings().MAP_PREFERRED_LOCALE.get());
|
||||
String preferredLang = lang;
|
||||
if(Algorithms.isEmpty(preferredLang)) {
|
||||
preferredLang = app.getLanguage();
|
||||
}
|
||||
showWiki(ctx, app, a, preferredLang);
|
||||
} else {
|
||||
String d = OsmAndFormatter.getAmenityDescriptionContent(app, a, false);
|
||||
SpannableString spannable = new SpannableString(d);
|
||||
|
|
Loading…
Reference in a new issue