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