diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index 1716464c30..d869b22eff 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -1785,28 +1785,25 @@ public class GPXUtilities { try { XmlPullParser parser = PlatformUtil.newXMLPullParser(); parser.setInput(getUTF8Reader(f)); + Track routeTrack = new Track(); + TrkSegment routeTrackSegment = new TrkSegment(); + routeTrack.segments.add(routeTrackSegment); Stack parserState = new Stack<>(); boolean extensionReadMode = false; - boolean parseExtension = false; - boolean endOfTrkSegment = false; + boolean routePointExtension = false; parserState.push(res); int tok; while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) { if (tok == XmlPullParser.START_TAG) { GPXExtensions parse = parserState.peek(); String tag = parser.getName(); - if (extensionReadMode && parse != null && !parseExtension) { + if (extensionReadMode && parse != null && !routePointExtension) { switch (tag.toLowerCase()) { case "routepointextension": - parseExtension = true; - Track track = new Track(); - res.tracks.add(track); - GPXExtensions parent = parserState.size() > 1 ? parserState.get(parserState.size() - 2) : null; - if (parse instanceof WptPt && parent instanceof Route) { - track.getExtensionsToWrite().putAll(parent.getExtensionsToRead()); - track.getExtensionsToWrite().putAll(parse.getExtensionsToRead()); + routePointExtension = true; + if (parse instanceof WptPt) { + parse.getExtensionsToWrite().put("offset", routeTrackSegment.points.size() + ""); } - parserState.push(track); break; default: @@ -1829,6 +1826,12 @@ public class GPXUtilities { } } else if (parse != null && tag.equals("extensions")) { extensionReadMode = true; + } else if (routePointExtension) { + if (tag.equals("rpt")) { + WptPt wptPt = parseWptAttributes(parser); + routeTrackSegment.points.add(wptPt); + parserState.push(wptPt); + } } else { if (parse instanceof GPXFile) { if (tag.equals("gpx")) { @@ -1934,16 +1937,6 @@ public class GPXUtilities { ((Track) parse).segments.add(trkSeg); parserState.push(trkSeg); } - if (tag.equals("rpt")) { - endOfTrkSegment = false; - TrkSegment trkSeg = new TrkSegment(); - ((Track) parse).segments.add(trkSeg); - parserState.push(trkSeg); - WptPt wptPt = parseWptAttributes(parser); - parse = parserState.peek(); - ((TrkSegment) parse).points.add(wptPt); - parserState.push(wptPt); - } } else if (parse instanceof TrkSegment) { if (tag.equals("trkpt") || tag.equals("rpt")) { WptPt wptPt = parseWptAttributes(parser); @@ -2012,8 +2005,6 @@ public class GPXUtilities { } else if (tag.equals("time")) { String text = readText(parser, "time"); ((WptPt) parse).time = parseTime(text, format, formatMillis); - } else if (tag.toLowerCase().equals("subclass")) { - endOfTrkSegment = true; } } } @@ -2023,9 +2014,7 @@ public class GPXUtilities { String tag = parser.getName(); if (tag.toLowerCase().equals("routepointextension")) { - parseExtension = false; - Object pop = parserState.pop(); - assert pop instanceof Track; + routePointExtension = false; } if (parse != null && tag.equals("extensions")) { extensionReadMode = false; @@ -2067,25 +2056,16 @@ public class GPXUtilities { } else if (tag.equals("rpt")) { Object pop = parserState.pop(); assert pop instanceof WptPt; - if (endOfTrkSegment) { - Object popSegment = parserState.pop(); - if (popSegment instanceof TrkSegment) { - List segments = res.tracks.get(res.tracks.size() - 1).segments; - int last = segments.size() - 1; - if (!Algorithms.isEmpty(segments) && segments.get(last).points.size() < 2) { - segments.remove(last); - } - } - endOfTrkSegment = false; - } } } } + if (!routeTrackSegment.points.isEmpty()) { + res.tracks.add(routeTrack); + } } catch (Exception e) { res.error = e; log.error("Error reading gpx", e); //$NON-NLS-1$ } - return res; } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteStatisticsHelper.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteStatisticsHelper.java index 3aecefa06e..4fe500de2b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteStatisticsHelper.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteStatisticsHelper.java @@ -362,24 +362,27 @@ public class RouteStatisticsHelper { RenderingRulesStorage rrs, RenderingRuleSearchRequest req, RouteSegmentWithIncline segment, int slopeClass) { //String additional = attrName + "=" + attribute; + boolean mainTagAdded = false; + StringBuilder additional = new StringBuilder(slopeClass >= 0 ? (BOUNDARIES_CLASS[slopeClass] + ";") : ""); RouteDataObject obj = segment.obj; - int[] tps = obj.getTypes(); - String additional = slopeClass >= 0 ? (BOUNDARIES_CLASS[slopeClass] + ";") : ""; - for (int k = 0; k < tps.length; k++) { - BinaryMapRouteReaderAdapter.RouteTypeRule tp = obj.region.quickGetEncodingRule(tps[k]); - if (tp.getTag().equals("highway") || tp.getTag().equals("route") || + for (int type : obj.getTypes()) { + BinaryMapRouteReaderAdapter.RouteTypeRule tp = obj.region.quickGetEncodingRule(type); + if (tp.getTag().equals("highway") || tp.getTag().equals("route") || tp.getTag().equals("railway") || tp.getTag().equals("aeroway") || tp.getTag().equals("aerialway")) { - req.setStringFilter(rrs.PROPS.R_TAG, tp.getTag()); - req.setStringFilter(rrs.PROPS.R_VALUE, tp.getValue()); + if (!mainTagAdded) { + req.setStringFilter(rrs.PROPS.R_TAG, tp.getTag()); + req.setStringFilter(rrs.PROPS.R_VALUE, tp.getValue()); + mainTagAdded = true; + } } else { - additional += tp.getTag() + "=" + tp.getValue() + ";"; + additional.append(tp.getTag()).append("=").append(tp.getValue()).append(";"); } } - req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional); + req.setStringFilter(rrs.PROPS.R_ADDITIONAL, additional.toString()); return req.searchRenderingAttribute(attribute); - } } + public static class RouteSegmentAttribute { private final int color; @@ -400,11 +403,11 @@ public class RouteStatisticsHelper { this.slopeIndex = segmentAttribute.slopeIndex; this.userPropertyName = segmentAttribute.userPropertyName; } - + public String getUserPropertyName() { return userPropertyName == null ? propertyName : userPropertyName; } - + public void setUserPropertyName(String userPropertyName) { this.userPropertyName = userPropertyName; } diff --git a/OsmAnd/res/layout/bottom_sheet_item_description_long.xml b/OsmAnd/res/layout/bottom_sheet_item_description_long.xml index d841ca0430..1331d736bc 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_description_long.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_description_long.xml @@ -12,4 +12,5 @@ android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_desc_text_size" android:linksClickable="true" + android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier" tools:text="Some long description"/> diff --git a/OsmAnd/res/layout/order_poi_list_item.xml b/OsmAnd/res/layout/order_poi_list_item.xml index f1d493e094..fc68ff274d 100644 --- a/OsmAnd/res/layout/order_poi_list_item.xml +++ b/OsmAnd/res/layout/order_poi_list_item.xml @@ -11,20 +11,18 @@ - @@ -47,6 +45,8 @@ android:ellipsize="marquee" android:paddingLeft="@dimen/content_padding" android:paddingRight="@dimen/content_padding" + android:paddingTop="@dimen/content_padding_half" + android:paddingBottom="@dimen/content_padding_half" android:singleLine="true" android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size" @@ -56,7 +56,7 @@ إعادة ترتيب الفئات يمكنك إضافة فئات مخصصة للإخفاء التي لا تجدها ضرورية وتغيير ترتيب الفرز في القائمة. يمكن استيراد القائمة وتصديرها مع الملفات الشخصية. يمكنك إضافة فئة مخصصة جديدة عن طريق تحديد فئة أو بضع فئات مطلوبة. - ستؤدي إعادة التعيين إلى الافتراضي إلى حذف أو تخصيص الفئات وإعادة تعيين ترتيب الفرز إلى الحالة الافتراضية بعد التثبيت. متاح إضافة فئة مخصصة اظهر في الليل فقط diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 7ef445eee6..9d6c1059e1 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -3463,7 +3463,6 @@ Abasta l\'àrea: %1$s x %2$s Reorganitza les categories Podeu afegir categories personalitzades, amagar categories que considereu innecessàries i canviar l\'ordenació de la llista. La llista es pot importar i exportar amb perfils. Podeu afegir una nova categoria personalitzada seleccionant-ne una o, si cal, alguna categoria més. - La reinicialització suprimirà les categories personalitzades i restablirà l\'ordre de l\'estat per defecte després de la instal·lació. Disponible Afegeix una categoria personalitzada Mostra només de nit diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index b4ef0ffac7..3bcb065b12 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -3473,7 +3473,6 @@ Repræsenterer område: %1$s x %2$s Omarrangere kategorier Tilføj brugerdefinerede kategorier, skjul kategorier, som ikke er nødvendige, og ændre sorteringsrækkefølgen på listen. Listen kan importeres og eksporteres med profiler. Tilføj en ny brugerdefineret kategori ved at vælge en eller nogle få nødvendige kategorier. - Nulstilling til standard sletter brugerdefinerede kategorier og nulstiller sorteringsrækkefølge til standardtilstand efter installation. Tilgængelig Tilføje brugerdefineret kategori Vis kun om natten diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index da65e50f11..9dd3f8a99d 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -3459,7 +3459,6 @@ Indikas lokon: %1$s x %2$s" Registritaj estos nur punktoj mezuritaj kun la minimuma precizo (en metroj kiel raportitaj fare de Androido per la GPS‑cirkvitaro). Precizo rilatas al disiĝo de valoro dum ripetaj mezuroj kaj ne ĉiam rilatas al ekzakteco, kiu determinas proksimecon de mezuroj al via vera pozicio. Kromefiko: pro filtri laŭ precizo, iuj punktoj – mezuritaj ekz. sub pontoj aŭ arboj, inter altaj konstruaĵoj, aŭ dum malbonaj veteraj kondiĉoj – povos manki. Konsilo: estas malfacile antaŭscii pri kio estos registra kaj kio estos filtrita, do estus bone ne aktivigi tiun ĉi filtrilon. - Per restarigi implicitajn agordojn, propraj kategorioj foriĝos kaj ordigo revenos al la postinstalada stato. Disponebla Aldoni propran kategorion Montri nur dum nokto diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index aea9a5e2f6..f25bd8334b 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -3485,7 +3485,6 @@ Lon %2$s Reordenar categorías Puedes añadir categorías personalizadas, ocultar las categorías que no parezcan necesarias y cambiar el orden de clasificación de la lista. La lista puede ser importada y exportada con perfiles. Puedes añadir una nueva categoría personalizada marcando una o varias categorías necesarias. - Si se restablece el valor predefinido, se borrarán o personalizarán las categorías y se restablecerá el orden de clasificación al estado predefinido después de la instalación. Disponible Añadir categoría personalizada Mostrar solo de noche diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 188bc9668b..7c02275ab0 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -3452,7 +3452,6 @@ Ha szereted az OsmAndot és az OSM-et, és szeretnéd támogatni a fejlődésük Kategóriák átrendezése Hozzáadhat egyedi kategóriát, elrejtheti a fölöslegesnek ítélt kategóriákat, és módosíthatja a lista sorrendjét. A lista a profilokkal importálható és exportálható. Egy vagy több szükséges kategória kijelölésével hozzáadhat egy egyedi kategóriát. - Az alapértelmezés visszaállítása törli az egyedi kategóriákat és visszaállítja a sorrendet a telepítés utáni alapértelmezett állapotba. Rendelkezésre áll Egyedi kategória hozzáadása Csak éjszaka jelenjék meg diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index e059b85606..96d9654c17 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -3448,7 +3448,6 @@ Rappresenta l\'area: %1$s x %2$s Sistema categorie Puoi aggiungere categorie personalizzate, nascondere quelle che non trovi necessarie e cambiarne l\'ordine nell\'elenco. La lista può essere importata ed esportata con i profili. Puoi aggiugere una nuova categoria personalizzata selezionandone una o alcune altre. - Resettando ai valori predefiniti cancellerà le categorie personalizzate e reimposterà l\'ordine allo stato predefinito dopo l\'installazione. Disponibile Aggiungi categoria personalizzata Mostra solo di notte diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index 7e1561f8d6..6026310293 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -3479,7 +3479,6 @@ POIの更新は利用できません カテゴリーの並べ替え カスタムカテゴリーを含め、不要なカテゴリーを非表示にしたりリストの順序を変更できます。リストはプロファイルと同様インポート&エクスポートができます。 一つあるいは複数のカテゴリーを選択して、新しいカスタムカテゴリーを追加できます。 - デフォルトにリセットするとカテゴリーが削除またはカスタムされ、並び順がインストール直後の初期状態に戻ります。 利用可 カスタムカテゴリーを追加 夜にのみ表示 diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index adddad6a79..1d50859dff 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -3464,7 +3464,6 @@ Reprezentuje obszar: %1$s x %2$s Zmień układ kategorii Możesz dodać niestandardowe kategorie, ukryć kategorie, które uważasz za niepotrzebne i zmienić kolejność sortowania listy. Listę można importować i eksportować wraz z profilami. Możesz dodać nową niestandardową kategorię wybierając jedną lub kilka potrzebnych kategorii. - Przywrócenie ustawień domyślnych usunie niestandardowe kategorie i zresetuje kolejność sortowania do domyślnego stanu po instalacji. Dostępne Dodaj niestandardową kategorię Wyświetlaj tylko w nocy diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml index adf71c3464..635df44728 100644 --- a/OsmAnd/res/values-pt-rBR/strings.xml +++ b/OsmAnd/res/values-pt-rBR/strings.xml @@ -3473,7 +3473,6 @@ Pôr do Sol: %2$s Reorganizar categorias Você pode adicionar categorias personalizadas, ocultar categorias que não considera necessárias e alterar a ordem de classificação da lista. A lista pode ser importada e exportada com perfis. Você pode adicionar uma nova categoria personalizada selecionando uma ou algumas categorias necessárias. - Redefinir para padrão excluirá ou categorias personalizadas e redefinirá a ordem de classificação para o estado padrão após a instalação. Disponível Adicionar categoria personalizada Mostrar apenas à noite diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index b545eda10e..068e56cedd 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -3472,7 +3472,6 @@ Pro praghere iscrie su còdighe intreu Torra a ordinare sas categorias Podes importare categorias personalizadas, cuare categorias chi non pensas chi ti serbant e mudare s\'òrdine de sa lista. Sa lista podet èssere importada e esportada cun sos profilos. Podes annànghere una categoria personalizada noa ischertende·nde una o unas cantas pagas chi ti serbint. - Ripristinende sos valores predefinidos as a iscantzellare sas categorias personalizadas e a ripristinare s\'òrdine de sa lista torrende·lu a su valore predefinidu a pustis de s\'installatzione. Disponìbile Annanghe una categoria personalizada Ammustra a de note ebbia diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index ac0445d812..6c60c1a9a9 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -3441,7 +3441,6 @@ Kategorileri yeniden düzenle Özel kategoriler ekleyebilir, gerekli bulmadığınız kategorileri gizleyebilir ve listenin sıralama düzenini değiştirebilirsiniz. Liste, profillerle içe ve dışa aktarılabilir. Bir veya birkaç gerekli kategori seçerek yeni bir özel kategori ekleyebilirsiniz. - Varsayılana sıfırla, özel kategorileri silecek ve sıralama düzenini kurulumdan sonraki varsayılan duruma sıfırlayacaktır. Mevcut Özel kategori ekle Sadece geceleri göster diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index ae73320493..f05abeda89 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -3476,7 +3476,6 @@ Перевпорядкувати категорії Ви можете додати особливі приховані категорії, які вам не здаються потрібними, і змінити упорядкування списку. Список можна імпортувати та експортувати за допомогою профілів. Ви можете додати нову власну категорію, вибравши одну або кілька необхідних категорій. - Скидання до усталеного видалить користувацькі категорії, а після встановлення встановить упорядкування до усталеного стану. Доступні Додати власну категорію Показувати лише вночі diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 8bfb433f56..26fdb6d483 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -3476,7 +3476,6 @@ 重新排列分類 您可以新增自訂的分類,隱藏您不需要的分類並變更清單順序。清單可與設定檔一起匯入與匯出。 您可以透過選取一個或多個需要的分類來新增自訂的分類。 - 重設為預設值將會刪除自訂分類並重設排序回安裝後的預設狀態。 可用 新增自訂分類 僅在夜間顯示 diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 0719147898..020d67735b 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -256,6 +256,7 @@ 64dp 10dp 56dp + 1.25 236dp 68dp diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 61d4f7efb7..446212e7fd 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,13 +11,13 @@ Thx - Hardy --> + Reset to default will reset sort order to the default state after installation. Use system screen timeout Disabled by default, if OsmAnd running on foreground, the screen doesn’t time out.\n\nIf enabled OsmAnd will use system timeout settings. Accessibility mode disabled in your system. Rearrange categories You can add custom categories hide categories that you don’t find necessary and change the sort order of the list. The list can be imported and exported with profiles. You can add a new custom category by selecting one or a few needed categories. - Reset to default will delete or custom categories and reset sort order to the default state after installation. Available Add custom category Show only at night diff --git a/OsmAnd/res/xml/monitoring_settings.xml b/OsmAnd/res/xml/monitoring_settings.xml index 6a1e03358d..d331163df4 100644 --- a/OsmAnd/res/xml/monitoring_settings.xml +++ b/OsmAnd/res/xml/monitoring_settings.xml @@ -37,6 +37,7 @@ android:key="save_global_track_interval" android:layout="@layout/preference_with_descr" android:title="@string/save_global_track_interval" + android:persistent="false" tools:icon="@drawable/ic_action_time_span" tools:summary="3 seconds" /> diff --git a/OsmAnd/src/net/osmand/data/WptLocationPoint.java b/OsmAnd/src/net/osmand/data/WptLocationPoint.java index 6ab3bfecec..52c30d54b3 100644 --- a/OsmAnd/src/net/osmand/data/WptLocationPoint.java +++ b/OsmAnd/src/net/osmand/data/WptLocationPoint.java @@ -12,7 +12,6 @@ public class WptLocationPoint implements LocationPoint { this.pt = p; } - @Override public double getLatitude() { return pt.lat; @@ -36,4 +35,8 @@ public class WptLocationPoint implements LocationPoint { public PointDescription getPointDescription(Context ctx) { return new PointDescription(PointDescription.POINT_TYPE_WPT, pt.name); } + + public GPXUtilities.WptPt getPt() { + return pt; + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index ce3738ff49..a43c7f7ce9 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -671,7 +671,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo if (dir.canRead()) { StatFs fs = new StatFs(dir.getAbsolutePath()); size = AndroidUtils.formatSize(activity, ((long)fs.getAvailableBlocks()) * fs.getBlockSize()); - percent = 100 - fs.getAvailableBlocks() * 100 / fs.getBlockCount(); + percent = 100 - (int)((long)fs.getAvailableBlocks() * 100 / fs.getBlockCount()); } sizeProgress.setIndeterminate(false); sizeProgress.setProgress(percent); diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index d37361d853..7f51847964 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -13,6 +13,7 @@ import net.osmand.data.Amenity.AmenityRoutePoint; import net.osmand.data.FavouritePoint; import net.osmand.data.LocationPoint; import net.osmand.data.PointDescription; +import net.osmand.data.WptLocationPoint; import net.osmand.osm.PoiType; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmAndFormatter; @@ -774,7 +775,13 @@ public class WaypointHelper { } else if (type == FAVORITES ) { return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), false, (FavouritePoint) point); } else if (type == WAYPOINTS) { - return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), false, (GPXUtilities.WptPt) point); + if (point instanceof WptLocationPoint) { + return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), false, ((WptLocationPoint) point).getPt()); + } else if (point instanceof GPXUtilities.WptPt) { + return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor(), false, (GPXUtilities.WptPt) point); + } else { + return null; + } } else if (type == ALARMS) { //assign alarm list icons manually for now String typeString = ((AlarmInfo) point).getType().toString(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index a99c2635b0..409eb695ea 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -39,7 +39,8 @@ import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; -public class MonitoringSettingsFragment extends BaseSettingsFragment implements CopyAppModePrefsListener, ResetAppModePrefsListener { +public class MonitoringSettingsFragment extends BaseSettingsFragment + implements CopyAppModePrefsListener, ResetAppModePrefsListener { private static final String COPY_PLUGIN_SETTINGS = "copy_plugin_settings"; private static final String RESET_TO_DEFAULT = "reset_to_default"; @@ -90,6 +91,12 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements ListPreferenceEx saveTrackInterval = (ListPreferenceEx) findPreference(settings.SAVE_GLOBAL_TRACK_INTERVAL.getId()); saveTrackInterval.setEntries(entry.values().toArray(new String[0])); saveTrackInterval.setEntryValues(entry.keySet().toArray()); + ApplicationMode selectedAppMode = getSelectedAppMode(); + if (!settings.SAVE_GLOBAL_TRACK_REMEMBER.getModeValue(selectedAppMode)) { + saveTrackInterval.setValue(settings.SAVE_GLOBAL_TRACK_REMEMBER.getModeValue(selectedAppMode)); + } else { + saveTrackInterval.setValue(settings.SAVE_GLOBAL_TRACK_INTERVAL.getModeValue(selectedAppMode)); + } saveTrackInterval.setIcon(getActiveIcon(R.drawable.ic_action_time_span)); saveTrackInterval.setDescription(R.string.save_global_track_interval_descr); } @@ -333,4 +340,16 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements updateAllSettings(); } } + + @Override + public void onSettingApplied(String prefId, boolean appliedToAllProfiles) { + if (settings.SAVE_GLOBAL_TRACK_INTERVAL.getId().equals(prefId)) { + if (appliedToAllProfiles) { + app.getSettings().setPreferenceForAllModes(settings.SAVE_GLOBAL_TRACK_REMEMBER.getId(), true); + } else { + app.getSettings().setPreference(settings.SAVE_GLOBAL_TRACK_REMEMBER.getId(), true, getSelectedAppMode()); + } + + } + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java index 5b7ad8dc85..facbc5a6ed 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java @@ -800,7 +800,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable String anotherFilterByName = another.filterByName == null ? "" : another.filterByName; return thisFilterByName.compareToIgnoreCase(anotherFilterByName); } else { - return this.name.compareTo(another.name); + return this.name.compareToIgnoreCase(another.name); } } diff --git a/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java b/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java index 01500d3007..5bb86da388 100644 --- a/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java +++ b/OsmAnd/src/net/osmand/plus/poi/RearrangePoiFiltersFragment.java @@ -212,7 +212,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment { String filterByName2 = o2.filterByName == null ? "" : o2.filterByName; return filterByName1.compareToIgnoreCase(filterByName2); } else { - return o1.name.compareTo(o2.name); + return o1.name.compareToIgnoreCase(o2.name); } } }); @@ -641,7 +641,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment { private TextView title; private TextView description; private ImageView icon; - private ImageButton actionIcon; + private ImageView actionIcon; private ImageView moveIcon; private View itemsContainer; diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java index 66de62f708..d53bb0cd81 100644 --- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java @@ -545,6 +545,9 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl updateAllSettings(); } + public void onSettingApplied(String prefId, boolean appliedToAllProfiles) { + } + public void updateAllSettings() { PreferenceScreen screen = getPreferenceScreen(); if (screen != null) { diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java index ea0e0e914c..f4851ab5a6 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/ChangeGeneralProfilesPrefBottomSheet.java @@ -55,7 +55,7 @@ public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSh @Override public void onClick(View v) { app.getSettings().setPreferenceForAllModes(prefId, newValue); - updateTargetSettings(false); + updateTargetSettings(false, true); dismiss(); } }) @@ -72,7 +72,7 @@ public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSh @Override public void onClick(View v) { app.getSettings().setPreference(prefId, newValue, getAppMode()); - updateTargetSettings(false); + updateTargetSettings(false, false); dismiss(); } }) @@ -86,7 +86,7 @@ public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSh .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - updateTargetSettings(true); + updateTargetSettings(true, false); dismiss(); } }) @@ -105,9 +105,12 @@ public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSh outState.putSerializable(NEW_VALUE_KEY, newValue); } - private void updateTargetSettings(boolean discard) { + private void updateTargetSettings(boolean discard, boolean appliedToAllProfiles) { BaseSettingsFragment target = (BaseSettingsFragment) getTargetFragment(); if (target != null) { + if (!discard) { + target.onSettingApplied(getPrefId(), appliedToAllProfiles); + } target.updateSetting(getPrefId()); if (!discard) { if (target.shouldDismissOnChange()) { diff --git a/OsmAnd/src/net/osmand/plus/views/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/RouteLayer.java index 2c0b5727d2..6475fa6d78 100644 --- a/OsmAnd/src/net/osmand/plus/views/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/RouteLayer.java @@ -233,24 +233,26 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont private void drawXAxisPoints(Canvas canvas, RotatedTileBox tileBox) { QuadRect latLonBounds = tileBox.getLatLonBounds(); List xAxisPoints = trackChartPoints.getXAxisPoints(); - float r = 3 * tileBox.getDensity(); - float density = (float) Math.ceil(tileBox.getDensity()); - float outerRadius = r + 2 * density; - float innerRadius = r + density; - QuadRect prevPointRect = null; - for (int i = 0; i < xAxisPoints.size(); i++) { - LatLon axisPoint = xAxisPoints.get(i); - if (axisPoint.getLatitude() >= latLonBounds.bottom - && axisPoint.getLatitude() <= latLonBounds.top - && axisPoint.getLongitude() >= latLonBounds.left - && axisPoint.getLongitude() <= latLonBounds.right) { - float x = tileBox.getPixXFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude()); - float y = tileBox.getPixYFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude()); - QuadRect pointRect = new QuadRect(x - outerRadius, y - outerRadius, x + outerRadius, y + outerRadius); - if (prevPointRect == null || !QuadRect.intersects(prevPointRect, pointRect)) { - canvas.drawCircle(x, y, outerRadius, paintGridOuterCircle); - canvas.drawCircle(x, y, innerRadius, paintGridCircle); - prevPointRect = pointRect; + if (xAxisPoints != null) { + float r = 3 * tileBox.getDensity(); + float density = (float) Math.ceil(tileBox.getDensity()); + float outerRadius = r + 2 * density; + float innerRadius = r + density; + QuadRect prevPointRect = null; + for (int i = 0; i < xAxisPoints.size(); i++) { + LatLon axisPoint = xAxisPoints.get(i); + if (axisPoint.getLatitude() >= latLonBounds.bottom + && axisPoint.getLatitude() <= latLonBounds.top + && axisPoint.getLongitude() >= latLonBounds.left + && axisPoint.getLongitude() <= latLonBounds.right) { + float x = tileBox.getPixXFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude()); + float y = tileBox.getPixYFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude()); + QuadRect pointRect = new QuadRect(x - outerRadius, y - outerRadius, x + outerRadius, y + outerRadius); + if (prevPointRect == null || !QuadRect.intersects(prevPointRect, pointRect)) { + canvas.drawCircle(x, y, outerRadius, paintGridOuterCircle); + canvas.drawCircle(x, y, innerRadius, paintGridCircle); + prevPointRect = pointRect; + } } } }