Merge branch 'master' into patch-23

This commit is contained in:
vshcherb 2020-05-01 17:23:19 +02:00 committed by GitHub
commit c0fbbdc0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 504 additions and 316 deletions

View file

@ -211,6 +211,10 @@ public abstract class MapObject implements Comparable<MapObject> {
location = new LatLon(latitude, longitude);
}
public void setLocation(LatLon loc) {
location = loc;
}
@Override
public int compareTo(MapObject o) {
return OsmAndCollator.primaryCollator().compare(getName(), o.getName());

View file

@ -65,8 +65,12 @@ public class TransportRoute extends MapObject {
return forwardWays;
}
public void mergeForwardWays() {
mergeRouteWays(forwardWays);
resortWaysToStopsOrder(forwardWays, forwardStops);
}
public static void mergeRouteWays(List<Way> forwardWays) {
boolean changed = true;
// combine as many ways as possible
while (changed && forwardWays != null) {
@ -129,10 +133,13 @@ public class TransportRoute extends MapObject {
}
}
}
if (forwardStops.size() > 0) {
}
public static Map<Way, int[]> resortWaysToStopsOrder(List<Way> forwardWays, List<TransportStop> forwardStops) {
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
if (forwardWays != null && forwardStops.size() > 0) {
// resort ways to stops order
final Map<Way, int[]> orderWays = new HashMap<Way, int[]>();
for (Way w : getForwardWays()) {
for (Way w : forwardWays) {
int[] pair = new int[] { 0, 0 };
Node firstNode = w.getFirstNode();
TransportStop st = forwardStops.get(0);
@ -175,6 +182,7 @@ public class TransportRoute extends MapObject {
}
}
return orderWays;
}

View file

@ -965,13 +965,12 @@ public class TransportRoutePlanner {
}
}
//cache for converted TransportRoutes:
private static TLongObjectHashMap<TransportRoute> convertedRoutesCache;
private static TLongObjectHashMap<TransportStop> convertedStopsCache;
public static List<TransportRouteResult> convertToTransportRoutingResult(NativeTransportRoutingResult[] res,
TransportRoutingConfiguration cfg) {
TransportRoutingConfiguration cfg) {
//cache for converted TransportRoutes:
TLongObjectHashMap<TransportRoute> convertedRoutesCache = new TLongObjectHashMap<>();
TLongObjectHashMap<TransportStop> convertedStopsCache = new TLongObjectHashMap<>();
if (res.length == 0) {
return new ArrayList<TransportRouteResult>();
}
@ -983,7 +982,7 @@ public class TransportRoutePlanner {
for (NativeTransportRouteResultSegment ntrs : ntrr.segments) {
TransportRouteResultSegment trs = new TransportRouteResultSegment();
trs.route = convertTransportRoute(ntrs.route);
trs.route = convertTransportRoute(ntrs.route, convertedRoutesCache, convertedStopsCache);
trs.walkTime = ntrs.walkTime;
trs.travelDistApproximate = ntrs.travelDistApproximate;
trs.travelTime = ntrs.travelTime;
@ -1001,7 +1000,9 @@ public class TransportRoutePlanner {
return convertedRes;
}
private static TransportRoute convertTransportRoute(NativeTransportRoute nr) {
private static TransportRoute convertTransportRoute(NativeTransportRoute nr,
TLongObjectHashMap<TransportRoute> convertedRoutesCache,
TLongObjectHashMap<TransportStop> convertedStopsCache) {
TransportRoute r = new TransportRoute();
r.setId(nr.id);
r.setLocation(nr.routeLat, nr.routeLon);
@ -1013,15 +1014,17 @@ public class TransportRoutePlanner {
}
}
r.setFileOffset(nr.fileOffset);
r.setForwardStops(convertTransportStops(nr.forwardStops));
r.setForwardStops(convertTransportStops(nr.forwardStops, convertedStopsCache));
r.setRef(nr.ref);
r.setOperator(nr.routeOperator);
r.setType(nr.type);
r.setDist(nr.dist);
r.setColor(nr.color);
if (nr.intervals != null && nr.intervals.length > 0 && nr.avgStopIntervals !=null && nr.avgStopIntervals.length > 0 && nr.avgWaitIntervals != null && nr.avgWaitIntervals.length > 0) {
r.setSchedule(new TransportSchedule(new TIntArrayList(nr.intervals), new TIntArrayList(nr.avgStopIntervals), new TIntArrayList(nr.avgWaitIntervals)));
if (nr.intervals != null && nr.intervals.length > 0 && nr.avgStopIntervals !=null
&& nr.avgStopIntervals.length > 0 && nr.avgWaitIntervals != null && nr.avgWaitIntervals.length > 0) {
r.setSchedule(new TransportSchedule(new TIntArrayList(nr.intervals),
new TIntArrayList(nr.avgStopIntervals), new TIntArrayList(nr.avgWaitIntervals)));
}
for (int i = 0; i < nr.waysIds.length; i++) {
@ -1032,16 +1035,14 @@ public class TransportRoutePlanner {
r.addWay(new Way(nr.waysIds[i], wnodes));
}
if (convertedRoutesCache == null) {
convertedRoutesCache = new TLongObjectHashMap<>();
}
if (convertedRoutesCache.get(r.getId()) == null) {
convertedRoutesCache.put(r.getId(), r);
}
return r;
}
private static List<TransportStop> convertTransportStops(NativeTransportStop[] nstops) {
private static List<TransportStop> convertTransportStops(NativeTransportStop[] nstops,
TLongObjectHashMap<TransportStop> convertedStopsCache) {
List<TransportStop> stops = new ArrayList<>();
for (NativeTransportStop ns : nstops) {
if (convertedStopsCache != null && convertedStopsCache.get(ns.id) != null) {
@ -1065,16 +1066,6 @@ public class TransportRoutePlanner {
s.distance = ns.distance;
s.x31 = ns.x31;
s.y31 = ns.y31;
// List<TransportRoute> routes1 = new ArrayList<>();
//cache routes to avoid circular conversion and just search them by id
// for (int i = 0; i < ns.routes.length; i++) {
// if (s.getRoutesIds().length == ns.routes.length && convertedRoutesCache != null
// && convertedRoutesCache.get(ns.routesIds[i]) != null) {
// s.addRoute(convertedRoutesCache.get(ns.routesIds[i]));
// } else {
// s.addRoute(convertTransportRoute(ns.routes[i]));
// }
// }
if (ns.pTStopExit_refs != null && ns.pTStopExit_refs.length > 0) {
for (int i = 0; i < ns.pTStopExit_refs.length; i++) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3.2929,1.2929C3.6834,0.9024 4.3166,0.9024 4.7071,1.2929L22.7071,19.2929C23.0976,19.6834 23.0976,20.3166 22.7071,20.7071C22.3166,21.0976 21.6834,21.0976 21.2929,20.7071L3.2929,2.7071C2.9024,2.3166 2.9024,1.6834 3.2929,1.2929Z"
android:fillColor="#1E1F20"
android:fillType="evenOdd"/>
<path
android:pathData="M2.2929,2.2929C2.6834,1.9024 3.3166,1.9024 3.7071,2.2929L21.7071,20.2929C22.0976,20.6834 22.0976,21.3166 21.7071,21.7071C21.3166,22.0976 20.6834,22.0976 20.2929,21.7071L2.2929,3.7071C1.9024,3.3166 1.9024,2.6834 2.2929,2.2929Z"
android:fillColor="#727272"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3.2929,1.2929C3.6834,0.9024 4.3166,0.9024 4.7071,1.2929L22.7071,19.2929C23.0976,19.6834 23.0976,20.3166 22.7071,20.7071C22.3166,21.0976 21.6834,21.0976 21.2929,20.7071L3.2929,2.7071C2.9024,2.3166 2.9024,1.6834 3.2929,1.2929Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<path
android:pathData="M2.2929,2.2929C2.6834,1.9024 3.3166,1.9024 3.7071,2.2929L21.7071,20.2929C22.0976,20.6834 22.0976,21.3166 21.7071,21.7071C21.3166,22.0976 20.6834,22.0976 20.2929,21.7071L2.2929,3.7071C1.9024,3.3166 1.9024,2.6834 2.2929,2.2929Z"
android:fillColor="#727272"
android:fillType="evenOdd"/>
</vector>

View file

@ -85,4 +85,42 @@
<string name="poi_telescope_type">ধরণ</string>
<string name="poi_vending_type">ভেন্ডিং টাইপ</string>
<string name="poi_fuel_avia_type">জ্বালানির ধরণ (এভিয়া)</string>
<string name="poi_washing_machine">ওয়াশিং মেশিন</string>
<string name="poi_tents">তাঁবু</string>
<string name="poi_massage_type">ম্যাসাজ টাইপ</string>
<string name="poi_health_specialty">স্বাস্থ্য বিশেষত্ব</string>
<string name="poi_diet">ডায়েট</string>
<string name="poi_nudism">নগ্নতাবাদ</string>
<string name="poi_beach_surface_type">পৃষ্ঠতল</string>
<string name="poi_water_characteristic">জলের বৈশিষ্ট্য</string>
<string name="poi_seasonal">মৌসুমী</string>
<string name="poi_fireplace">অগ্নিকুণ্ড</string>
<string name="poi_shelter_type">ধরণ</string>
<string name="poi_recycling_accepted_waste">গৃহীত বর্জ্য</string>
<string name="poi_recycling_type">ধরণ</string>
<string name="poi_beauty_salon_service">সেবা</string>
<string name="poi_microbrewery">মাইক্রোব্রিয়ারি</string>
<string name="poi_cocktails">ককটেল</string>
<string name="poi_takeaway">টেক আওয়ায়</string>
<string name="poi_drive_through">ড্রাইভ থ্রু</string>
<string name="poi_drive_in">ড্রাইভ ইন</string>
<string name="poi_delivery">ডেলিভারি</string>
<string name="poi_smoking">ধূমপান</string>
<string name="poi_fee">ফি</string>
<string name="poi_outdoor_seating">বাইরে বসার ব্যবস্থা</string>
<string name="poi_theatre_genre">জেনরে</string>
<string name="poi_piste_grooming">স্কি স্থান এর গ্রুমিং</string>
<string name="poi_piste_difficulty">স্কি স্থান এর কাঠিন্য</string>
<string name="poi_resort_type">ধরণ</string>
<string name="poi_backcountry">গ্রাম্য এলাকা</string>
<string name="poi_scout_camp">স্কাউট ক্যাম্প</string>
<string name="poi_clock_option">অতিরিক্ত</string>
<string name="poi_information_contents">বিষয়বস্তু</string>
<string name="poi_information_type">ধরণ</string>
<string name="poi_denomination">আখ্যা</string>
<string name="poi_religion_type">ধর্ম</string>
<string name="poi_star_rating">ষ্টার রেটিং</string>
<string name="poi_archaeological_site_type">ধরণ</string>
<string name="poi_free_flying_characteristics">বিশিষ্ট</string>
<string name="poi_healthcare_alternative_types">বিশিষ্টতা</string>
</resources>

View file

@ -3647,4 +3647,7 @@ Repræsenterer område: %1$s x %2$s</string>
<string name="some_articles_may_not_available_in_lang">Nogle Wikipedia-artikler er muligvis ikke tilgængelige på dit sprog.</string>
<string name="extra_maps_menu_group">Ekstra kort</string>
<string name="download_unsupported_action">Ikke understøttet handling %1$s</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="search_poi_types">Søg efter IP-typer</string>
<string name="search_poi_types_descr">Kombiner IP-typer fra forskellige kategorier. Tryk på knappen for at vælge alt, tryk på venstre side for valg af kategori.</string>
</resources>

View file

@ -3669,4 +3669,13 @@ Lon %2$s</string>
<string name="additional_actions_descr">Sie können auf diese Aktionen zugreifen, indem Sie auf die Schaltfläche „Aktionen“ tippen.</string>
<string name="select_wikipedia_article_langs">Wählen Sie die Sprachen aus, in denen Wikipedia-Artikel auf der Karte erscheinen sollen. Sie können zwischen allen verfügbaren Sprachen wechseln, während Sie den Artikel lesen.</string>
<string name="hidden_items_descr">Diese Elemente werden aus dem Menü ausgeblendet, aber die dargestellten Optionen oder Plugins funktionieren weiterhin.</string>
<string name="reorder_or_hide_from">Ordnen Sie Elemente aus %1$s neu an oder blenden Sie sie aus.</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="osm_live_payment_subscription_management">Die Bezahlung wird nach der Bestätigung des Kaufs von ihrem Google Play Account abgebucht.
\n
\nDas Abonnement verlängert sich automatisch, sofern es nicht vor dem Verlängerungsdatum gekündigt wird. Erst nach dem Verlängerungsdatum wird die Bezahlung für die Verlängerungsperiode (1 Monat/ 3 Monate/ 1 Jahr) von ihrem Account abgebucht.
\n
\nSie können ihre Abonnements in ihrem Google Play Einstellungen verwalten oder kündigen.</string>
<string name="search_poi_types">Poi-Typen suchen</string>
<string name="search_poi_types_descr">Kombinieren Sie POI-Typen aus verschiedenen Kategorien. Tippen Sie auf den Schalter, um alle auszuwählen, tippen Sie auf die linke Seite, um die Kategorie auszuwählen.</string>
</resources>

View file

@ -3412,7 +3412,7 @@ représentant la zone : %1$s x %2$s</string>
<string name="import_profile">Importer un profil</string>
<string name="monitoring_prefs_descr">Navigation, fiabilité d\'enregistrement</string>
<string name="multimedia_notes_prefs_descr">Taille de l\'image, qualité audio et vidéo</string>
<string name="osm_editing_prefs_descr">Login, mot de passe, édition hors-ligne</string>
<string name="osm_editing_prefs_descr">Connexion, mot de passe, édition hors-ligne</string>
<string name="accessibility_prefs_descr">Choisissez l\'icône, la couleur et le nom</string>
<string name="live_monitoring_descr">Permet le partage de votre position grâce à l\'enregistrement du trajet.</string>
<string name="live_monitoring">Suivi en ligne</string>

View file

@ -3666,4 +3666,12 @@
<string name="extra_maps_menu_group">מפות נוספות</string>
<string name="lang_war">וראי</string>
<string name="download_unsupported_action">הפעולה %1$s אינה נתמכת</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="osm_live_payment_subscription_management">התשלום יחוייב דרך חשבון ה־Google Play שלך עם אישור הרכישה.
\n
\nהמינוי מתחדש אוטומטית אלמלא בוטל בטרם מועד החידוש. החשבון שלך יחוייב בתקופת החידוש (חודש/שלושה חודשים/שנה) רק במועד החידוש.
\n
\nניתן לנהל ולבטל את המינויים שלך על ידי מעבר להגדרות ה־Google Play שלך.</string>
<string name="search_poi_types">חיפוש סוגי נקודות עניין</string>
<string name="search_poi_types_descr">שילוב סוגי נקודות עניין מקטגוריות שונות. יש לגעת כדי לבחור את כולן, נגיעה בצד השמאלי לבחירת קטגוריה.</string>
</resources>

View file

@ -939,7 +939,7 @@ Ferill %2$s</string>
<string name="continuous_rendering">Samfelld myndgerð</string>
<string name="show_point_options">Nota staðsetningu …</string>
<string name="renderers_descr">Veldu útlit myndgerðar</string>
<string name="download_type_to_filter">skrifaðu að sía</string>
<string name="download_type_to_filter">skrifaðu til að sía</string>
<string name="use_high_res_maps">Skjár með háupplausn</string>
<string name="context_menu_item_search_transport">Leita að almenningssamgöngum</string>
<string name="voices">Talskilaboð</string>
@ -3655,7 +3655,7 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="select_wikipedia_article_langs">Veldu þau tungumál sem Wikipedia-greinarnar ættu að birtast á á kortinu. Þú munt geta skipt á milli allra tiltækra tungumála á meðan þú lest greinar.</string>
<string name="some_articles_may_not_available_in_lang">Sumar Wikipedia-greinar gætu verið ekki tiltækar á þínu tungumáli.</string>
<string name="lang_zhyue">Kantónska</string>
<string name="lang_zhminnan">Suður-mín</string>
<string name="lang_zhminnan">Suður-Mín</string>
<string name="lang_yo">Yórúba</string>
<string name="lang_war">Waray</string>
<string name="lang_uz">Úsbekíska</string>
@ -3682,4 +3682,13 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="lang_an">Aragónska</string>
<string name="lang_lmo">Lombardíska</string>
<string name="custom_color">Sérsniðinn litur</string>
<string name="osm_live_payment_subscription_management">Greiðsla verður gjaldfærð á Google Play reikninginn þinn við staðfestingu á kaupunum.
\n
\nÁskrift endurnýjast sjálfkrafa nema hún sé felld niður fyrir endurnýjunardag. Reikningur þinn verður einungis gjaldfærður fyrir endurnýjunartímabil (mánuður / þrír mánuðir / ár) á endurnýjunardegi.
\n
\nÞú getur stýrt og aflýst áskriftunum þínum með því að fara í Google Play stillingarnar þínar.</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="search_poi_types">Leita í tegundum merkisstaða</string>
<string name="search_poi_types_descr">Sameina gerðir merkisstaða úr mismunandi flokkum. Ýttu á hnappinn til að velja allt, ýttu vinstra megin til að fara í val á flokkum.</string>
<string name="download_unsupported_action">Óstudd aðgerð %1$s</string>
</resources>

View file

@ -3531,4 +3531,8 @@
<string name="profile_prefs_reset_successful">Alle profilinnstillinger gjenopprettet til forvalg.</string>
<string name="shared_string_transparency">Gjennomsiktighet</string>
<string name="shared_string_legend">Tegnforklaring</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="reset_plugin_to_default">Tilbakestill programtilleggsinnstillinger til forvalg</string>
<string name="download_unsupported_action">Ustøttet handling %1$s</string>
<string name="extra_maps_menu_group">Ekstra kart</string>
</resources>

View file

@ -3408,7 +3408,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="personal_category_name">Osobiste</string>
<string name="shared_string_downloading_formatted">Pobieranie %s</string>
<string name="desert_render_descr">Dla pustyń i innych słabo zaludnionych obszarów. Bardziej szczegółowa.</string>
<string name="rendering_attr_showCycleNodeNetworkRoutes_name">Pokaż punkty sieci tras rowerowych</string>
<string name="rendering_attr_showCycleNodeNetworkRoutes_name">Pokaż trasy rowerowe z sieci węzłów</string>
<string name="rendering_value_thick_name">Gruby</string>
<string name="select_navigation_icon">Ikona położenia podczas ruchu</string>
<string name="select_map_icon">Ikona położenia podczas spoczynku</string>
@ -3662,21 +3662,21 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="lang_scn">Sycylijski</string>
<string name="lang_cv">Czuwaski</string>
<string name="lang_my">Birmański</string>
<string name="lang_zhminnan"/>
<string name="lang_min"/>
<string name="lang_mg"/>
<string name="lang_zhminnan">Południowy min</string>
<string name="lang_min">Minangkabau</string>
<string name="lang_mg">Malgaski</string>
<string name="lang_pnb">Pendżabski</string>
<string name="download_unsupported_action"/>
<string name="download_unsupported_action">Nieobsługiwana czynność %1$s</string>
<string name="lang_ba">Baszkirski</string>
<string name="lang_war"/>
<string name="lang_sco"/>
<string name="lang_war">Waray</string>
<string name="lang_sco">Scots</string>
<string name="lang_an">Aragoński</string>
<string name="lang_gu"/>
<string name="lang_yo"/>
<string name="lang_gu">Gudźarati</string>
<string name="lang_yo">Joruba</string>
<string name="ui_customization_description">Dostosuj liczbę elementów w menu bocznym, wyglądzie mapy i menu kontekstowym.
\n
\nMożesz wyłączyć nieużywane wtyczki, aby ukryć ich elementy z aplikacji %1$s.</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="search_poi_types">Szukaj typów poi</string>
<string name="search_poi_types_descr">Łącz typy POI z różnych kategorii. Stuknij przełącznik, aby zaznaczyć wszystko, stuknij lewą stronę, aby wybrać kategorię.</string>
<string name="search_poi_types">Szukaj typów użytecznych miejsc</string>
<string name="search_poi_types_descr">Łącz typy użytecznych zmian z różnych kategorii. Stuknij przełącznik, aby zaznaczyć wszystko, stuknij lewą stronę, aby wybrać kategorię.</string>
</resources>

View file

@ -3664,4 +3664,6 @@ Pôr do Sol: %2$s</string>
\nA assinatura é renovada automaticamente, a menos que seja cancelada antes da data de renovação. Sua conta será cobrada pelo período de renovação (mês/três meses/ano) somente na data de renovação.
\n
\nVocê pode gerenciar e cancelar suas assinaturas acessando as configurações do Google Play.</string>
<string name="search_poi_types">Pesquisar tipos de poi</string>
<string name="search_poi_types_descr">Combine tipos de PIs de diferentes categorias. Toque em para selecionar tudo, toque em lado esquerdo para selecionar a categoria.</string>
</resources>

View file

@ -3669,4 +3669,6 @@
\nПодписка продлевается автоматически, если вы не отмените ее до даты продления. С вашего счета будет взиматься плата за период продления (месяц/три месяца/год) разово в день продления.
\n
\nВы можете управлять подписками и отменять их в настройках Google Play.</string>
<string name="search_poi_types_descr">Можно объединить типы POI из разных категорий. Нажмите переключатель, чтобы выбрать все; нажмите слева, чтобы выбрать категорию.</string>
<string name="search_poi_types">Типы POI для поиска</string>
</resources>

View file

@ -3554,4 +3554,5 @@
<string name="poi_dive_centre">Potápačské centrum</string>
<string name="poi_video_telephone">Video</string>
<string name="poi_sms">SMS</string>
<string name="poi_climbing_crag_filter">Lezecká stena</string>
</resources>

View file

@ -3662,4 +3662,12 @@ Zodpovedá oblasti: %1$s x %2$s</string>
<string name="lang_ba">Baškirsky</string>
<string name="lang_an">Aragonsky</string>
<string name="lang_lmo">Lombardsky</string>
<string name="ltr_or_rtl_combine_via_slash_with_space">%1$s / %2$s</string>
<string name="osm_live_payment_subscription_management">Platba bude stiahnutá z vášho účtu Google Play po potvrdení nákupu.
\n
\nPredplatné sa automaticky obnovuje, ak ho pred jeho termínom obnovenia nezrušíte. Platba za obdobie predplatného (mesiac/štvrťrok/rok) bude stiahnutý z vášho účtu len v deň obnovenia.
\n
\nSpravovať a zrušiť vaše predplatné môžete v nastaveniach Google Play.</string>
<string name="search_poi_types">Hľadať typy bodov záujmu</string>
<string name="search_poi_types_descr">Skombinovať typy bodov záujmov z rôznych kategórií. Stlačte prepínač pre zvolenie všetkých, stlačte ľavú stranu pre výber kategórií.</string>
</resources>

View file

@ -3632,4 +3632,6 @@
\nYenileme tarihinden önce iptal edilmediği sürece abonelik otomatik olarak yenilenir. Hesabınızdan yenileme süresi (ay/üç ay/yıl) için sadece yenileme tarihinde ücret alınacaktır.
\n
\nGoogle Play ayarlarınıza giderek aboneliklerinizi yönetebilir ve iptal edebilirsiniz.</string>
<string name="search_poi_types">POI türleri ara</string>
<string name="search_poi_types_descr">Farklı kategorilerdeki POI türlerini birleştirin. Tümünü seçmek için düğmeye dokunun, kategori seçimi için sol tarafa dokunun.</string>
</resources>

View file

@ -3668,4 +3668,6 @@
\n除非您在續訂日期前取消否則將會自動續訂。您的帳號將僅會在續訂日期前收取續訂週期的費用。
\n
\n您可以到您的 Google Play 設定管理與取消您的訂閱。</string>
<string name="search_poi_types">搜尋 POI 類型</string>
<string name="search_poi_types_descr">組合來自不同分類的 POI 類型。點擊開關以全選,點擊左側選取分類。</string>
</resources>

View file

@ -11,6 +11,18 @@
Thx - Hardy
-->
<string name="navigation_profiles_item">Navigation profiles</string>
<string name="legend_item_description">The guide to a map\'s symbology</string>
<string name="osmand_purchases_item">OsmAnd purchases</string>
<string name="subscription_osmandlive_item">Subscription - OsmAnd Live</string>
<string name="favorites_item">Favorites</string>
<string name="map_markers_item">Map markers</string>
<string name="travel_item">Travel (Wikivoyage and Wikipedia)</string>
<string name="measure_distance_item">Measure distance</string>
<string name="radius_ruler_item">Radius ruler</string>
<string name="quick_action_item">Quick action</string>
<string name="mapillary_item">OsmAnd + Mapillary</string>
<string name="tracker_item">OsmAnd tracker</string>
<string name="download_unsupported_action">Unsupported action %1$s</string>
<string name="extra_maps_menu_group">Extra maps</string>
<string name="search_poi_types_descr">Combine POI types from different categories. Tap \"Switch\" to select all, tap the left side for category selection.</string>
@ -3521,7 +3533,7 @@
<string name="faq_item">FAQ</string>
<string name="faq_item_description">Frequently asked questions</string>
<string name="map_viewing_item">Map viewing</string>
<string name="search_on_the_map_item">Searching the map</string>
<string name="search_on_the_map_item">Searching on the map</string>
<string name="instalation_troubleshooting_item">Installation and troubleshooting</string>
<string name="techical_articles_item">Technical articles</string>
<string name="versions_item">Versions</string>

View file

@ -14,6 +14,8 @@ import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import net.osmand.AndroidUtils;
@ -617,7 +619,7 @@ public class AppInitializer implements IProgress {
});
}
public static void loadRoutingFiles(final OsmandApplication app, final LoadRoutingFilesCallback callback) {
public static void loadRoutingFiles(@NonNull final OsmandApplication app, @Nullable final LoadRoutingFilesCallback callback) {
new AsyncTask<Void, Void, Map<String, RoutingConfiguration.Builder>>() {
@Override
@ -653,7 +655,9 @@ public class AppInitializer implements IProgress {
app.getCustomRoutingConfigs().putAll(customConfigs);
}
app.avoidSpecificRoads.initRouteObjects(false);
callback.onRoutingFilesLoaded();
if (callback != null) {
callback.onRoutingFilesLoaded();
}
}
private Map<String, String> getDefaultAttributes() {

View file

@ -45,6 +45,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -368,7 +369,7 @@ public class CustomOsmandPlugin extends OsmandPlugin {
public static List<CustomRegion> collectRegionsFromJson(@NonNull Context ctx, JSONArray jsonArray) throws JSONException {
List<CustomRegion> customRegions = new ArrayList<>();
Map<String, CustomRegion> flatRegions = new HashMap<>();
Map<String, CustomRegion> flatRegions = new LinkedHashMap<>();
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject regionJson = jsonArray.getJSONObject(i);
CustomRegion region = CustomRegion.fromJson(ctx, regionJson);

View file

@ -32,6 +32,8 @@ import java.util.Map;
public class CustomRegion extends WorldRegion {
public static final int INVALID_ID = -1;
private static final Log LOG = PlatformUtil.getLog(CustomRegion.class);
private String scopeId;
@ -51,7 +53,7 @@ public class CustomRegion extends WorldRegion {
private Map<String, String> icons = new HashMap<>();
private Map<String, String> headers = new HashMap<>();
private int headerColor = -1;
private int headerColor = INVALID_ID;
private CustomRegion(String scopeId, String path, String type) {
@ -75,6 +77,11 @@ public class CustomRegion extends WorldRegion {
@ColorInt
public int getHeaderColor() {
if (headerColor != INVALID_ID) {
return headerColor;
} else if (superregion instanceof CustomRegion) {
return ((CustomRegion) superregion).getHeaderColor();
}
return headerColor;
}
@ -83,6 +90,10 @@ public class CustomRegion extends WorldRegion {
return descriptionInfo;
}
public String getIconName(Context ctx) {
return JsonUtils.getLocalizedResFromMap(ctx, icons, null);
}
public static CustomRegion fromJson(@NonNull Context ctx, JSONObject object) throws JSONException {
String scopeId = object.optString("scope-id", null);
String path = object.optString("path", null);
@ -117,9 +128,9 @@ public class CustomRegion extends WorldRegion {
String headerColor = object.optString("header-color", null);
try {
region.headerColor = Algorithms.isEmpty(headerColor) ? 0 : Algorithms.parseColor(headerColor);
region.headerColor = Algorithms.isEmpty(headerColor) ? INVALID_ID : Algorithms.parseColor(headerColor);
} catch (IllegalArgumentException e) {
region.headerColor = 0;
region.headerColor = INVALID_ID;
}
region.descriptionInfo = DownloadDescriptionInfo.fromJson(object.optJSONObject("description"));
@ -138,6 +149,9 @@ public class CustomRegion extends WorldRegion {
JsonUtils.writeLocalizedMapToJson("icon", jsonObject, icons);
JsonUtils.writeLocalizedMapToJson("header", jsonObject, headers);
if (headerColor != INVALID_ID) {
jsonObject.putOpt("header-color", Algorithms.colorToString(headerColor));
}
if (descriptionInfo != null) {
jsonObject.putOpt("description", descriptionInfo.toJson());
}
@ -216,6 +230,7 @@ public class CustomRegion extends WorldRegion {
if ("json".equalsIgnoreCase(dynamicDownloadItems.format)) {
dynamicItemsJson = mapJsonItems(result);
}
app.getDownloadThread().runReloadIndexFilesSilent();
}
}
};
@ -259,7 +274,7 @@ public class CustomRegion extends WorldRegion {
if (value instanceof String) {
String key = (String) value;
int index = key.indexOf("@");
if (index != -1) {
if (index != INVALID_ID) {
key = key.substring(index + 1);
}
return json.opt(key);

View file

@ -99,6 +99,8 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
R.string.navigation_item_description, "feature_articles/navigation.html"));
contextMenuAdapter.addItem(createItem(R.string.faq_item,
R.string.faq_item_description, "feature_articles/faq.html"));
contextMenuAdapter.addItem(createItem(R.string.map_legend,
R.string.legend_item_description, "feature_articles/map-legend.html"));
}
private void createSocialNetworksItems(ContextMenuAdapter contextMenuAdapter) {
@ -127,8 +129,28 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
"feature_articles/find-something-on-map.html"));
contextMenuAdapter.addItem(createItem(R.string.planning_trip_item, NULL_ID,
"feature_articles/trip-planning.html"));
contextMenuAdapter.addItem(createItem(R.string.map_legend, NULL_ID,
"feature_articles/map-legend.html"));
contextMenuAdapter.addItem(createItem(R.string.navigation_profiles_item, NULL_ID,
"feature_articles/navigation-profiles.html"));
contextMenuAdapter.addItem(createItem(R.string.osmand_purchases_item, NULL_ID,
"feature_articles/osmand_purchases.html"));
contextMenuAdapter.addItem(createItem(R.string.subscription_osmandlive_item, NULL_ID,
"feature_articles/subscription.html"));
contextMenuAdapter.addItem(createItem(R.string.favorites_item, NULL_ID,
"feature_articles/favourites.html"));
contextMenuAdapter.addItem(createItem(R.string.map_markers_item, NULL_ID,
"feature_articles/map-markers.html"));
contextMenuAdapter.addItem(createItem(R.string.travel_item, NULL_ID,
"feature_articles/travel.html"));
contextMenuAdapter.addItem(createItem(R.string.measure_distance_item, NULL_ID,
"feature_articles/measure-distance.html"));
contextMenuAdapter.addItem(createItem(R.string.radius_ruler_item, NULL_ID,
"feature_articles/ruler.html"));
contextMenuAdapter.addItem(createItem(R.string.quick_action_item, NULL_ID,
"feature_articles/quick-action.html"));
contextMenuAdapter.addItem(createItem(R.string.mapillary_item, NULL_ID,
"feature_articles/mapillary.html"));
contextMenuAdapter.addItem(createItem(R.string.tracker_item, NULL_ID,
"feature_articles/tracker.html"));
}
private void createPluginsItems(ContextMenuAdapter contextMenuAdapter) {

View file

@ -4,18 +4,25 @@ import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import net.osmand.AndroidUtils;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.CustomRegion;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.IndexItem;
public class DownloadGroupViewHolder {
TextView textView;
private DownloadActivity ctx;
private TextView textView;
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
this.ctx = ctx;
textView = (TextView) v.findViewById(R.id.title);
@ -23,52 +30,64 @@ public class DownloadGroupViewHolder {
private boolean isParentWorld(DownloadResourceGroup group) {
return group.getParentGroup() == null
|| group.getParentGroup().getType() == DownloadResourceGroup.DownloadResourceGroupType.WORLD;
|| group.getParentGroup().getType() == DownloadResourceGroupType.WORLD;
}
private Drawable getIconForGroup(DownloadResourceGroup group) {
Drawable iconStart;
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
OsmandApplication app = ctx.getMyApplication();
UiUtilities cache = app.getUIUtilities();
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
iconStart = cache.getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
iconStart = cache.getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (group.getRegion() instanceof CustomRegion) {
String iconName = ((CustomRegion) group.getRegion()).getIconName(ctx);
int iconId = AndroidUtils.getDrawableId(app, iconName);
if (iconId != 0) {
iconStart = getIconForDownloadedItems(group, iconId);
return iconStart != null ? iconStart : cache.getThemedIcon(iconId);
}
}
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else {
DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId());
iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
if (ii.isDownloaded() || ii.isOutdated()) {
item = ii;
break;
}
}
}
if (item != null) {
if (item.isOutdated()) {
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else {
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
}
}
iconStart = getIconForDownloadedItems(group, R.drawable.ic_map);
if (iconStart == null) {
iconStart = cache.getThemedIcon(R.drawable.ic_map);
}
}
}
return iconStart;
}
private Drawable getIconForDownloadedItems(DownloadResourceGroup group, @DrawableRes int iconId) {
DownloadResourceGroup ggr = group.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
if (ii.isDownloaded() || ii.isOutdated()) {
item = ii;
break;
}
}
}
if (item != null) {
int color = item.isOutdated() ? R.color.color_distance : R.color.color_ok;
return ctx.getMyApplication().getUIUtilities().getIcon(iconId, color);
}
}
return null;
}
public void bindItem(DownloadResourceGroup group) {
String name = group.getName(ctx);
textView.setText(name);
Drawable iconStart = getIconForGroup(group);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
}
}
}

View file

@ -19,6 +19,8 @@ import androidx.fragment.app.DialogFragment;
import androidx.viewpager.widget.ViewPager;
import net.osmand.AndroidUtils;
import net.osmand.map.WorldRegion;
import net.osmand.plus.CustomRegion;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -161,6 +163,13 @@ public class DownloadItemFragment extends DialogFragment implements DownloadEven
updateActionButtons(activity, descriptionInfo, indexItem, buttonsContainer, R.layout.bottom_buttons, nightMode);
}
}
WorldRegion region = group.getParentGroup().getRegion();
if (region instanceof CustomRegion) {
int headerColor = ((CustomRegion) region).getHeaderColor();
if (headerColor != CustomRegion.INVALID_ID) {
toolbar.setBackgroundColor(headerColor);
}
}
}
static void updateActionButtons(final DownloadActivity ctx, DownloadDescriptionInfo descriptionInfo,

View file

@ -0,0 +1,157 @@
package net.osmand.plus.download.ui;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.download.CustomIndexItem;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.IndexItem;
import java.util.ArrayList;
import java.util.List;
public class DownloadResourceGroupAdapter extends OsmandBaseExpandableListAdapter {
private List<DownloadResourceGroup> data = new ArrayList<DownloadResourceGroup>();
private DownloadActivity ctx;
private DownloadResourceGroup mainGroup;
public DownloadResourceGroupAdapter(DownloadActivity ctx) {
this.ctx = ctx;
}
public void update(DownloadResourceGroup mainGroup) {
this.mainGroup = mainGroup;
data = mainGroup.getGroups();
notifyDataSetChanged();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
DownloadResourceGroup drg = data.get(groupPosition);
if (drg.getType().containsIndexItem()) {
return drg.getItemByIndex(childPosition);
}
return drg.getGroupByIndex(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return groupPosition * 10000 + childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
final Object child = getChild(groupPosition, childPosition);
if (child instanceof IndexItem) {
IndexItem item = (IndexItem) child;
DownloadResourceGroup group = getGroupObj(groupPosition);
ItemViewHolder viewHolder;
if (convertView != null && convertView.getTag() instanceof ItemViewHolder) {
viewHolder = (ItemViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.two_line_with_images_list_item, parent, false);
viewHolder = new ItemViewHolder(convertView, ctx);
viewHolder.setShowRemoteDate(true);
convertView.setTag(viewHolder);
}
if (mainGroup.getType() == DownloadResourceGroup.DownloadResourceGroupType.REGION &&
group != null && group.getType() == DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS
&& !(item instanceof CustomIndexItem)) {
viewHolder.setShowTypeInName(true);
viewHolder.setShowTypeInDesc(false);
} else if (group != null && (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.SRTM_HEADER
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.HILLSHADE_HEADER)) {
viewHolder.setShowTypeInName(false);
viewHolder.setShowTypeInDesc(false);
} else {
viewHolder.setShowTypeInDesc(true);
}
viewHolder.bindIndexItem(item);
} else {
DownloadResourceGroup group = (DownloadResourceGroup) child;
DownloadGroupViewHolder viewHolder;
if (convertView != null && convertView.getTag() instanceof DownloadGroupViewHolder) {
viewHolder = (DownloadGroupViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_list_menu_item,
parent, false);
viewHolder = new DownloadGroupViewHolder(ctx, convertView);
convertView.setTag(viewHolder);
}
viewHolder.bindItem(group);
}
return convertView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, final View convertView, final ViewGroup parent) {
View v = convertView;
String section = getGroup(groupPosition);
if (v == null) {
LayoutInflater inflater = LayoutInflater.from(ctx);
v = inflater.inflate(R.layout.download_item_list_section, parent, false);
}
TextView nameView = ((TextView) v.findViewById(R.id.title));
nameView.setText(section);
v.setOnClickListener(null);
TypedValue typedValue = new TypedValue();
Resources.Theme theme = ctx.getTheme();
theme.resolveAttribute(R.attr.activity_background_color, typedValue, true);
v.setBackgroundColor(typedValue.data);
return v;
}
@Override
public int getChildrenCount(int groupPosition) {
return data.get(groupPosition).size();
}
public DownloadResourceGroup getGroupObj(int groupPosition) {
return data.get(groupPosition);
}
@Override
public String getGroup(int groupPosition) {
DownloadResourceGroup drg = data.get(groupPosition);
int rid = drg.getType().getResourceId();
if (rid != -1) {
return ctx.getString(rid);
}
return "";
}
@Override
public int getGroupCount() {
return data.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}

View file

@ -3,11 +3,9 @@ package net.osmand.plus.download.ui;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -28,19 +26,17 @@ import androidx.fragment.app.DialogFragment;
import net.osmand.AndroidNetworkUtils;
import net.osmand.AndroidUtils;
import net.osmand.map.WorldRegion;
import net.osmand.plus.CustomRegion;
import net.osmand.plus.LockableViewPager;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.download.CustomIndexItem;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.DownloadResourceGroup;
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
@ -53,9 +49,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.download.ui.DownloadItemFragment.updateActionButtons;
@ -438,6 +432,13 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
if (group != null) {
listAdapter.update(group);
toolbar.setTitle(group.getName(activity));
WorldRegion region = group.getRegion();
if (region instanceof CustomRegion) {
int headerColor = ((CustomRegion) region).getHeaderColor();
if (headerColor != CustomRegion.INVALID_ID) {
toolbar.setBackgroundColor(headerColor);
}
}
}
expandAllGroups();
}
@ -565,208 +566,4 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
fragment.setArguments(bundle);
return fragment;
}
private static class DownloadGroupViewHolder {
TextView textView;
private DownloadActivity ctx;
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
this.ctx = ctx;
textView = (TextView) v.findViewById(R.id.title);
}
private boolean isParentWorld(DownloadResourceGroup group) {
return group.getParentGroup() == null
|| group.getParentGroup().getType() == DownloadResourceGroupType.WORLD;
}
private Drawable getIconForGroup(DownloadResourceGroup group) {
Drawable iconStart;
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else {
DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
if (ii.isDownloaded() || ii.isOutdated()) {
item = ii;
break;
}
}
}
if (item != null) {
if (item.isOutdated()) {
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else {
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
}
}
}
}
}
return iconStart;
}
public void bindItem(DownloadResourceGroup group) {
String name = group.getName(ctx);
textView.setText(name);
Drawable iconStart = getIconForGroup(group);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
}
}
public static class DownloadResourceGroupAdapter extends OsmandBaseExpandableListAdapter {
private List<DownloadResourceGroup> data = new ArrayList<DownloadResourceGroup>();
private DownloadActivity ctx;
private DownloadResourceGroup mainGroup;
public DownloadResourceGroupAdapter(DownloadActivity ctx) {
this.ctx = ctx;
}
public void update(DownloadResourceGroup mainGroup) {
this.mainGroup = mainGroup;
data = mainGroup.getGroups();
notifyDataSetChanged();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
DownloadResourceGroup drg = data.get(groupPosition);
if (drg.getType().containsIndexItem()) {
return drg.getItemByIndex(childPosition);
}
return drg.getGroupByIndex(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return groupPosition * 10000 + childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
final Object child = getChild(groupPosition, childPosition);
if (child instanceof IndexItem) {
IndexItem item = (IndexItem) child;
DownloadResourceGroup group = getGroupObj(groupPosition);
ItemViewHolder viewHolder;
if (convertView != null && convertView.getTag() instanceof ItemViewHolder) {
viewHolder = (ItemViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.two_line_with_images_list_item, parent, false);
viewHolder = new ItemViewHolder(convertView, ctx);
viewHolder.setShowRemoteDate(true);
convertView.setTag(viewHolder);
}
if (mainGroup.getType() == DownloadResourceGroupType.REGION &&
group != null && group.getType() == DownloadResourceGroupType.REGION_MAPS
&& !(item instanceof CustomIndexItem)) {
viewHolder.setShowTypeInName(true);
viewHolder.setShowTypeInDesc(false);
} else if (group != null && (group.getType() == DownloadResourceGroupType.SRTM_HEADER
|| group.getType() == DownloadResourceGroupType.HILLSHADE_HEADER)) {
viewHolder.setShowTypeInName(false);
viewHolder.setShowTypeInDesc(false);
} else {
viewHolder.setShowTypeInDesc(true);
}
viewHolder.bindIndexItem(item);
} else {
DownloadResourceGroup group = (DownloadResourceGroup) child;
DownloadGroupViewHolder viewHolder;
if (convertView != null && convertView.getTag() instanceof DownloadGroupViewHolder) {
viewHolder = (DownloadGroupViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_list_menu_item,
parent, false);
viewHolder = new DownloadGroupViewHolder(ctx, convertView);
convertView.setTag(viewHolder);
}
viewHolder.bindItem(group);
}
return convertView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, final View convertView, final ViewGroup parent) {
View v = convertView;
String section = getGroup(groupPosition);
if (v == null) {
LayoutInflater inflater = LayoutInflater.from(ctx);
v = inflater.inflate(R.layout.download_item_list_section, parent, false);
}
TextView nameView = ((TextView) v.findViewById(R.id.title));
nameView.setText(section);
v.setOnClickListener(null);
TypedValue typedValue = new TypedValue();
Resources.Theme theme = ctx.getTheme();
theme.resolveAttribute(R.attr.activity_background_color, typedValue, true);
v.setBackgroundColor(typedValue.data);
return v;
}
@Override
public int getChildrenCount(int groupPosition) {
return data.get(groupPosition).size();
}
public DownloadResourceGroup getGroupObj(int groupPosition) {
return data.get(groupPosition);
}
@Override
public String getGroup(int groupPosition) {
DownloadResourceGroup drg = data.get(groupPosition);
int rid = drg.getType().getResourceId();
if (rid != -1) {
return ctx.getString(rid);
}
return "";
}
@Override
public int getGroupCount() {
return data.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
}

View file

@ -854,6 +854,12 @@ public class ImportHelper {
if (!Algorithms.isEmpty(plugin.getDownloadMaps())) {
app.getDownloadThread().runReloadIndexFilesSilent();
}
if (!Algorithms.isEmpty(plugin.getRendererNames())) {
app.getRendererRegistry().updateExternalRenderers();
}
if (!Algorithms.isEmpty(plugin.getRouterNames())) {
loadRoutingFiles(app, null);
}
if (activity != null) {
plugin.onInstall(app, activity);
}

View file

@ -467,6 +467,9 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
if (entity != null) {
if (!isWay && entity instanceof Node) {
// check whether this is node (because id of node could be the same as relation)
if (object instanceof NativeLibrary.RenderedObject && object.getLocation() == null) {
object.setLocation(((NativeLibrary.RenderedObject) object).getLabelLatLon());
}
if (MapUtils.getDistance(entity.getLatLon(), object.getLocation()) < 50) {
if (object instanceof Amenity) {
return replaceEditOsmTags((Amenity) object, entity);

View file

@ -30,6 +30,7 @@ public class RenderingIcons {
private static Map<String, Integer> smallIcons = new LinkedHashMap<String, Integer>();
private static Map<String, Integer> bigIcons = new LinkedHashMap<String, Integer>();
private static Map<String, Bitmap> iconsBmp = new LinkedHashMap<String, Bitmap>();
private static Map<String, Drawable> iconsDrawable = new LinkedHashMap<String, Drawable>();
// private static DisplayMetrics dm;
private static Bitmap cacheBmp = null;
@ -147,7 +148,29 @@ public class RenderingIcons {
}
return iconsBmp.get(s);
}
public static Drawable getDrawableIcon(Context ctx, String s, boolean includeShader) {
if (s == null) {
return null;
}
if (includeShader && shaderIcons.containsKey(s)) {
s = "h_" + s;
}
Drawable d = iconsDrawable.get(s);
if (d == null) {
Integer drawableId = s.startsWith("h_") ? shaderIcons.get(s.substring(2)) : smallIcons.get(s);
if (drawableId != null) {
d = ContextCompat.getDrawable(ctx, drawableId);
if (d != null) {
d = DrawableCompat.wrap(d);
d.mutate();
iconsDrawable.put(s, d);
}
}
}
return d;
}
public static Integer getResId(String id) {
return id.startsWith("h_") ? shaderIcons.get(id.substring(2)) : smallIcons.get(id);
}

View file

@ -491,7 +491,7 @@ public class TransportRoutingHelper {
}
GeneralRouter prouter = config.getRouter(params.mode.getRoutingProfile());
TransportRoutingConfiguration cfg = new TransportRoutingConfiguration(prouter, params.params);
TransportRoutePlanner planner = new TransportRoutePlanner();
TransportRoutingContext ctx = new TransportRoutingContext(cfg, library, files);
ctx.calculationProgress = params.calculationProgress;
if (ctx.library != null && !settings.PT_SAFE_MODE.get()) {
@ -501,9 +501,9 @@ public class TransportRoutingHelper {
MapUtils.get31TileNumberX(params.end.getLongitude()),
MapUtils.get31TileNumberY(params.end.getLatitude()),
cfg, ctx.calculationProgress);
List<TransportRouteResult> res = TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg);
return res;
return TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg);
} else {
TransportRoutePlanner planner = new TransportRoutePlanner();
return planner.buildRoute(ctx, params.start, params.end);
}
}

View file

@ -99,7 +99,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
showResult(sr);
} else {
if (sr.objectType == ObjectType.CITY || sr.objectType == ObjectType.VILLAGE) {
if (sr.objectType == ObjectType.CITY || sr.objectType == ObjectType.VILLAGE || sr.objectType == ObjectType.STREET) {
showResult = true;
}
dialogFragment.completeQueryWithObject(sr);

View file

@ -271,11 +271,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
public void onSettingsImportFinished(boolean succeed, @NonNull List<SettingsItem> items) {
if (succeed) {
app.getRendererRegistry().updateExternalRenderers();
AppInitializer.loadRoutingFiles(app, new AppInitializer.LoadRoutingFilesCallback() {
@Override
public void onRoutingFilesLoaded() {
}
});
AppInitializer.loadRoutingFiles(app, null);
FragmentManager fm = getFragmentManager();
if (fm != null && file != null) {
ImportCompleteFragment.showInstance(fm, items, file.getName());

View file

@ -170,6 +170,7 @@ public class ChangeDataStorageBottomSheet extends BasePreferenceBottomSheet {
fragment.setNewDirectory(newDirectory);
fragment.setTargetFragment(target, 0);
fragment.setUsedOnMap(usedOnMap);
fragment.setArguments(args);
fragment.show(fm, TAG);
return true;
}

View file

@ -816,7 +816,9 @@ public class MapControlsLayer extends OsmandMapLayer {
compassHud.forceHideCompass = forceHideCompass;
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconRes())) {
ApplicationMode appMode = settings.getApplicationMode();
layersHud.setIconColorId(appMode.getIconColorInfo().getColor(isNight));
if (layersHud.setIconResId(appMode.getMapIconRes())) {
layersHud.update(app, isNight);
}
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()

View file

@ -61,11 +61,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
public static final org.apache.commons.logging.Log log = PlatformUtil.getLog(POIMapLayer.class);
private Paint paintIcon;
private Paint paintIconBackground;
private Bitmap poiBackground;
private Bitmap poiBackgroundSmall;
private PorterDuffColorFilter poiColorFilter;
private int poiSize;
private OsmandMapTileView view;
@ -176,11 +176,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
public void initLayer(OsmandMapTileView view) {
this.view = view;
paintIcon = new Paint();
//paintIcon.setStrokeWidth(1);
//paintIcon.setStyle(Style.STROKE);
//paintIcon.setColor(Color.BLUE);
paintIcon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN));
poiSize = dpToPx(view.getContext(), 16f);
poiColorFilter = new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
paintIconBackground = new Paint();
poiBackground = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_orange_poi_shield);
poiBackgroundSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_orange_poi_shield_small);
@ -263,9 +260,14 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
}
}
if (id != null) {
Bitmap bmp = RenderingIcons.getIcon(view.getContext(), id, false);
if (bmp != null) {
canvas.drawBitmap(bmp, x - bmp.getWidth() / 2, y - bmp.getHeight() / 2, paintIcon);
Drawable img = RenderingIcons.getDrawableIcon(view.getContext(), id, false);
if (img != null) {
canvas.save();
canvas.translate(x - poiSize / 2f, y - poiSize / 2f);
img.setBounds(0, 0, poiSize, poiSize);
img.setColorFilter(poiColorFilter);
img.draw(canvas);
canvas.restore();
}
}
}