Compare commits
26 commits
Author | SHA1 | Date | |
---|---|---|---|
|
6d9567fd98 | ||
|
5e2b0b013d | ||
|
5b1aff575d | ||
|
004a44b073 | ||
|
3aa35b1381 | ||
|
5c7e67fd01 | ||
|
1b8c4fd64e | ||
|
c45b9e6615 | ||
|
0d4e7982ab | ||
|
a022c67dc8 | ||
|
55fdd3b003 | ||
|
9d4923cc2e | ||
|
4335926c8b | ||
|
caa20dcb3b | ||
|
9794de3c58 | ||
|
e90c2ea5f7 | ||
|
427561e1c9 | ||
|
2bb7f051a2 | ||
|
ea3845fe70 | ||
|
89a6360bc0 | ||
|
3e0f95b2d8 | ||
|
635170def2 | ||
|
7f9c8395a6 | ||
|
429581facf | ||
|
ad7c8b35b5 | ||
|
2957968fcc |
49 changed files with 461 additions and 300 deletions
|
@ -1,5 +1,7 @@
|
||||||
package net.osmand;
|
package net.osmand;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +25,7 @@ public class CollatorStringMatcher implements StringMatcher {
|
||||||
|
|
||||||
public CollatorStringMatcher(String part, StringMatcherMode mode) {
|
public CollatorStringMatcher(String part, StringMatcherMode mode) {
|
||||||
this.collator = OsmAndCollator.primaryCollator();
|
this.collator = OsmAndCollator.primaryCollator();
|
||||||
this.part = part;
|
this.part = part.toLowerCase(Locale.getDefault());
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +96,9 @@ public class CollatorStringMatcher implements StringMatcher {
|
||||||
* @param theStart
|
* @param theStart
|
||||||
* @return true if searchIn starts with token
|
* @return true if searchIn starts with token
|
||||||
*/
|
*/
|
||||||
public static boolean cstartsWith(Collator collator, String searchIn, String theStart,
|
public static boolean cstartsWith(Collator collator, String searchInParam, String theStart,
|
||||||
boolean checkBeginning, boolean checkSpaces) {
|
boolean checkBeginning, boolean checkSpaces) {
|
||||||
|
String searchIn = searchInParam.toLowerCase(Locale.getDefault());
|
||||||
int startLength = theStart.length();
|
int startLength = theStart.length();
|
||||||
int searchInLength = searchIn.length();
|
int searchInLength = searchIn.length();
|
||||||
if (startLength == 0) {
|
if (startLength == 0) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class BinaryInspector {
|
||||||
"-zoom=16",
|
"-zoom=16",
|
||||||
// "-bbox=1.74,51.17,1.75,51.16",
|
// "-bbox=1.74,51.17,1.75,51.16",
|
||||||
// "-vstats",
|
// "-vstats",
|
||||||
// "/Users/victorshcherb/osmand/maps/Netherlands_europe_2.obf"
|
// "/Users/victorshcherb/osmand/maps/srtm/Netherlands_europe_2.srtm.obf"
|
||||||
// "/Users/victorshcherb/osmand/maps/World_basemap_2.obf"
|
// "/Users/victorshcherb/osmand/maps/World_basemap_2.obf"
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,6 +61,27 @@ public class RouteDataObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getName(String lang){
|
||||||
|
if(names != null ) {
|
||||||
|
if(Algorithms.isEmpty(lang)) {
|
||||||
|
return names.get(region.nameTypeRule);
|
||||||
|
}
|
||||||
|
int[] kt = names.keys();
|
||||||
|
for(int i = 0 ; i < kt.length; i++) {
|
||||||
|
int k = kt[i];
|
||||||
|
if(region.routeEncodingRules.size() > k) {
|
||||||
|
if(("name:"+lang).equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
|
return names.get(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return names.get(region.nameTypeRule);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public TIntObjectHashMap<String> getNames() {
|
public TIntObjectHashMap<String> getNames() {
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
@ -76,8 +97,21 @@ public class RouteDataObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDestinationName(){
|
public String getDestinationName(String lang){
|
||||||
if(names != null) {
|
if(names != null) {
|
||||||
|
if(Algorithms.isEmpty(lang)) {
|
||||||
|
return names.get(region.destinationTypeRule);
|
||||||
|
}
|
||||||
|
int[] kt = names.keys();
|
||||||
|
for(int i = 0 ; i < kt.length; i++) {
|
||||||
|
int k = kt[i];
|
||||||
|
if(region.routeEncodingRules.size() > k) {
|
||||||
|
if(("destination:"+lang).equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
|
return names.get(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return names.get(region.destinationTypeRule);
|
return names.get(region.destinationTypeRule);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -157,24 +157,27 @@ public class Amenity extends MapObject {
|
||||||
setAdditionalInfo(PHONE, phone);
|
setAdditionalInfo(PHONE, phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNameSelected(String lang) {
|
public String getContentSelected(String tag, String lang, String defLang) {
|
||||||
if (lang != null) {
|
if (lang != null) {
|
||||||
String translateName;
|
String translateName = getAdditionalInfo(tag + ":" + lang);
|
||||||
if (lang.equals("en")) {
|
|
||||||
translateName = getEnName();
|
|
||||||
} else {
|
|
||||||
translateName = getAdditionalInfo("name:" + lang);
|
|
||||||
}
|
|
||||||
if (!Algorithms.isEmpty(translateName)) {
|
if (!Algorithms.isEmpty(translateName)) {
|
||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String plainName = getAdditionalInfo(tag);
|
||||||
|
if (!Algorithms.isEmpty(plainName)) {
|
||||||
|
return defLang;
|
||||||
|
}
|
||||||
|
String enName = getAdditionalInfo(tag + ":en");
|
||||||
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
|
return enName;
|
||||||
|
}
|
||||||
for (String nm : getAdditionalInfo().keySet()) {
|
for (String nm : getAdditionalInfo().keySet()) {
|
||||||
if (nm.startsWith("name:")) {
|
if (nm.startsWith("name:")) {
|
||||||
return nm.substring("name:".length());
|
return nm.substring("name:".length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return defLang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName(String lang) {
|
public String getName(String lang) {
|
||||||
|
|
|
@ -1173,7 +1173,6 @@ OsmAnd هو المصدر المفتوح و التي يجري تطويرها بن
|
||||||
<string name="local_index_items_deleted">حُذف %1$d عنصرًا من %2$d بنجاح.</string>
|
<string name="local_index_items_deleted">حُذف %1$d عنصرًا من %2$d بنجاح.</string>
|
||||||
<string name="local_index_items_restored">نُشّط %1$d عنصرًا من %2$d بنجاح.</string>
|
<string name="local_index_items_restored">نُشّط %1$d عنصرًا من %2$d بنجاح.</string>
|
||||||
<string name="local_index_no_items_to_do">لا عناصر لـ %1$s</string>
|
<string name="local_index_no_items_to_do">لا عناصر لـ %1$s</string>
|
||||||
<string name="local_index_action_do">كنت على وشك أن٪ 1 $ و٪ 2 $ بنود ق). المتابعة؟</string>
|
|
||||||
<string name="local_index_descr_title">إدارة ملفات الخرائط</string>
|
<string name="local_index_descr_title">إدارة ملفات الخرائط</string>
|
||||||
<string name="local_index_mi_restore">فعّل</string>
|
<string name="local_index_mi_restore">فعّل</string>
|
||||||
<string name="local_index_mi_backup">عطّل</string>
|
<string name="local_index_mi_backup">عطّل</string>
|
||||||
|
|
|
@ -2265,5 +2265,5 @@
|
||||||
<string name="local_indexes_cat_wiki">위키백과</string>
|
<string name="local_indexes_cat_wiki">위키백과</string>
|
||||||
<string name="shared_string_show_details">세부 정보 보기</string>
|
<string name="shared_string_show_details">세부 정보 보기</string>
|
||||||
<string name="osm_edit_context_menu_delete">OSM 편집을 삭제</string>
|
<string name="osm_edit_context_menu_delete">OSM 편집을 삭제</string>
|
||||||
<string name="local_recordings_delete_all_confirm">%1$ 노트를 삭제 하려고 합니다. 확실한가요?</string>
|
<string name="local_recordings_delete_all_confirm">%1$d 노트를 삭제 하려고 합니다. 확실한가요?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -781,4 +781,53 @@
|
||||||
<string name="poi_military_range">Military range</string>
|
<string name="poi_military_range">Military range</string>
|
||||||
<string name="poi_military_naval_base">Military naval base</string>
|
<string name="poi_military_naval_base">Military naval base</string>
|
||||||
<string name="poi_military_nuclear_explosion_site">Nuclear explosion site</string>
|
<string name="poi_military_nuclear_explosion_site">Nuclear explosion site</string>
|
||||||
|
|
||||||
|
<string name="poi_wiki_place">Wikipedia</string>
|
||||||
|
<string name="poi_wiki_lang_en">English wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ar">Arabic wiki</string>
|
||||||
|
<string name="poi_wiki_lang_be">Belarusian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_bg">Bulgarian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ca">Catalan wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ceb">Cebuano wiki</string>
|
||||||
|
<string name="poi_wiki_lang_cs">Czech wiki</string>
|
||||||
|
<string name="poi_wiki_lang_da">Danish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_de">German wiki</string>
|
||||||
|
<string name="poi_wiki_lang_el">Greek wiki</string>
|
||||||
|
<string name="poi_wiki_lang_et">Estonian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_es">Spanish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_fi">Finnish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_fr">French wiki</string>
|
||||||
|
<string name="poi_wiki_lang_gl">Galician wiki</string>
|
||||||
|
<string name="poi_wiki_lang_he">Hebrew wiki</string>
|
||||||
|
<string name="poi_wiki_lang_hi">Hindi wiki</string>
|
||||||
|
<string name="poi_wiki_lang_hr">Croatian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ht">Haitian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_hu">Hungarian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_id">Indonesian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_it">Italian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ja">Japanese wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ko">Korean wiki</string>
|
||||||
|
<string name="poi_wiki_lang_lt">Lithuanian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_lv">Latvian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ms">Malay wiki</string>
|
||||||
|
<string name="poi_wiki_lang_new">Newar wiki</string>
|
||||||
|
<string name="poi_wiki_lang_nl">Dutch wiki</string>
|
||||||
|
<string name="poi_wiki_lang_nn">Norwegian Nynorsk wiki</string>
|
||||||
|
<string name="poi_wiki_lang_no">Norwegian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_pl">Polish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_pt">Portuguese wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ro">Romanian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_ru">Russian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_sk">Slovak wiki</string>
|
||||||
|
<string name="poi_wiki_lang_sl">Slovene wiki</string>
|
||||||
|
<string name="poi_wiki_lang_sr">Serbian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_sv">Swedish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_sw">Swahili wiki</string>
|
||||||
|
<string name="poi_wiki_lang_te">Telugu wiki</string>
|
||||||
|
<string name="poi_wiki_lang_th">Thai wiki</string>
|
||||||
|
<string name="poi_wiki_lang_tr">Turkish wiki</string>
|
||||||
|
<string name="poi_wiki_lang_uk">Ukrainian wiki</string>
|
||||||
|
<string name="poi_wiki_lang_vi">Vietnamese wiki</string>
|
||||||
|
<string name="poi_wiki_lang_vo">Volapük wiki</string>
|
||||||
|
<string name="poi_wiki_lang_zh">Chinese wiki</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -9,6 +9,38 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="light_theme">Light</string>
|
||||||
|
<string name="dark_theme">Dark</string>
|
||||||
|
<string name="lang_pms">Piedmontese</string>
|
||||||
|
<string name="lang_bn">Bengali</string>
|
||||||
|
<string name="lang_tl">Tagalog</string>
|
||||||
|
<string name="lang_sh">Serbo-Croatian</string>
|
||||||
|
<string name="lang_az">Azeri</string>
|
||||||
|
<string name="lang_br">Breton</string>
|
||||||
|
<string name="lang_sq">Albanian</string>
|
||||||
|
<string name="lang_is">Icelandic</string>
|
||||||
|
<string name="lang_bpy">Bishnupriya</string>
|
||||||
|
<string name="lang_nv">Navajo</string>
|
||||||
|
<string name="lang_ga">Irish</string>
|
||||||
|
<string name="lang_la">Latin</string>
|
||||||
|
<string name="lang_ku">Kurdish</string>
|
||||||
|
<string name="lang_ta">Tamil</string>
|
||||||
|
<string name="lang_ml">Malayalam</string>
|
||||||
|
<string name="lang_lb">Luxembourgish</string>
|
||||||
|
<string name="lang_os">Ossetian</string>
|
||||||
|
<string name="lang_eo">Esperanto</string>
|
||||||
|
<string name="lang_es_ar">Argentinean Spanish</string>
|
||||||
|
<string name="lang_nb">Norwegian Bokmål</string>
|
||||||
|
<string name="lang_vo">Volapuk</string>
|
||||||
|
<string name="lang_th">Thai</string>
|
||||||
|
<string name="lang_te">Telugu</string>
|
||||||
|
<string name="lang_nn">Norwegian (Nynorsk)</string>
|
||||||
|
<string name="lang_new">Newar / Nepal Bhasa</string>
|
||||||
|
<string name="lang_ms">Malaysian</string>
|
||||||
|
<string name="lang_ht">Haitian</string>
|
||||||
|
<string name="lang_gl">Galician</string>
|
||||||
|
<string name="lang_et">Estonian</string>
|
||||||
|
<string name="lang_ceb">Cebuano</string>
|
||||||
<string name="archive_wikipedia_data">You have old incompatible wikipedia data downloaded. Do you want to archive it?</string>
|
<string name="archive_wikipedia_data">You have old incompatible wikipedia data downloaded. Do you want to archive it?</string>
|
||||||
<string name="download_wikipedia_files">Do you want to download additional Wikipedia data (%1$s MB) ?</string>
|
<string name="download_wikipedia_files">Do you want to download additional Wikipedia data (%1$s MB) ?</string>
|
||||||
<string name="gps_network_not_enabled">Location service is not enabled. Do you want to turn it on?</string>
|
<string name="gps_network_not_enabled">Location service is not enabled. Do you want to turn it on?</string>
|
||||||
|
|
|
@ -14,11 +14,6 @@ public class AccessibilityPlugin extends OsmandPlugin {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ID;
|
return ID;
|
||||||
|
|
|
@ -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,19 @@ public class OsmandApplication extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
String lang = "";
|
||||||
|
if (preferredLocale != null) {
|
||||||
|
lang = preferredLocale.getLanguage();
|
||||||
|
} else {
|
||||||
|
lang = Locale.getDefault().getLanguage();
|
||||||
|
}
|
||||||
|
if (lang != null && lang.length() > 2) {
|
||||||
|
lang = lang.substring(0, 2).toLowerCase();
|
||||||
|
}
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
|
|
||||||
public RoutingConfiguration.Builder getDefaultRoutingConfig() {
|
public RoutingConfiguration.Builder getDefaultRoutingConfig() {
|
||||||
if(defaultRoutingConfig == null) {
|
if(defaultRoutingConfig == null) {
|
||||||
defaultRoutingConfig = appInitializer.getLazyDefaultRoutingConfig();
|
defaultRoutingConfig = appInitializer.getLazyDefaultRoutingConfig();
|
||||||
|
|
|
@ -64,9 +64,10 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize plugin runs just after creation
|
* Initialize plugin runs just after creation
|
||||||
* @param activity TODO
|
|
||||||
*/
|
*/
|
||||||
public abstract boolean init(OsmandApplication app, Activity activity);
|
public boolean init(OsmandApplication app, Activity activity) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void setActive(boolean active) {
|
public void setActive(boolean active) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -67,30 +68,42 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class PreferenceWithListener<T> implements OsmandPreference<T> {
|
private abstract class PreferenceWithListener<T> implements OsmandPreference<T> {
|
||||||
private List<StateChangedListener<T>> l = null;
|
private List<WeakReference<StateChangedListener<T>>> l = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(StateChangedListener<T> listener) {
|
public void addListener(StateChangedListener<T> listener) {
|
||||||
if(l == null) {
|
if(l == null) {
|
||||||
l = new LinkedList<StateChangedListener<T>>();
|
l = new LinkedList<WeakReference<StateChangedListener<T>>>();
|
||||||
}
|
}
|
||||||
if(!l.contains(listener)) {
|
if(!l.contains(new WeakReference<StateChangedListener<T>>(listener))) {
|
||||||
l.add(listener);
|
l.add(new WeakReference<StateChangedListener<T>>(listener));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireEvent(T value){
|
public void fireEvent(T value){
|
||||||
if (l != null) {
|
if (l != null) {
|
||||||
for (StateChangedListener<T> t : l) {
|
Iterator<WeakReference<StateChangedListener<T>>> it = l.iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
StateChangedListener<T> t = it.next().get();
|
||||||
|
if(t == null) {
|
||||||
|
it.remove();
|
||||||
|
} else {
|
||||||
t.stateChanged(value);
|
t.stateChanged(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeListener(StateChangedListener<T> listener) {
|
public void removeListener(StateChangedListener<T> listener) {
|
||||||
if(l != null) {
|
if(l != null) {
|
||||||
l.remove(listener);
|
Iterator<WeakReference<StateChangedListener<T>>> it = l.iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
StateChangedListener<T> t = it.next().get();
|
||||||
|
if(t == listener) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +372,11 @@ public class OsmandSettings {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resetToDefault(){
|
public void resetToDefault(){
|
||||||
set(getDefaultValue());
|
T o = defaultValue;
|
||||||
|
if(defaultValues != null && defaultValues.containsKey(currentMode)){
|
||||||
|
o = defaultValues.get(currentMode);
|
||||||
|
}
|
||||||
|
set(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
helper.editPoiFilter(filter);
|
helper.editPoiFilter(filter);
|
||||||
ListView lv = this.getListView();
|
ListView lv = this.getListView();
|
||||||
AmenityAdapter la = this.getListAdapter();
|
AmenityAdapter la = this.getListAdapter();
|
||||||
la.notifyDataSetInvalidated();
|
la.notifyDataSetChanged();
|
||||||
return lv;
|
return lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
selectAllFromCategory(adapter.getItem(i));
|
selectAllFromCategory(adapter.getItem(i));
|
||||||
}
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deselectAll(){
|
private void deselectAll(){
|
||||||
|
@ -278,6 +279,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
filter.setTypeToAccept(model, false);
|
filter.setTypeToAccept(model, false);
|
||||||
helper.editPoiFilter(filter);
|
helper.editPoiFilter(filter);
|
||||||
}
|
}
|
||||||
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.download.LocalIndexesFragment.LoadLocalIndexTask;
|
import net.osmand.plus.download.LocalIndexesFragment.LoadLocalIndexTask;
|
||||||
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
|
@ -39,19 +40,11 @@ public class LocalIndexHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstalledDateEdition(long t, TimeZone timeZone){
|
public String getInstalledDateEdition(long t, TimeZone timeZone){
|
||||||
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
|
return app.getString(R.string.local_index_installed) + ": " + app.getResourceManager().getDateFormat().format(new Date(t));
|
||||||
if(timeZone != null) {
|
|
||||||
dateFormat.setTimeZone(timeZone);
|
|
||||||
}
|
|
||||||
return app.getString(R.string.local_index_installed) + " : " + dateFormat.format(new Date(t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInstalledDate(long t, TimeZone timeZone){
|
public String getInstalledDate(long t, TimeZone timeZone){
|
||||||
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
|
return app.getResourceManager().getDateFormat().format(new Date(t));
|
||||||
if(timeZone != null) {
|
|
||||||
dateFormat.setTimeZone(timeZone);
|
|
||||||
}
|
|
||||||
return dateFormat.format(new Date(t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDescription(LocalIndexInfo info){
|
public void updateDescription(LocalIndexInfo info){
|
||||||
|
@ -63,6 +56,10 @@ public class LocalIndexHelper {
|
||||||
} else {
|
} else {
|
||||||
info.setDescription(getInstalledDate(f));
|
info.setDescription(getInstalledDate(f));
|
||||||
}
|
}
|
||||||
|
} else if(info.getType() == LocalIndexType.WIKI_DATA){
|
||||||
|
info.setDescription(getInstalledDate(f));
|
||||||
|
} else if(info.getType() == LocalIndexType.SRTM_DATA){
|
||||||
|
info.setDescription(app.getString(R.string.download_srtm_maps));
|
||||||
} else if(info.getType() == LocalIndexType.VOICE_DATA){
|
} else if(info.getType() == LocalIndexType.VOICE_DATA){
|
||||||
info.setDescription(getInstalledDate(f));
|
info.setDescription(getInstalledDate(f));
|
||||||
} else if(info.getType() == LocalIndexType.TTS_VOICE_DATA){
|
} else if(info.getType() == LocalIndexType.TTS_VOICE_DATA){
|
||||||
|
|
|
@ -194,12 +194,10 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
"ru",
|
"ru",
|
||||||
"sc",
|
"sc",
|
||||||
"sr",
|
"sr",
|
||||||
"zh_CN",
|
|
||||||
"sk",
|
"sk",
|
||||||
"sl",
|
"sl",
|
||||||
"es",
|
"es",
|
||||||
"sv",
|
"sv",
|
||||||
"zh_TW",
|
|
||||||
"tr",
|
"tr",
|
||||||
"uk",
|
"uk",
|
||||||
"vi",
|
"vi",
|
||||||
|
@ -243,12 +241,10 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
getString(R.string.lang_ru),
|
getString(R.string.lang_ru),
|
||||||
getString(R.string.lang_sc),
|
getString(R.string.lang_sc),
|
||||||
getString(R.string.lang_sr) + incompleteSuffix,
|
getString(R.string.lang_sr) + incompleteSuffix,
|
||||||
getString(R.string.lang_zh_CN) + incompleteSuffix,
|
|
||||||
getString(R.string.lang_sk),
|
getString(R.string.lang_sk),
|
||||||
getString(R.string.lang_sl),
|
getString(R.string.lang_sl),
|
||||||
getString(R.string.lang_es),
|
getString(R.string.lang_es),
|
||||||
getString(R.string.lang_sv),
|
getString(R.string.lang_sv),
|
||||||
getString(R.string.lang_zh_TW),
|
|
||||||
getString(R.string.lang_tr),
|
getString(R.string.lang_tr),
|
||||||
getString(R.string.lang_uk),
|
getString(R.string.lang_uk),
|
||||||
getString(R.string.lang_vi) + incompleteSuffix,
|
getString(R.string.lang_vi) + incompleteSuffix,
|
||||||
|
@ -382,7 +378,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
|
|
||||||
registerListPreference(
|
registerListPreference(
|
||||||
settings.OSMAND_THEME, misc,
|
settings.OSMAND_THEME, misc,
|
||||||
new String[] { "Dark", "Light" }, new Integer[] { OsmandSettings.OSMAND_DARK_THEME,
|
new String[] { getString(R.string.dark_theme), getString(R.string.light_theme) }, new Integer[] { OsmandSettings.OSMAND_DARK_THEME,
|
||||||
OsmandSettings.OSMAND_LIGHT_THEME});
|
OsmandSettings.OSMAND_LIGHT_THEME});
|
||||||
|
|
||||||
misc.addPreference(createCheckBoxPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS, R.string.use_kalman_filter_compass, R.string.use_kalman_filter_compass_descr));
|
misc.addPreference(createCheckBoxPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS, R.string.use_kalman_filter_compass, R.string.use_kalman_filter_compass_descr));
|
||||||
|
@ -450,8 +446,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void warnAboutChangingStorage(final String newValue) {
|
private void warnAboutChangingStorage(final String newValue) {
|
||||||
String newDir = newValue != null ? newValue.trim() : newValue;
|
String newDir = newValue != null ? newValue.trim() : newValue;
|
||||||
if(!newDir.replace('/', ' ').trim().
|
if(!newDir.replace('/', ' ').trim().
|
||||||
|
|
|
@ -345,7 +345,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
PoiUIFilter custom = getMyApplication().getPoiFilters().getCustomPOIFilter();
|
PoiUIFilter custom = getMyApplication().getPoiFilters().getCustomPOIFilter();
|
||||||
custom.updateTypesToAccept(f);
|
custom.replaceWithPoiFilter(f);
|
||||||
showEditActivity(custom);
|
showEditActivity(custom);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
this.filter.setFilterByName(null);
|
this.filter.setFilterByName(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.filter.updateTypesToAccept(custom);
|
this.filter.replaceWithPoiFilter(custom);
|
||||||
}
|
}
|
||||||
filter.clearPreviousZoom();
|
filter.clearPreviousZoom();
|
||||||
// run query again
|
// run query again
|
||||||
|
|
|
@ -194,6 +194,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc
|
||||||
} else {
|
} else {
|
||||||
custom.setFilterByName(null);
|
custom.setFilterByName(null);
|
||||||
}
|
}
|
||||||
|
custom.clearFilter();
|
||||||
custom.updateTypesToAccept(((AbstractPoiType) item));
|
custom.updateTypesToAccept(((AbstractPoiType) item));
|
||||||
showFilterActivity(custom.getFilterId());
|
showFilterActivity(custom.getFilterId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,11 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.Preference.OnPreferenceClickListener;
|
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
private static final String ID = "osmand.development";
|
private static final String ID = "osmand.development";
|
||||||
|
@ -25,10 +20,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
//ApplicationMode.regWidget("fps", new ApplicationMode[0]);
|
//ApplicationMode.regWidget("fps", new ApplicationMode[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -397,22 +397,24 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String[] mapNamesIds = new String[] { "", "en", "ar", "be", "ca", "cs", "da", "de", "el", "es", "fi", "fr", "he", "hi",
|
static String[] mapNamesIds = new String[] { "", "en", "ar", "be", "bg", "ca", "ceb", "cs", "da", "de", "el", "et", "es", "fi", "fr", "gl", "he", "hi",
|
||||||
"hr", "hu", "it", "ja", "ko", "lt", "lv", "nl", "pl", "ro", "ru", "sk", "sl", "sv", "sw", "zh" };
|
"hr", "ht", "hu", "id", "it", "ja", "ko", "lt", "lv", "ms", "new", "nl", "nn", "no", "pl", "pt", "ro", "ru", "sk", "sl", "sr", "sv", "sw", "te", "th", "tr", "uk", "vi", "vo", "zh" };
|
||||||
|
|
||||||
private String[] getMapNamesValues(Context ctx) {
|
private String[] getMapNamesValues(Context ctx) {
|
||||||
return new String[] { ctx.getString(R.string.local_map_names), ctx.getString(R.string.lang_en),
|
return new String[] { ctx.getString(R.string.local_map_names), ctx.getString(R.string.lang_en),
|
||||||
ctx.getString(R.string.lang_ar),
|
ctx.getString(R.string.lang_ar),
|
||||||
ctx.getString(R.string.lang_be), ctx.getString(R.string.lang_ca), ctx.getString(R.string.lang_cs),
|
ctx.getString(R.string.lang_be), ctx.getString(R.string.lang_bg), ctx.getString(R.string.lang_ca), ctx.getString(R.string.lang_ceb), ctx.getString(R.string.lang_cs),
|
||||||
ctx.getString(R.string.lang_da), ctx.getString(R.string.lang_de), ctx.getString(R.string.lang_el),
|
ctx.getString(R.string.lang_da), ctx.getString(R.string.lang_de), ctx.getString(R.string.lang_el), ctx.getString(R.string.lang_et),
|
||||||
ctx.getString(R.string.lang_es), ctx.getString(R.string.lang_fi), ctx.getString(R.string.lang_fr),
|
ctx.getString(R.string.lang_es), ctx.getString(R.string.lang_fi), ctx.getString(R.string.lang_fr), ctx.getString(R.string.lang_gl),
|
||||||
ctx.getString(R.string.lang_he), ctx.getString(R.string.lang_hi), ctx.getString(R.string.lang_hr),
|
ctx.getString(R.string.lang_he), ctx.getString(R.string.lang_hi), ctx.getString(R.string.lang_hr),
|
||||||
ctx.getString(R.string.lang_hu), ctx.getString(R.string.lang_it), ctx.getString(R.string.lang_ja),
|
ctx.getString(R.string.lang_ht), ctx.getString(R.string.lang_hu), ctx.getString(R.string.lang_id), ctx.getString(R.string.lang_it), ctx.getString(R.string.lang_ja),
|
||||||
ctx.getString(R.string.lang_ko), ctx.getString(R.string.lang_lt),
|
ctx.getString(R.string.lang_ko), ctx.getString(R.string.lang_lt),
|
||||||
ctx.getString(R.string.lang_lv), ctx.getString(R.string.lang_nl),
|
ctx.getString(R.string.lang_lv), ctx.getString(R.string.lang_ms), ctx.getString(R.string.lang_new), ctx.getString(R.string.lang_nl), ctx.getString(R.string.lang_nn),
|
||||||
ctx.getString(R.string.lang_pl), ctx.getString(R.string.lang_ro), ctx.getString(R.string.lang_ru),
|
ctx.getString(R.string.lang_no),
|
||||||
ctx.getString(R.string.lang_sk), ctx.getString(R.string.lang_sl), ctx.getString(R.string.lang_sv),
|
ctx.getString(R.string.lang_pl), ctx.getString(R.string.lang_pt), ctx.getString(R.string.lang_ro), ctx.getString(R.string.lang_ru),
|
||||||
ctx.getString(R.string.lang_sw), ctx.getString(R.string.lang_zh) };
|
ctx.getString(R.string.lang_sk), ctx.getString(R.string.lang_sl), ctx.getString(R.string.lang_sr), ctx.getString(R.string.lang_sv),
|
||||||
|
ctx.getString(R.string.lang_sw), ctx.getString(R.string.lang_te), ctx.getString(R.string.lang_th), ctx.getString(R.string.lang_tr), ctx.getString(R.string.lang_uk),
|
||||||
|
ctx.getString(R.string.lang_vi), ctx.getString(R.string.lang_vo), ctx.getString(R.string.lang_zh) };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createProperties(List<RenderingRuleProperty> customRules, final int strId, String cat,
|
private void createProperties(List<RenderingRuleProperty> customRules, final int strId, String cat,
|
||||||
|
|
|
@ -97,8 +97,25 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
return true;
|
if(isActive()) {
|
||||||
|
if(!mapView.isLayerVisible(distanceCalculatorLayer)) {
|
||||||
|
activity.getMapView().addLayer(distanceCalculatorLayer, 4.5f);
|
||||||
|
}
|
||||||
|
if(distanceControl == null) {
|
||||||
|
registerWidget(activity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
||||||
|
if(distanceCalculatorLayer != null) {
|
||||||
|
activity.getMapView().removeLayer(distanceCalculatorLayer);
|
||||||
|
}
|
||||||
|
if (mapInfoLayer != null && distanceControl != null ) {
|
||||||
|
mapInfoLayer.removeSideWidget(distanceControl);
|
||||||
|
mapInfoLayer.recreateControls();
|
||||||
|
distanceControl = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,7 @@ import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
@ -378,9 +379,12 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
for(String w : wiki) {
|
for(String w : wiki) {
|
||||||
File fl = new File(w);
|
File fl = getMyApplication().getAppPath(w);
|
||||||
File nf = new File(fl.getParentFile() +"/" + IndexConstants.BACKUP_INDEX_DIR, fl.getName());
|
File nf = new File(fl.getParentFile(), IndexConstants.BACKUP_INDEX_DIR + "/"+fl.getName());
|
||||||
fl.renameTo(nf);
|
boolean res = fl.renameTo(nf);
|
||||||
|
if(!res) {
|
||||||
|
System.err.println("Renaming from " + fl.getAbsolutePath() + " to " + nf.getAbsolutePath() + " failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.download;
|
package net.osmand.plus.download;
|
||||||
|
|
||||||
import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT;
|
import static net.osmand.IndexConstants.BINARY_MAP_INDEX_EXT;
|
||||||
import static net.osmand.IndexConstants.BINARY_SRTM_MAP_INDEX_EXT;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class DownloadEntry {
|
||||||
public String assetName;
|
public String assetName;
|
||||||
public DownloadActivityType type;
|
public DownloadActivityType type;
|
||||||
|
|
||||||
public DownloadEntry attachedEntry;
|
|
||||||
public IndexItem item;
|
public IndexItem item;
|
||||||
|
|
||||||
public DownloadEntry(IndexItem item) {
|
public DownloadEntry(IndexItem item) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.download;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -24,6 +25,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning;
|
import net.osmand.plus.download.DownloadFileHelper.DownloadFileShowWarning;
|
||||||
|
import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem;
|
||||||
import net.osmand.plus.helpers.DatabaseHelper;
|
import net.osmand.plus.helpers.DatabaseHelper;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -375,9 +377,6 @@ public class DownloadIndexesThread {
|
||||||
} else {
|
} else {
|
||||||
res = downloadFileHelper.downloadFile(de, this, filesToReindex, this, forceWifi);
|
res = downloadFileHelper.downloadFile(de, this, filesToReindex, this, forceWifi);
|
||||||
}
|
}
|
||||||
if (res && de.attachedEntry != null) {
|
|
||||||
return downloadFile(de.attachedEntry, filesToReindex, forceWifi);
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,8 +592,28 @@ public class DownloadIndexesThread {
|
||||||
outdated = true;
|
outdated = true;
|
||||||
} else {
|
} else {
|
||||||
long itemSize = item.getContentSize();
|
long itemSize = item.getContentSize();
|
||||||
File file = new File(item.getType().getDownloadFolder(app, item), sfName);
|
long oldItemSize = 0;
|
||||||
long oldItemSize = file.length();
|
if(item.getType() == DownloadActivityType.VOICE_FILE) {
|
||||||
|
if(item instanceof AssetIndexItem) {
|
||||||
|
File file = new File(((AssetIndexItem) item).getDestFile());
|
||||||
|
oldItemSize = file.length();
|
||||||
|
} else {
|
||||||
|
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) {
|
||||||
|
itemSize = is.available();
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (itemSize != oldItemSize){
|
if (itemSize != oldItemSize){
|
||||||
outdated = true;
|
outdated = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,19 +328,22 @@ public class UpdatesIndexFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMapDescription(IndexItem item){
|
private String getMapDescription(IndexItem item){
|
||||||
String typeName = getTypeName(item.getType().getResource());
|
String typeName = getTypeName(item, item.getType().getResource());
|
||||||
String date = item.getDate(format);
|
String date = item.getDate(format);
|
||||||
String size = item.getSizeDescription(getActivity());
|
String size = item.getSizeDescription(getActivity());
|
||||||
return typeName + " " + date + " " + size;
|
return typeName + " " + date + " " + size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTypeName(int resId){
|
private String getTypeName(IndexItem item, int resId){
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (resId == R.string.download_regular_maps){
|
if (resId == R.string.download_regular_maps){
|
||||||
return activity.getString(R.string.shared_string_map);
|
return activity.getString(R.string.shared_string_map);
|
||||||
|
} else if (resId == R.string.download_wikipedia_maps){
|
||||||
|
return activity.getString(R.string.download_wikipedia_item);
|
||||||
} else if (resId == R.string.voices) {
|
} else if (resId == R.string.voices) {
|
||||||
return activity.getString(R.string.ttsvoice);
|
return item.getTargetFileName().contains("tts") ? activity.getString(R.string.ttsvoice) : activity
|
||||||
|
.getString(R.string.voice);
|
||||||
} else if (resId == R.string.download_roads_only_maps){
|
} else if (resId == R.string.download_roads_only_maps){
|
||||||
return activity.getString(R.string.roads_only);
|
return activity.getString(R.string.roads_only);
|
||||||
} else if (resId == R.string.download_srtm_maps){
|
} else if (resId == R.string.download_srtm_maps){
|
||||||
|
|
|
@ -96,7 +96,8 @@ public class AvoidSpecificRoads {
|
||||||
|
|
||||||
|
|
||||||
protected String getText(RouteDataObject obj) {
|
protected String getText(RouteDataObject obj) {
|
||||||
return RoutingHelper.formatStreetName(obj.getName(), obj.getRef(), obj.getDestinationName());
|
return RoutingHelper.formatStreetName(obj.getName(app.getSettings().MAP_PREFERRED_LOCALE.get()),
|
||||||
|
obj.getRef(), obj.getDestinationName(app.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialog(final MapActivity mapActivity) {
|
public void showDialog(final MapActivity mapActivity) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
liveMonitoringHelper = new LiveMonitoringHelper(app);
|
liveMonitoringHelper = new LiveMonitoringHelper(app);
|
||||||
final List<ApplicationMode> am = ApplicationMode.allPossibleValues();
|
final List<ApplicationMode> am = ApplicationMode.allPossibleValues();
|
||||||
ApplicationMode.regWidget("monitoring", am.toArray(new ApplicationMode[am.size()]));
|
ApplicationMode.regWidget("monitoring", am.toArray(new ApplicationMode[am.size()]));
|
||||||
|
settings = app.getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,12 +73,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
return R.drawable.trip_recording;
|
return R.drawable.trip_recording;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
settings = app.getSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ID;
|
return ID;
|
||||||
|
@ -95,6 +90,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerLayers(MapActivity activity) {
|
public void registerLayers(MapActivity activity) {
|
||||||
|
registerWidget(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerWidget(MapActivity activity) {
|
||||||
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
||||||
monitoringControl = createMonitoringControl(activity);
|
monitoringControl = createMonitoringControl(activity);
|
||||||
|
|
||||||
|
@ -105,8 +104,17 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
|
if (isActive()) {
|
||||||
if (monitoringControl == null) {
|
if (monitoringControl == null) {
|
||||||
registerLayers(activity);
|
registerWidget(activity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (monitoringControl != null) {
|
||||||
|
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
||||||
|
layer.removeSideWidget(monitoringControl);
|
||||||
|
layer.recreateControls();
|
||||||
|
monitoringControl = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public OsmEditingPlugin(OsmandApplication app) {
|
public OsmEditingPlugin(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsmBugsLayer osmBugsLayer;
|
private OsmBugsLayer osmBugsLayer;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -169,15 +170,33 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
||||||
super.registerMapContextMenuActions(mapActivity, latitude, longitude, adapter, selectedObj);
|
super.registerMapContextMenuActions(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
|
if(isActive()) {
|
||||||
|
if(olayer == null) {
|
||||||
|
registerLayers(activity);
|
||||||
|
}
|
||||||
|
if(osmoControl == null) {
|
||||||
|
registerSideWidget(activity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
||||||
|
if (layer != null && osmoControl != null) {
|
||||||
|
layer.removeSideWidget(osmoControl);
|
||||||
|
osmoControl = null;
|
||||||
|
layer.recreateControls();
|
||||||
|
}
|
||||||
|
if(olayer != null) {
|
||||||
|
activity.getMapView().removeLayer(olayer);
|
||||||
|
olayer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerLayers(MapActivity activity) {
|
public void registerLayers(MapActivity activity) {
|
||||||
super.registerLayers(activity);
|
super.registerLayers(activity);
|
||||||
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
registerSideWidget(activity);
|
||||||
osmoControl = createOsMoControl(activity);
|
|
||||||
layer.registerSideWidget(osmoControl,
|
|
||||||
R.drawable.ic_osmo_dark, R.string.osmo_control, "osmo_control", false, 18);
|
|
||||||
layer.recreateControls();
|
|
||||||
|
|
||||||
if(olayer != null) {
|
if(olayer != null) {
|
||||||
activity.getMapView().removeLayer(olayer);
|
activity.getMapView().removeLayer(olayer);
|
||||||
}
|
}
|
||||||
|
@ -185,6 +204,16 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
||||||
activity.getMapView().addLayer(olayer, 5.5f);
|
activity.getMapView().addLayer(olayer, 5.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerSideWidget(MapActivity activity) {
|
||||||
|
MapInfoLayer layer = activity.getMapLayers().getMapInfoLayer();
|
||||||
|
if (layer != null) {
|
||||||
|
osmoControl = createOsMoControl(activity);
|
||||||
|
layer.registerSideWidget(osmoControl, R.drawable.ic_osmo_dark, R.string.osmo_control, "osmo_control",
|
||||||
|
false, 18);
|
||||||
|
layer.recreateControls();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mapActivityPause(MapActivity activity) {
|
public void mapActivityPause(MapActivity activity) {
|
||||||
groups.addUiListeners(olayer);
|
groups.addUiListeners(olayer);
|
||||||
|
|
|
@ -144,12 +144,6 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ID;
|
return ID;
|
||||||
|
|
|
@ -449,9 +449,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter {
|
||||||
|
|
||||||
|
|
||||||
public void updateTypesToAccept(AbstractPoiType pt) {
|
public void updateTypesToAccept(AbstractPoiType pt) {
|
||||||
acceptedTypes.clear();
|
|
||||||
pt.putTypes(acceptedTypes);
|
pt.putTypes(acceptedTypes);
|
||||||
poiAdditionals.clear();
|
|
||||||
if (pt instanceof PoiType && ((PoiType) pt).isAdditional() && ((PoiType) pt).getParentType() != null) {
|
if (pt instanceof PoiType && ((PoiType) pt).isAdditional() && ((PoiType) pt).getParentType() != null) {
|
||||||
fillPoiAdditionals(((PoiType) pt).getParentType());
|
fillPoiAdditionals(((PoiType) pt).getParentType());
|
||||||
} else {
|
} else {
|
||||||
|
@ -488,7 +486,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTypesToAccept(PoiUIFilter f) {
|
public void replaceWithPoiFilter(PoiUIFilter f) {
|
||||||
acceptedTypes.clear();
|
acceptedTypes.clear();
|
||||||
acceptedTypes.putAll(f.acceptedTypes);
|
acceptedTypes.putAll(f.acceptedTypes);
|
||||||
poiAdditionals.clear();
|
poiAdditionals.clear();
|
||||||
|
|
|
@ -50,12 +50,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public OsmandRasterMapsPlugin(OsmandApplication app) {
|
public OsmandRasterMapsPlugin(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -731,24 +731,23 @@ public class MapRenderRepositories {
|
||||||
Bitmap reuse = prevBmp;
|
Bitmap reuse = prevBmp;
|
||||||
this.prevBmp = this.bmp;
|
this.prevBmp = this.bmp;
|
||||||
this.prevBmpLocation = this.bmpLocation;
|
this.prevBmpLocation = this.bmpLocation;
|
||||||
if (reuse != null && reuse.getWidth() == currentRenderingContext.width && reuse.getHeight() == currentRenderingContext.height) {
|
// necessary for transparent, otherwise 2 times smaller
|
||||||
|
Config cfg = transparent ? Config.ARGB_8888 : Config.RGB_565;
|
||||||
|
if (reuse != null && reuse.getWidth() == currentRenderingContext.width && reuse.getHeight() == currentRenderingContext.height &&
|
||||||
|
cfg == reuse.getConfig()) {
|
||||||
bmp = reuse;
|
bmp = reuse;
|
||||||
bmp.eraseColor(currentRenderingContext.defaultColor);
|
bmp.eraseColor(currentRenderingContext.defaultColor);
|
||||||
} else {
|
} else {
|
||||||
if(reuse != null){
|
if(reuse != null){
|
||||||
log.warn(String.format("Create new image ? %d != %d (w) %d != %d (h) ", currentRenderingContext.width, reuse.getWidth(), currentRenderingContext.height, reuse.getHeight()));
|
log.warn(String.format("Create new image ? %d != %d (w) %d != %d (h) ", currentRenderingContext.width, reuse.getWidth(), currentRenderingContext.height, reuse.getHeight()));
|
||||||
}
|
}
|
||||||
if(transparent) {
|
bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, cfg);
|
||||||
// necessary
|
if(reuse != null) {
|
||||||
bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888);
|
reuse.recycle();
|
||||||
} else {
|
|
||||||
// better picture ?
|
|
||||||
bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.bmp = bmp;
|
this.bmp = bmp;
|
||||||
this.bmpLocation = tileRect;
|
this.bmpLocation = tileRect;
|
||||||
|
|
||||||
if(nativeLib != null) {
|
if(nativeLib != null) {
|
||||||
renderer.generateNewBitmapNative(currentRenderingContext, nativeLib, cNativeObjects, bmp, renderingReq, notifyList);
|
renderer.generateNewBitmapNative(currentRenderingContext, nativeLib, cNativeObjects, bmp, renderingReq, notifyList);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -190,11 +190,6 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
return app.getString(R.string.route_plugin_name);
|
return app.getString(R.string.route_plugin_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(OsmandApplication app, Activity activity) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerWidget(MapActivity activity) {
|
private void registerWidget(MapActivity activity) {
|
||||||
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
||||||
if (mapInfoLayer != null) {
|
if (mapInfoLayer != null) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.router.RouteSegmentResult;
|
import net.osmand.router.RouteSegmentResult;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
|
@ -85,7 +86,7 @@ public class RouteCalculationResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteCalculationResult(List<RouteSegmentResult> list, Location start, LatLon end, List<LatLon> intermediates,
|
public RouteCalculationResult(List<RouteSegmentResult> list, Location start, LatLon end, List<LatLon> intermediates,
|
||||||
Context ctx, boolean leftSide, float routingTime, List<LocationPoint> waypoints) {
|
OsmandApplication ctx, boolean leftSide, float routingTime, List<LocationPoint> waypoints) {
|
||||||
this.routingTime = routingTime;
|
this.routingTime = routingTime;
|
||||||
if(waypoints != null) {
|
if(waypoints != null) {
|
||||||
this.locationPoints.addAll(waypoints);
|
this.locationPoints.addAll(waypoints);
|
||||||
|
@ -207,7 +208,7 @@ public class RouteCalculationResult {
|
||||||
* PREPARATION
|
* PREPARATION
|
||||||
*/
|
*/
|
||||||
private static List<RouteSegmentResult> convertVectorResult(List<RouteDirectionInfo> directions, List<Location> locations, List<RouteSegmentResult> list,
|
private static List<RouteSegmentResult> convertVectorResult(List<RouteDirectionInfo> directions, List<Location> locations, List<RouteSegmentResult> list,
|
||||||
List<AlarmInfo> alarms, Context ctx) {
|
List<AlarmInfo> alarms, OsmandApplication ctx) {
|
||||||
float prevDirectionTime = 0;
|
float prevDirectionTime = 0;
|
||||||
float prevDirectionDistance = 0;
|
float prevDirectionDistance = 0;
|
||||||
List<RouteSegmentResult> segmentsToPopulate = new ArrayList<RouteSegmentResult>();
|
List<RouteSegmentResult> segmentsToPopulate = new ArrayList<RouteSegmentResult>();
|
||||||
|
@ -254,8 +255,8 @@ public class RouteCalculationResult {
|
||||||
}
|
}
|
||||||
RouteSegmentResult next = list.get(lind);
|
RouteSegmentResult next = list.get(lind);
|
||||||
info.setRef(next.getObject().getRef());
|
info.setRef(next.getObject().getRef());
|
||||||
info.setStreetName(next.getObject().getName());
|
info.setStreetName(next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||||
info.setDestinationName(next.getObject().getDestinationName());
|
info.setDestinationName(next.getObject().getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(),
|
String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(),
|
||||||
|
|
|
@ -693,9 +693,9 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
RouteSegmentResult rs = getCurrentSegmentResult();
|
RouteSegmentResult rs = getCurrentSegmentResult();
|
||||||
if(rs != null) {
|
if(rs != null) {
|
||||||
String nm = rs.getObject().getName();
|
String nm = rs.getObject().getName(settings.MAP_PREFERRED_LOCALE.get());
|
||||||
String rf = rs.getObject().getRef();
|
String rf = rs.getObject().getRef();
|
||||||
String dn = rs.getObject().getDestinationName();
|
String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get());
|
||||||
return formatStreetName(nm, rf, dn);
|
return formatStreetName(nm, rf, dn);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -555,10 +555,11 @@ public class VoiceRouter {
|
||||||
getTermString(getSpeakablePointName(i.getDestinationName())) });
|
getTermString(getSpeakablePointName(i.getDestinationName())) });
|
||||||
Term current = empty;
|
Term current = empty;
|
||||||
if (currentSegment != null) {
|
if (currentSegment != null) {
|
||||||
|
|
||||||
RouteDataObject obj = currentSegment.getObject();
|
RouteDataObject obj = currentSegment.getObject();
|
||||||
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
|
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
|
||||||
getTermString(getSpeakablePointName(obj.getName())),
|
getTermString(getSpeakablePointName(obj.getName(settings.MAP_PREFERRED_LOCALE.get()))),
|
||||||
getTermString(getSpeakablePointName(obj.getDestinationName())) });
|
getTermString(getSpeakablePointName(obj.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()))) });
|
||||||
}
|
}
|
||||||
Struct voice = new Struct("voice", next, current );
|
Struct voice = new Struct("voice", next, current );
|
||||||
return voice;
|
return voice;
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public SRTMPlugin(OsmandApplication app) {
|
public SRTMPlugin(OsmandApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,7 +55,6 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(final OsmandApplication app, Activity activity) {
|
public boolean init(final OsmandApplication app, Activity activity) {
|
||||||
HILLSHADE = app.getSettings().registerBooleanPreference("hillshade_layer", true);
|
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
CommonPreference<String> pref = settings.getCustomRenderProperty("contourLines");
|
||||||
if(pref.get().equals("")) {
|
if(pref.get().equals("")) {
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
package net.osmand.plus.touringview;
|
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.OsmandPlugin;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
|
||||||
import android.app.Activity;
|
|
||||||
|
|
||||||
public class TouringViewPlugin extends OsmandPlugin {
|
|
||||||
|
|
||||||
public static final String ID = "touringView.plugin";
|
|
||||||
public static final String COMPONENT = "net.osmand.touringviewPlugin";
|
|
||||||
private static String previousRenderer = RendererRegistry.DEFAULT_RENDER;
|
|
||||||
private OsmandApplication app;
|
|
||||||
|
|
||||||
public TouringViewPlugin(OsmandApplication app) {
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return app.getString(net.osmand.plus.R.string.plugin_touringview_descr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAssetResourceName() {
|
|
||||||
return R.drawable.touring_map_view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return app.getString(net.osmand.plus.R.string.plugin_touringview_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(final OsmandApplication app, final Activity activity) {
|
|
||||||
if(activity != null) {
|
|
||||||
// called from UI
|
|
||||||
previousRenderer = app.getSettings().RENDERER.get();
|
|
||||||
app.getSettings().RENDERER.set(RendererRegistry.TOURING_VIEW);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable(OsmandApplication app) {
|
|
||||||
super.disable(app);
|
|
||||||
if(app.getSettings().RENDERER.get().equals(RendererRegistry.TOURING_VIEW)) {
|
|
||||||
app.getSettings().RENDERER.set(previousRenderer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends Activity> getSettingsActivity() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -52,7 +52,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
private int cachedHash;
|
private int cachedHash;
|
||||||
private int cachedColor;
|
private int cachedColor;
|
||||||
|
|
||||||
private Path path;
|
|
||||||
private static final int startZoom = 7;
|
private static final int startZoom = 7;
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +91,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
paint_1.setAntiAlias(true);
|
paint_1.setAntiAlias(true);
|
||||||
|
|
||||||
|
|
||||||
path = new Path();
|
|
||||||
|
|
||||||
paintBmp = new Paint();
|
paintBmp = new Paint();
|
||||||
paintBmp.setAntiAlias(true);
|
paintBmp.setAntiAlias(true);
|
||||||
|
@ -302,35 +300,35 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
private void drawSegments(Canvas canvas, RotatedTileBox tileBox, List<TrkSegment> points) {
|
private void drawSegments(Canvas canvas, RotatedTileBox tileBox, List<TrkSegment> points) {
|
||||||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||||
for (TrkSegment l : points) {
|
for (TrkSegment l : points) {
|
||||||
path.rewind();
|
|
||||||
int startIndex = -1;
|
int startIndex = -1;
|
||||||
int endIndex = -1;
|
int endIndex = -1;
|
||||||
int prevCross = 0;
|
int prevCross = 0;
|
||||||
boolean intersect = false;
|
double shift = 0;
|
||||||
|
|
||||||
for (int i = 0; i < l.points.size(); i++) {
|
for (int i = 0; i < l.points.size(); i++) {
|
||||||
WptPt ls = l.points.get(i);
|
WptPt ls = l.points.get(i);
|
||||||
int cross = 0;
|
int cross = 0;
|
||||||
cross |= (ls.lon < latLonBounds.left - 0.1 ? 1 : 0);
|
cross |= (ls.lon < latLonBounds.left - shift ? 1 : 0);
|
||||||
cross |= (ls.lon > latLonBounds.right + 0.1 ? 2 : 0);
|
cross |= (ls.lon > latLonBounds.right + shift ? 2 : 0);
|
||||||
cross |= (ls.lat > latLonBounds.top + 0.1 ? 4 : 0);
|
cross |= (ls.lat > latLonBounds.top + shift ? 4 : 0);
|
||||||
cross |= (ls.lat < latLonBounds.bottom - 0.1 ? 8 : 0);
|
cross |= (ls.lat < latLonBounds.bottom - shift ? 8 : 0);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
if ((prevCross & cross) == 0) {
|
if ((prevCross & cross) == 0) {
|
||||||
if (prevCross != 0 || !intersect) {
|
if (endIndex == i - 1 && startIndex != -1) {
|
||||||
if (startIndex > 0) {
|
// continue previous line
|
||||||
|
} else {
|
||||||
|
// start new segment
|
||||||
|
if (startIndex >= 0) {
|
||||||
drawSegment(canvas, tileBox, l, startIndex, endIndex);
|
drawSegment(canvas, tileBox, l, startIndex, endIndex);
|
||||||
}
|
}
|
||||||
startIndex = i - 1;
|
startIndex = i - 1;
|
||||||
}
|
}
|
||||||
endIndex = i;
|
endIndex = i;
|
||||||
intersect = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevCross = cross;
|
prevCross = cross;
|
||||||
}
|
}
|
||||||
if (startIndex != -1) {
|
if (startIndex != -1) {
|
||||||
drawSegment(canvas, tileBox, l, startIndex, l.points.size() - 1);
|
drawSegment(canvas, tileBox, l, startIndex, endIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +343,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
TIntArrayList tx = new TIntArrayList();
|
TIntArrayList tx = new TIntArrayList();
|
||||||
TIntArrayList ty = new TIntArrayList();
|
TIntArrayList ty = new TIntArrayList();
|
||||||
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
Path path = new Path();
|
||||||
for (int i = startIndex; i <= endIndex; i++) {
|
for (int i = startIndex; i <= endIndex; i++) {
|
||||||
WptPt p = l.points.get(i);
|
WptPt p = l.points.get(i);
|
||||||
int x = (int) tb.getPixXFromLatLon(p.lat, p.lon);
|
int x = (int) tb.getPixXFromLatLon(p.lat, p.lon);
|
||||||
|
|
|
@ -82,6 +82,10 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
updateReg(calculateTextState(), reg);
|
updateReg(calculateTextState(), reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSideWidget(TextInfoWidget widget) {
|
||||||
|
mapInfoControls.removeSideWidgetInternal(widget);
|
||||||
|
}
|
||||||
|
|
||||||
public void registerAllControls(){
|
public void registerAllControls(){
|
||||||
RouteInfoWidgetsFactory ric = new RouteInfoWidgetsFactory();
|
RouteInfoWidgetsFactory ric = new RouteInfoWidgetsFactory();
|
||||||
MapInfoWidgetsFactory mic = new MapInfoWidgetsFactory();
|
MapInfoWidgetsFactory mic = new MapInfoWidgetsFactory();
|
||||||
|
@ -305,4 +309,6 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.osmo.OsMoService;
|
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
|
@ -34,21 +32,18 @@ import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||||
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.DialogInterface.OnCancelListener;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
|
@ -64,7 +59,6 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -343,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().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);
|
||||||
|
@ -388,7 +384,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
topBar.setBackgroundColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));
|
topBar.setBackgroundColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));
|
||||||
topBar.setTitleTextColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTextColor)));
|
topBar.setTitleTextColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTextColor)));
|
||||||
|
|
||||||
String lng = a.getNameSelected(lang);
|
String lng = a.getContentSelected("content", lang, "en");
|
||||||
if(Algorithms.isEmpty(lng)) {
|
if(Algorithms.isEmpty(lng)) {
|
||||||
lng = "en";
|
lng = "en";
|
||||||
}
|
}
|
||||||
|
@ -496,7 +492,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
@Override
|
@Override
|
||||||
public PointDescription getObjectName(Object o) {
|
public PointDescription getObjectName(Object o) {
|
||||||
if (o instanceof Amenity) {
|
if (o instanceof Amenity) {
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_POI, ((Amenity) o).getName());
|
return new PointDescription(PointDescription.POINT_TYPE_POI, ((Amenity) o).getName(
|
||||||
|
view.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +523,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Amenity o) {
|
public String getText(Amenity o) {
|
||||||
return o.getName(view.getSettings().usingEnglishNames());
|
return o.getName(view.getSettings().MAP_PREFERRED_LOCALE.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -197,6 +197,7 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
for (int i = 0; i < actionPoints.size(); i++) {
|
for (int i = 0; i < actionPoints.size(); i++) {
|
||||||
Location o = actionPoints.get(i);
|
Location o = actionPoints.get(i);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
|
first = true;
|
||||||
canvas.drawPath(pth, actionPaint);
|
canvas.drawPath(pth, actionPaint);
|
||||||
double angleRad = Math.atan2(y - py, x - px);
|
double angleRad = Math.atan2(y - py, x - px);
|
||||||
double angle = (angleRad * 180 / Math.PI) + 90f;
|
double angle = (angleRad * 180 / Math.PI) + 90f;
|
||||||
|
@ -212,7 +213,6 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
matrix.postRotate((float) angle, actionArrow.getWidth() / 2, 0);
|
matrix.postRotate((float) angle, actionArrow.getWidth() / 2, 0);
|
||||||
matrix.postTranslate(px + pdx - actionArrow.getWidth() / 2, py + pdy);
|
matrix.postTranslate(px + pdx - actionArrow.getWidth() / 2, py + pdy);
|
||||||
canvas.drawBitmap(actionArrow, matrix, paintIconAction);
|
canvas.drawBitmap(actionArrow, matrix, paintIconAction);
|
||||||
first = true;
|
|
||||||
} else {
|
} else {
|
||||||
px = x;
|
px = x;
|
||||||
py = y;
|
py = y;
|
||||||
|
@ -375,77 +375,91 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
double actionDist = 0;
|
double actionDist = 0;
|
||||||
Location previousAction = null;
|
Location previousAction = null;
|
||||||
actionPoints.clear();
|
actionPoints.clear();
|
||||||
int prevPoint = -2;
|
int prevFinishPoint = -1;
|
||||||
for (int i = 0; i < routeNodes.size(); i++) {
|
for (int routePoint = 0; routePoint < routeNodes.size(); routePoint++) {
|
||||||
Location ls = routeNodes.get(i);
|
Location loc = routeNodes.get(routePoint);
|
||||||
if(nf != null) {
|
if(nf != null) {
|
||||||
int pnt = nf.routeEndPointOffset == 0 ? nf.routePointOffset : nf.routeEndPointOffset;
|
int pnt = nf.routeEndPointOffset == 0 ? nf.routePointOffset : nf.routeEndPointOffset;
|
||||||
if(pnt < i + cd ) {
|
if(pnt < routePoint + cd ) {
|
||||||
nf = null;
|
nf = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (nf == null && it.hasNext()) {
|
while (nf == null && it.hasNext()) {
|
||||||
nf = it.next();
|
nf = it.next();
|
||||||
int pnt = nf.routeEndPointOffset == 0 ? nf.routePointOffset : nf.routeEndPointOffset;
|
int pnt = nf.routeEndPointOffset == 0 ? nf.routePointOffset : nf.routeEndPointOffset;
|
||||||
if (pnt < i + cd) {
|
if (pnt < routePoint + cd) {
|
||||||
nf = null;
|
nf = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean action = nf != null && (nf.routePointOffset == i + cd ||
|
boolean action = nf != null && (nf.routePointOffset == routePoint + cd ||
|
||||||
(nf.routePointOffset <= i + cd && i + cd <= nf.routeEndPointOffset));
|
(nf.routePointOffset <= routePoint + cd && routePoint + cd <= nf.routeEndPointOffset));
|
||||||
if(!action && previousAction == null) {
|
if(!action && previousAction == null) {
|
||||||
|
// no need to check
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean visible = leftLongitude <= loc.getLongitude() && loc.getLongitude() <= rightLongitude && bottomLatitude <= loc.getLatitude()
|
||||||
|
&& loc.getLatitude() <= topLatitude;
|
||||||
|
if(action && !visible && previousAction == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean visible = leftLongitude <= ls.getLongitude() && ls.getLongitude() <= rightLongitude && bottomLatitude <= ls.getLatitude()
|
|
||||||
&& ls.getLatitude() <= topLatitude;
|
|
||||||
if (!action) {
|
if (!action) {
|
||||||
if(previousAction != null) {
|
// previousAction != null
|
||||||
float loc = ls.distanceTo(previousAction);
|
float dist = loc.distanceTo(previousAction);
|
||||||
actionDist += loc;
|
actionDist += dist;
|
||||||
if (actionDist >= DISTANCE_ACTION) {
|
if (actionDist >= DISTANCE_ACTION) {
|
||||||
actionPoints.add(calculateProjection(1 - (actionDist - DISTANCE_ACTION) / loc, previousAction, ls));
|
actionPoints.add(calculateProjection(1 - (actionDist - DISTANCE_ACTION) / dist, previousAction, loc));
|
||||||
prevPoint = i;
|
|
||||||
actionPoints.add(null);
|
actionPoints.add(null);
|
||||||
|
prevFinishPoint = routePoint;
|
||||||
previousAction = null;
|
previousAction = null;
|
||||||
actionDist = 0;
|
actionDist = 0;
|
||||||
} else {
|
} else {
|
||||||
actionPoints.add(ls);
|
actionPoints.add(loc);
|
||||||
previousAction = ls;
|
previousAction = loc;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// action point
|
// action point
|
||||||
if(visible) {
|
|
||||||
int ind = actionPoints.size();
|
|
||||||
actionPoints.add(ls);
|
|
||||||
if (previousAction == null) {
|
if (previousAction == null) {
|
||||||
Location lp = ls;
|
addPreviousToActionPoints(lastProjection, routeNodes, DISTANCE_ACTION,
|
||||||
|
prevFinishPoint, routePoint, loc);
|
||||||
|
}
|
||||||
|
actionPoints.add(loc);
|
||||||
|
previousAction = loc;
|
||||||
|
prevFinishPoint = -1;
|
||||||
|
actionDist = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(previousAction != null) {
|
||||||
|
actionPoints.add(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addPreviousToActionPoints(Location lastProjection, List<Location> routeNodes, double DISTANCE_ACTION,
|
||||||
|
int prevFinishPoint, int routePoint, Location loc) {
|
||||||
|
// put some points in front
|
||||||
|
int ind = actionPoints.size();
|
||||||
|
Location lprevious = loc;
|
||||||
double dist = 0;
|
double dist = 0;
|
||||||
for (int k = i - 1; k >= -1; k--) {
|
for (int k = routePoint - 1; k >= -1; k--) {
|
||||||
Location l = k == -1 ? lastProjection : routeNodes.get(k);
|
Location l = k == -1 ? lastProjection : routeNodes.get(k);
|
||||||
float loc = lp.distanceTo(l);
|
float locDist = lprevious.distanceTo(l);
|
||||||
dist += loc;
|
dist += locDist;
|
||||||
if (dist >= DISTANCE_ACTION) {
|
if (dist >= DISTANCE_ACTION) {
|
||||||
if(loc > 1) {
|
if (locDist > 1) {
|
||||||
actionPoints.add(ind, calculateProjection(1 - (dist - DISTANCE_ACTION) / loc, lp, l));
|
actionPoints.add(ind,
|
||||||
|
calculateProjection(1 - (dist - DISTANCE_ACTION) / locDist, lprevious, l));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if(prevPoint == k) {
|
|
||||||
actionPoints.remove(actionPoints.size() - 1);
|
|
||||||
actionPoints.remove(actionPoints.size() - 1);
|
|
||||||
prevPoint = -2;
|
|
||||||
ind = actionPoints.size();
|
|
||||||
}
|
|
||||||
actionPoints.add(ind, l);
|
actionPoints.add(ind, l);
|
||||||
lp = l;
|
lprevious = l;
|
||||||
}
|
}
|
||||||
|
if (prevFinishPoint == k) {
|
||||||
}
|
if (ind >= 2) {
|
||||||
}
|
actionPoints.remove(ind - 2);
|
||||||
previousAction = ls;
|
actionPoints.remove(ind - 2);
|
||||||
actionDist = 0;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,8 @@ public class MapInfoWidgetsFactory {
|
||||||
settings.SHOW_STREET_NAME.get()) {
|
settings.SHOW_STREET_NAME.get()) {
|
||||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||||
if(rt != null) {
|
if(rt != null) {
|
||||||
text = RoutingHelper.formatStreetName(rt.getName(), rt.getRef(), rt.getDestinationName());
|
text = RoutingHelper.formatStreetName(rt.getName(settings.MAP_PREFERRED_LOCALE.get()),
|
||||||
|
rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()));
|
||||||
}
|
}
|
||||||
if(text == null) {
|
if(text == null) {
|
||||||
text = "";
|
text = "";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.views.mapwidgets;
|
package net.osmand.plus.views.mapwidgets;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -89,6 +90,24 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void removeSideWidgetInternal(TextInfoWidget widget) {
|
||||||
|
Iterator<MapWidgetRegInfo> it = left.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
if (it.next().widget == widget) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it = right.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
if (it.next().widget == widget) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu,
|
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu,
|
||||||
int messageId, String key, boolean left, int priorityOrder) {
|
int messageId, String key, boolean left, int priorityOrder) {
|
||||||
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
|
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
|
||||||
|
@ -246,7 +265,7 @@ public class MapWidgetRegistry {
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||||
pref.set(!pref.get());
|
pref.set(!pref.get());
|
||||||
map.updateApplicationModeSettings();
|
map.updateApplicationModeSettings();
|
||||||
a.notifyDataSetInvalidated();
|
a.notifyDataSetChanged();;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue