diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index c6a5f1d393..7a9cfb1ab4 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -1117,8 +1117,8 @@ public class RouteResultPreparation { if (UNMATCHED_HIGHWAY_TYPE.equals(rr.getObject().getHighway())) { bearingDist = RouteSegmentResult.DIST_BEARING_DETECT_UNMATCHED; } - double mpi = MapUtils.degreesDiff(prev.getBearingEnd(prev.getEndPointIndex(), bearingDist), - rr.getBearingBegin(rr.getStartPointIndex(), bearingDist)); + double mpi = MapUtils.degreesDiff(prev.getBearingEnd(prev.getEndPointIndex(), Math.min(prev.getDistance(), bearingDist)), + rr.getBearingBegin(rr.getStartPointIndex(), Math.min(rr.getDistance(), bearingDist))); if (mpi >= TURN_DEGREE_MIN) { if (mpi < TURN_DEGREE_MIN) { // Slight turn detection here causes many false positives where drivers would expect a "normal" TL. Best use limit-angle=TURN_DEGREE_MIN, this reduces TSL to the turn-lanes cases. diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java index c57fdc8f1c..1699b3daf9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java @@ -457,7 +457,7 @@ public class RouteSegmentResult implements StringExternalizable } public float getBearingBegin() { - return getBearingBegin(startPointIndex, DIST_BEARING_DETECT); + return getBearingBegin(startPointIndex, distance > 0 && distance < DIST_BEARING_DETECT ? distance : DIST_BEARING_DETECT); } public float getBearingBegin(int point, float dist) { @@ -465,7 +465,7 @@ public class RouteSegmentResult implements StringExternalizable } public float getBearingEnd() { - return getBearingEnd(endPointIndex, DIST_BEARING_DETECT); + return getBearingEnd(endPointIndex, distance > 0 && distance < DIST_BEARING_DETECT ? distance : DIST_BEARING_DETECT); } public float getBearingEnd(int point, float dist) { diff --git a/OsmAnd-telegram/res/values-el/strings.xml b/OsmAnd-telegram/res/values-el/strings.xml index ff81d49e6c..819b9d3d48 100644 --- a/OsmAnd-telegram/res/values-el/strings.xml +++ b/OsmAnd-telegram/res/values-el/strings.xml @@ -39,7 +39,7 @@ Κοινοποίηση Προηγούμενο Συνέχεια - Ακύρωση + Άκυρο Επιλογές Ενεργοποιημένο Μονάδες μέτρησης & φορμά diff --git a/OsmAnd-telegram/res/values-fr/strings.xml b/OsmAnd-telegram/res/values-fr/strings.xml index 4b9d45edfb..bff9d36680 100644 --- a/OsmAnd-telegram/res/values-fr/strings.xml +++ b/OsmAnd-telegram/res/values-fr/strings.xml @@ -213,7 +213,7 @@ Par groupe Par distance Se déconnecter d\'OsmAnd Tracker \? - Êtes-vous sûr·e de vouloir vous déconnecter d\'OsmAnd Tracker ; vous ne pourrez pas partager votre position ni vous la position des autres \? + Êtes-vous certain de vouloir vous déconnecter d\'OsmAnd Tracker \? Vous ne pourrez pas partager votre position ni voir la position des autres. Contacts et groupes partageant leur position avec vous. Partager la position comme Ajouter un périphérique diff --git a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml index e7b84c5305..1eb3dd1bd4 100644 --- a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml +++ b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml @@ -20,9 +20,9 @@ android:layout_marginRight="@dimen/content_padding_half" android:layout_weight="1" android:gravity="center_vertical" - app:cardBackgroundColor="?attr/switch_button_active" app:cardCornerRadius="4dp" - app:cardElevation="0dp"> + app:cardElevation="0dp" + tools:cardBackgroundColor="?attr/switch_button_active"> diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index 73b9f244c5..1f5c371c25 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1873,7 +1873,6 @@ Συνολική απόσταση Επιλέξτε διακύμανση ανύψωσης Χρήση υψομετρικών δεδομένων - Εμφάνιση ισοβαθών καμπυλών και σημείων. Ναυτικές ισοβαθείς καμπύλες Αυτόματος διαχωρισμός καταγραφών μετά από κενό @@ -2516,7 +2515,7 @@ Υποβολή ΣΕ Βασικό Προχωρημένο - Αριθμός κτιρίου + Αριθμός κτηρίου Επόμενο Άνοιγμα στις Κλείσιμο στις diff --git a/OsmAnd/res/values-fa/phrases.xml b/OsmAnd/res/values-fa/phrases.xml index f02c2aa1db..00c6ee88d6 100644 --- a/OsmAnd/res/values-fa/phrases.xml +++ b/OsmAnd/res/values-fa/phrases.xml @@ -1449,4 +1449,7 @@ منطقهٔ حفاظت‌شده بدمینتون خدمات خودرو; مکانیکی + نوع + فلکهٔ کوچک + میدان \ No newline at end of file diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index ec8b6a2227..08eb6883a4 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -3886,4 +3886,10 @@ Statut de la piste : ouvert Nom de la piste Saut à ski + Livre d\'or au sommet : non + Livre d\'or au sommet : oui + Surveillé : non + Surveillé : oui + Référence locale + Géodésien \ No newline at end of file diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 2542de9309..18cf09a780 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4033,4 +4033,6 @@ %1$s contient plus d\'un segment, vous devez sélectionner le tronçon nécessaire à la navigation. Sélectionnez le mode de conduite pour avoir l\'itinéraire le plus court, le plus rapide, ou le plus sûr Appuyer pour afficher ou cacher le widget Coordonnées sur la carte. + L’icône de localisation va se déplacer sur le trajet en cours. + Veuillez sélectionner un autre type de colorisation. \ No newline at end of file diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index ace0b01cd1..206586cfd1 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -2084,7 +2084,6 @@ POIの更新は利用できません 時間 総走行距離 標高データを使用 - 水域 水域ポリゴン 近隣のWikipedia記事 @@ -2133,14 +2132,14 @@ POIの更新は利用できません 画面中央に写真メモを追加するボタンです。 画面中央にOSMメモを追加するボタンです。 画面中央にPOIを追加できるボタンです。 - ナビゲーション中の案内音声の有効無効を切り替えることが出来ます。 + ナビゲーション中の案内音声の有効/無効を切り替えます。 画面中央に駐車場所を追加するボタンです。 実行時に入力画面を表示 場所 重複を避けるためにクイックアクション名は[%1$s]に変更されました。 クイックアクション名の重複 - マップ画面でのお気に入り地点の表示/非表示の切替が出来ます。 - マップ画面でのPOIの表示/非表示の切替が出来ます。 + マップ画面でのお気に入り地点の表示/非表示を切り替えます。 + マップ画面でのPOIの表示/非表示を切り替えます。 %1$sを表示 %1$sを非表示 カテゴリーを追加 @@ -2546,7 +2545,7 @@ POIの更新は利用できません 種類別 小数点以下の桁数 次の入力項目へ移動 - マップ画面のタップで操作ボタンやウィジェットの表示と交互に切り替えます。 + マップ画面のタップで操作ボタンやウィジェットの表示を切り替えます。 フルスクリーンモード オンライン追跡用のバッファ指定 送信用現在地データをネット接続せずにどのくらいの時間記録するか、バッファを指定します @@ -2829,7 +2828,7 @@ POIの更新は利用できません 編集 %1$s, 合計 %2$s mBTC 起動 グアラニー語 - OsmAndマップ表示の昼/夜モードを切り替えることが出来ます。 + OsmAndマップ表示の昼/夜モードを切り替えます。 昼モード 夜モード 昼/夜モードの切り替え @@ -3715,7 +3714,7 @@ POIの更新は利用できません 低い橋を避けるために船の高さを調整できます。橋が可動式の場合は、開いた状態の高さが参照されます。 低い橋を避けるために船の高さを設定します。注:橋が可動式の場合は、開いた状態の高さが参照されます。 狭い橋を避けるために船の幅を設定します - マップ上のMapillaryレイヤーの表示/非表示を切り替えるトグルボタンです。 + マップ上のMapillaryレイヤーの表示/非表示を切り替えます。 ルート検索時に指定した車両の長さを考慮します。 長さ制限 ベアリング @@ -3849,4 +3848,106 @@ POIの更新は利用できません \nグラフは再計算後に利用できるようになります。 OSM通知/ POI / GPXのアップロードをテストする場合、openstreetmap.orgではなくdev.openstreetmap.orgを使用するよう切り替えます。 dev.openstreetmap.orgを使用 + 次々回案内(中距離) + 次回案内(長距離) + + 通過する + 目標に接近 + 方向転換 + ルートからの逸脱 + 目的地に到着 + タイミングと距離の間隔 + 案内タイミング + 音声による案内タイミングは、音声形式、現在のナビゲーション速度、および標準のナビゲーション速度によって異なります。 + 記録の開始 + マップ上に経路を表示 + 車椅子 + ハイキング + 徒歩 + 電動自転車 + 山岳(MTB)サイクリング + ロードサイクリング + 一般的なサイクリング + 重量物運搬車 + 小型トラック + トラック + スクーター + レーシングバイク + マウンテンバイク + サーバーエラー: %1$s + この名前はすでに存在します + このオンラインルーティングエンジンを削除しますか? + 全文を読む + 説明の編集 + 経由地点を削除 + マップマーカーにコピー + お気に入りにコピー + アップロード中 + アップロードが完了しました + %2$d個中%1$d個をアップロード中 + セグメントの選択 + %1$sには複数のセグメントが含まれているため、ナビゲーションに必要な部分を選択する必要があります。 + %1$dセグメント + %2$d個中%1$d個をアップロードしました + アップロードする編集を選択 + 陰影起伏図 / 勾配 / 等高線 + OpenPlaceReviewsは、レストラン、ホテル、美術館、中途経由地点などの公共の場所に関するコミュニティが運営するプロジェクトです。写真、レビュー、他のシステムへのリンク、OpenStreetMap、Wikipediaへのリンクなど、それらに関するすべての公開情報を収集しています。 +\n +\nOpenPlaceReviewデータは全て公開されており、誰でもアクセス可能です。http://openplacereviews.org/data +\n +\n詳細については下記サイトをご覧ください。http://openplacereviews.org + OpenPlaceReviews + test.openplacereviews.orgを使用 + OpenPlaceReviewsにログイン + + + スノーモービル + 乗馬 + レーシング + マウンテンバイク + 自転車 + ハイキング + ランニング + 徒歩 + 未舗装道路 + オートバイ + 最適化されたなるべく短いルート (省エネ) + + マップ上で現在有効になっている道路の制限を使用します + 運転の目的を選択することで、より短くより速くより安全なルートを取得します + 現在地アイコンが現在のナビゲーションルートに保持されます + 速度がしきい値未満の場合は、マップビューを回転させないでください + 再起動 + すべての地域 + %1$d個のファイルを削除しますか? + 保存せずに終了 + 記録を停止してもよろしいですか? +\n保存しない場合データはすべて失われます。 + 記録を保存して終了 + 記録を停止しました + 一時停止中 + 一部の設定を適用するには、アプリケーションの再起動が必要です。 + ルート検索時になるべく急な上り坂を回避するようにします。 + マップ上で座標ウィジェットの表示/非表示を切り替えます。 + タップで距離 + 利用可能な最新OpenStreetMapの更新: + 更新: %s + 最後にチェック時間: %s + 更新間隔 + マップの更新は毎週チェックされます。次回は%2$sの%1$sです。 + マップの更新は毎日チェックされます。次回は%2$sの%1$sです。 + マップの更新は1時間ごとにチェックされます。次回は%2$sの%1$sです。 + 更新の削除 + %sのライブアップデートをすべて削除してもよろしいですか? + 購入 + カテゴリを選択するか、新しいカテゴリを追加します + 記録を継続します。 + POI名をコピー + 表示/非表示 + 間隔 + 自然保護区、保護地域、国立公園の境界を非表示にします + 自然保護区の境界 + 経路には標高データは含まれていません。 + 経路には速度データは含まれていません。 + 別タイプのカラーを選択してください。 \ No newline at end of file diff --git a/OsmAnd/res/values-nb/phrases.xml b/OsmAnd/res/values-nb/phrases.xml index 2d3d19f765..1e62078b4b 100644 --- a/OsmAnd/res/values-nb/phrases.xml +++ b/OsmAnd/res/values-nb/phrases.xml @@ -1626,7 +1626,7 @@ Sivilisasjon: Det gamle Egypt (inntil 332 f.Kr.) Sivilisasjon: Det kinesiske keiserriket (221 f.Kr. – 1911 e.Kr.) Historisk stein - Historisk periode: neolittisk tid + Historisk periode: neolittisk tid (yngre steinalder) Historisk periode: mesolittisk tid Historisk periode: paleolittisk tid (2,6 millioner – 10000 år før nåtid) Historisk periode: Det ptolemeiske Egypt (305 f.Kr. – 30 f.Kr.) @@ -1647,4 +1647,42 @@ Sivilisasjon: forhistorisk tid Historisk herregård Historisk objekt + Materiale: kalkstein + Materiale: granittstein + Materiale: sandstein + Materiale: stein + Husly + T-bane + Ferge + Buss + Overflate: snø + Overflate: salt + Overflate: is + Overflate: gjørme + Overflate: jord + Overflate: jord + Overflate: gress + Overflate: sand + Overflate: komprimert + Overflate: fin grus + Overflate: grus + Overflate: tre + Overflate: metall + Overflate: stein + Overflate: rullestein (liten) + Overflate: belegningsstein + Overflate: kuppelstein + Overflate: brostein + Overflate: betong + Overflate: asfalt + Overflate: fast dekke + Overflate: uten fast dekke + Gapahuk + Stein + Sandstein + Kalkstein + Stein + Passasje i en mur eller et gjerde + Ly + Grensestein \ No newline at end of file diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 8eefe0476c..38107b6cc1 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -167,7 +167,7 @@ Fluorescerende overlegg Bruk fluorescerende farger til å vise spor og ruter. Frakoblet redigering - Bruk alltid frakoblet redigering. + Hvis redigering uten nett er aktivert, lagres endringer lokalt først og lastes opp på forespørsel, ellers vil endringer bli lastet opp umiddelbart. Du kan laste ned eller oppdatere %1$s kart. Gratisversjon Vis interessepunkt-beskrivelse. @@ -401,7 +401,7 @@ Offline-søk Nettbasert søk Maks. nettbasert zoom - Ikke bla gjennom nettbaserte kartfliser for zoomnivåer utover dette. + Ikke bla gjennom nettbaserte kart for zoomnivåer utover dette. Total distanse %1$s, reisetid %2$d t %3$d min. Nettbasert eller frakoblet navigeringstjeneste. Navigeringstjeneste @@ -1492,7 +1492,7 @@ Vent til gjeldende oppgave er ferdig Slett dette elementet\? Slett parkeringsplassmarkør - Slett endring + Slett redigering Gjenåpne Liker du OsmAnd\? Bygningsnummer @@ -1520,7 +1520,7 @@ Kannada Buss Tog - Valgte taledata er ikke tilgjengelig + Valgte talemeldingspakke er ikke tilgjengelig Spesifisert taledata er ødelagt Taledataversjon som ikke støttes Sporer posisjonen din mens skjermen er slått av. @@ -2173,7 +2173,7 @@ Angi ditt OSM-brukernavn og passord for å laste opp GPX-filer. Doner for å se nye funksjoner implementert i programmet. Last opp alle - Last opp endring til OSM + Last opp redigering til OSM Asynkron OSM-redigering: Oppgi det nettbaserte sporingsintervallet. Nettbasert sporingsintervall @@ -2239,7 +2239,7 @@ Legg til parkeringsplass Rediger handling Slett handling - Navneforvalg + Forhåndsinnstilt navn En knapp for å legge til en kartmarkør i skjermsenteret. En knapp for å legge til et GPX-rutepunkt i midten av skjermen. En knapp for å legge til et lydnotat i midten av skjermen. @@ -2829,7 +2829,7 @@ Veitype Overflate Jevnhet - Stigning + Bratthet Legg til bosted Legg til arbeidssted Arbeid @@ -2865,9 +2865,9 @@ Fast dekke Betong Brostein - Naturlig brostein - Steinbelagt - Rullestein + Kuppelstein + Belegningsstein + Rullestein (liten) Stein Metall Tre @@ -2907,8 +2907,8 @@ Milliradianer Vinkel-måleenheter Endre hva asimut måles i. - Ingen rustikk brostein eller brostein - Unngår rustikk brostein og brostein + Ingen kuppelstein eller brostein + Unngår kuppelstein og brostein Ingen trikk Unngår trikk Ingen buss @@ -3145,7 +3145,8 @@ Annet Delt OSM-redigeringer - Rute: Distanse %1$s, rutingstid %2$s \nUtregning: %3$.1f sec, %4$d veier, %5$d flis) + Rute: Distanse %1$s, rutetid %2$s +\nBeregning: %3$.1f sek., %4$d veier, %5$d fliser) Koter og relieffskygge Oppdater alle kart Er du sikker på at du vil oppdatere alle (%1$d) kart\? diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 93ec4454c6..e8767cf4cf 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3748,7 +3748,7 @@ \n \n Wat is er nieuw - Voor sneeuwscooter, rijden met speciale wegen en tracks. + Voor sneeuwscooter, rijden op speciale wegen en tracks. Stel werkdagen in om door te gaan Selecteer het interval waarmee markeringen met afstand of tijd op de track worden weergegeven. Selecteer de gewenste splitsingsoptie: op tijd of op afstand. diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 17f9218ad8..1b8e013301 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4037,9 +4037,9 @@ Копировать имя POI Интервал Скрыть природный заповедник, особо охраняемые природные территории и границы национального парка - «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки из него будут доступны через public GPS API c временными отметками. Другие пользователи смогут лишь загружать обработанные точки из вашего трека. При этом трек не будет ассоциирован с вами. - «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API. - «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. + «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки c отметками времени из него будут доступны через public GPS API (при этом трек не будет ассоциирован с вами). Другие пользователи смогут лишь загружать обработанные точки из вашего трека. + «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступном на странице GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API будут ссылаться на страницу с вашим оригинальным треком. + «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступном на странице GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. «Частный» означает, что трек не будет виден в любых общедоступных списках, но точки из него будут доступны через public GPS API без отметок времени. Выберите цель, чтобы проложить к ней короткий, быстрый или безопасный маршрут Удалить %1$d файлов\? diff --git a/OsmAnd/res/values-sv/phrases.xml b/OsmAnd/res/values-sv/phrases.xml index e3ed4a4936..8546a555f5 100644 --- a/OsmAnd/res/values-sv/phrases.xml +++ b/OsmAnd/res/values-sv/phrases.xml @@ -3253,4 +3253,80 @@ Klättring Svårighetskategori Parkera och åk + Uttag: Tesla Roadster: utgående + Uttag: Tesla Roadster: ström + Uttag: Tesla Roadster + Uttag: Tesla Supercharger + Uttag: Tesla Supercharger: utgående + Uttag: Tesla Supercharger: ström + Uttag: Tesla standard: utgående + Uttag: Tesla standard: ström + Uttag: Tesla standard + Uttag: CHAdeMO: utgående + Uttag: CHAdeMO: ström + Uttag: CHAdeMO + Uttag: Typ 3: utgeånde + Uttag: Typ 3: ström + Uttag: Typ 3 + Uttag: Typ 2: utgeånde + Uttag: Typ 2 kombo: ström + Uttag: Typ 2 kombo + Uttag: Typ 2: utgående + Uttag: Typ 2: ström + Uttag: Typ 2 + Uttag: Typ 1 kombo: ström + Uttag: Typ 1 kombo + Uttag: Typ 1: utgående + Uttag: Typ 1: ström + Uttag: Typ 1 + Uttag: Typ 1 kombo: utgående + Uttag: CEE röd 125A: utgående + Uttag: CEE röd 125A: ström + Uttag: CEE röd 125A + Uttag: CEE röd 64A: utgående + Uttag: CEE röd 64A: ström + Uttag: CEE röd 64A + Uttag: CEE röd 32A: utgående + Uttag: CEE röd 32A: ström + Uttag: CEE röd 32A + Uttag: CEE röd 16A: utgående + Uttag: CEE röd 16A: ström + Uttag: CEE röd 16A + Uttag: CEE blå: utgående + Uttag: CEE blå: ström + Uttag: CEE blå + Multi familj + Familj + Gemenskap + Flaskvatten + Vattentank + Vattentransporter + Borrhål + Pump + Rinnande vatten + Rörledning + Vattenbrunn + Aquatabs + Omvänd osmos + Klor + Ingen + Hållbarhet på vattenplats: kritiskt + Hållbarhet på vattenplats: hållbar + Behöver underhåll + Trasig + Begränsad + Stängd + Öppen + Plats: area + Plats: väg + Plats: hus + Plats: entre + Plats: vägg + Plats: bro + Plats: kiosk + Plats: plattform + Plats: inne + Plats: ute + Plats: tak + Plats: tak \ No newline at end of file diff --git a/OsmAnd/res/values-zh-rCN/phrases.xml b/OsmAnd/res/values-zh-rCN/phrases.xml index 07cbf034cb..9c7d6634aa 100644 --- a/OsmAnd/res/values-zh-rCN/phrases.xml +++ b/OsmAnd/res/values-zh-rCN/phrases.xml @@ -769,4 +769,6 @@ 充电站 无外卖 仅限外卖 + 配药 + 自动化 \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 79fa32d1c3..dae06fed05 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -418,5 +418,4 @@ 3sp 80dp - 160dp \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java index 5fdf2eab46..ced666e32b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java @@ -139,7 +139,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat if (settingsScreenType != null) { Bundle args = new Bundle(); args.putBoolean(PLUGIN_INFO, true); - BaseSettingsFragment.showInstance(activity, settingsScreenType, null, args); + BaseSettingsFragment.showInstance(activity, settingsScreenType, null, args, null); } } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 4fcbcd1b0e..eb444370d5 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -9,25 +9,27 @@ import android.text.SpannableStringBuilder; import android.view.LayoutInflater; import android.view.View; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.preference.Preference; -import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.OsmAndAppCustomization; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.CommonPreference; -import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet; import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet.CopyAppModePrefsListener; -import net.osmand.plus.settings.fragments.BaseSettingsFragment; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.settings.backend.OsmAndAppCustomization; +import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet; import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet.ResetAppModePrefsListener; import net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet; +import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.preferences.ListPreferenceEx; import net.osmand.plus.settings.preferences.SwitchPreferenceEx; import net.osmand.plus.widgets.style.CustomTypefaceSpan; @@ -36,11 +38,11 @@ import java.util.HashMap; import java.util.LinkedHashMap; import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO; -import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; -import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; 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; +import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; +import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; public class MonitoringSettingsFragment extends BaseSettingsFragment implements CopyAppModePrefsListener, ResetAppModePrefsListener { @@ -293,6 +295,18 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment resetToDefault.setIcon(getActiveIcon(R.drawable.ic_action_reset_to_default_dark)); } + @Override + public void onDestroy() { + FragmentActivity activity = getActivity(); + if (activity != null && !activity.isChangingConfigurations()) { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingStartingBottomFragment) { + ((TripRecordingStartingBottomFragment) target).show(); + } + } + super.onDestroy(); + } + @Override public boolean onPreferenceClick(Preference preference) { String prefId = preference.getKey(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 9ea7cd1aef..25284d1d5d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -25,6 +25,7 @@ import com.google.android.material.slider.Slider; import net.osmand.AndroidUtils; import net.osmand.Location; +import net.osmand.PlatformUtil; import net.osmand.ValueHolder; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.NavigationService; @@ -48,6 +49,8 @@ import net.osmand.plus.views.layers.MapInfoLayer; import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget; import net.osmand.util.Algorithms; +import org.apache.commons.logging.Log; + import java.io.File; import java.lang.ref.WeakReference; import java.util.Collections; @@ -57,6 +60,7 @@ import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; public class OsmandMonitoringPlugin extends OsmandPlugin { + private static final Log LOG = PlatformUtil.getLog(OsmandMonitoringPlugin.class); public static final String ID = "osmand.monitoring"; public final static String OSMAND_SAVE_SERVICE_ACTION = "OSMAND_SAVE_SERVICE_ACTION"; public static final int REQUEST_LOCATION_PERMISSION_FOR_GPX_RECORDING = 208; @@ -471,12 +475,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { try { SavingTrackHelper helper = app.getSavingTrackHelper(); SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir()); - if (stopRecording) { - helper.close(); - } + helper.close(); return result; } catch (Exception e) { - e.printStackTrace(); + LOG.error(e.getMessage(), e); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index 0ed254bf83..eae0e5e919 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -26,6 +26,7 @@ import androidx.cardview.widget.CardView; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; @@ -41,6 +42,7 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.AndroidUiHelper; @@ -75,12 +77,14 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i public static final String TAG = TripRecordingBottomFragment.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomFragment.class); - private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file"; public static final String UPDATE_TRACK_ICON = "update_track_icon"; private static final int GPS_UPDATE_INTERVAL = 1000; + private static final String[] INIT_BLOCKS_KEYS = + new String[]{INIT_BLOCKS_GENERAL, INIT_BLOCKS_ALTITUDE, INIT_BLOCKS_SPEED}; private OsmandApplication app; private OsmandSettings settings; + private SavingTrackHelper helper; private OsmandMonitoringPlugin plugin; private View statusContainer; @@ -105,7 +109,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i } private boolean hasDataToSave() { - return app.getSavingTrackHelper().hasDataToSave(); + return helper.hasDataToSave(); } private boolean searchingGPS() { @@ -128,17 +132,12 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i public void createMenuItems(Bundle savedInstanceState) { app = requiredMyApplication(); settings = app.getSettings(); + helper = app.getSavingTrackHelper(); plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); + selectedGpxFile = helper.getCurrentTrack(); LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode); final FragmentManager fragmentManager = getFragmentManager(); - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE) - && savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) { - selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - } - } - View itemView = inflater.inflate(R.layout.trip_recording_fragment, null, false); items.add(new BaseBottomSheetItem.Builder() .setCustomView(itemView) @@ -149,8 +148,8 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); - createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, - ItemType.SHOW_TRACK.getTitleId(), TripRecordingBottomFragment.this, new Runnable() { + createShowTrackItem(showTrackContainer, trackAppearanceIcon, ItemType.SHOW_TRACK.getTitleId(), + TripRecordingBottomFragment.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -200,7 +199,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i @Override public void onClick(View v) { MapActivity mapActivity = getMapActivity(); - if (mapActivity != null && plugin != null && app.getSavingTrackHelper().hasDataToSave()) { + if (mapActivity != null && plugin != null && hasDataToSave()) { plugin.saveCurrentTrack(null, mapActivity); app.getNotificationHelper().refreshNotifications(); dismiss(); @@ -214,16 +213,11 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i @Override public void onClick(View v) { if (fragmentManager != null) { - TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this, selectedGpxFile); + TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this); } } }); - } - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); } @Override @@ -231,6 +225,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i super.onResume(); blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); runUpdatingGPS(); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints); + } } @Override @@ -238,6 +236,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i super.onPause(); blockStatisticsBuilder.stopUpdatingStatBlocks(); stopUpdatingGPS(); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null); + } } public void show() { @@ -303,16 +305,15 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i AndroidUiHelper.setVisibility(View.GONE, segmentView.findViewById(R.id.list_item_divider)); WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs); - final String[] initBlocksKeys = new String[]{INIT_BLOCKS_GENERAL, INIT_BLOCKS_ALTITUDE, INIT_BLOCKS_SPEED}; tabLayout.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() { @Override public void onTabSelected(int position) { - recreateStatBlocks(initBlocksKeys[position]); + recreateStatBlocks(INIT_BLOCKS_KEYS[position]); } @Override public void onTabReselected(int position) { - recreateStatBlocks(initBlocksKeys[position]); + recreateStatBlocks(INIT_BLOCKS_KEYS[position]); } }); @@ -357,10 +358,15 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i } } - public static void createShowTrackItem(final OsmandApplication app, final MapActivity mapActivity, - final boolean nightMode, LinearLayout showTrackContainer, - AppCompatImageView trackAppearanceIcon, Integer showTrackId, - final Fragment target, final Runnable hideOnClickButtonAppearance) { + public static void createShowTrackItem(LinearLayout showTrackContainer, AppCompatImageView trackAppearanceIcon, + Integer showTrackId, final Fragment target, + final boolean nightMode, final Runnable hideOnClickButtonAppearance) { + FragmentActivity activity = target.getActivity(); + if (!(activity instanceof MapActivity)) { + return; + } + final MapActivity mapActivity = (MapActivity) activity; + final OsmandApplication app = mapActivity.getMyApplication(); final CardView buttonShowTrack = showTrackContainer.findViewById(R.id.compound_container); final CardView buttonAppearance = showTrackContainer.findViewById(R.id.additional_button_container); @@ -390,19 +396,18 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i @Override public void onClick(View v) { if (showTrackCompound.isChecked()) { - if (mapActivity != null) { - hideOnClickButtonAppearance.run(); - SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target); - } + hideOnClickButtonAppearance.run(); + SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); + TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target); } } }); } - protected static void setShowTrackItemBackground(View view, boolean checked, boolean nightMode) { - int background = checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode); - view.setBackgroundResource(background); + public static void setShowTrackItemBackground(View view, boolean checked, boolean nightMode) { + Drawable background = AppCompatResources.getDrawable(view.getContext(), + checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode)); + view.setBackgroundDrawable(background); } private void createItem(View view, ItemType type) { @@ -454,18 +459,18 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i } public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) { - Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light); + if (view instanceof CardView) { + int colorId = enabled ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); + ((CardView) view).setCardBackgroundColor(AndroidUtils.createPressedColorStateList( + context, colorId, getActiveTextColorId(nightMode) + )); + return; + } + Drawable background = AppCompatResources.getDrawable(context, getInactiveButtonBackgroundId(nightMode)); if (background != null && enabled) { - int normalColorId = view instanceof CardView - ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); - ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList( - context, normalColorId, getActiveTextColorId(nightMode) - ); - if (view instanceof CardView) { - ((CardView) view).setCardBackgroundColor(iconColorStateList); - return; - } - DrawableCompat.setTintList(background, iconColorStateList); + DrawableCompat.setTintList(background, AndroidUtils.createPressedColorStateList( + context, getInactiveButtonColorId(nightMode), getActiveTextColorId(nightMode) + )); } else { UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); } @@ -590,6 +595,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i public void openAnalyzeOnMap(GpxDisplayItem gpxItem) { } + public interface DismissTargetFragment { + void dismissTarget(); + } + @ColorRes public static int getActiveTextColorId(boolean nightMode) { return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; @@ -620,7 +629,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i return nightMode ? R.color.icon_color_osmand_dark : R.color.icon_color_osmand_light; } - @DrawableRes + @ColorRes public static int getActiveTransparentColorId(boolean nightMode) { return nightMode ? R.color.switch_button_active_dark : R.color.switch_button_active_light; } @@ -640,6 +649,11 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i return nightMode ? R.drawable.btn_background_stroked_inactive_dark : R.drawable.btn_background_stroked_inactive_light; } + @DrawableRes + public static int getInactiveButtonBackgroundId(boolean nightMode) { + return nightMode ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_inactive_light; + } + @Override protected boolean hideButtonsContainer() { return true; @@ -653,5 +667,4 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i } return null; } - } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java index e51911c867..c4bd642c1b 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java @@ -18,9 +18,8 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.*; -public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { public static final String TAG = TripRecordingClearDataBottomFragment.class.getSimpleName(); @@ -41,7 +40,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin); int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding); String description = getString(R.string.clear_recorded_data_warning) - .concat(getString(R.string.lost_data_warning)); + .concat("\n").concat(getString(R.string.lost_data_warning)); final View buttonClear = createItem(inflater, ItemType.CLEAR_DATA); final View buttonCancel = createItem(inflater, ItemType.CANCEL); @@ -61,7 +60,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF public void onClick(View v) { app.getSavingTrackHelper().clearRecordedData(true); dismiss(); - dismissTargetDialog(TripRecordingClearDataBottomFragment.this, TripRecordingOptionsBottomFragment.class); + dismissTarget(); } }) .create()); @@ -108,4 +107,11 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF return true; } + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).dismiss(); + } + } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java index 971d7399e1..20a2889f3e 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java @@ -19,10 +19,9 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISCARD; -import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.dismissTargetDialog; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISMISS; -public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { public static final String TAG = TripRecordingDiscardBottomFragment.class.getSimpleName(); @@ -43,13 +42,11 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin); int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding); - String description = getString(R.string.track_recording_description) - .concat(getString(R.string.lost_data_warning)); final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD); final View buttonCancel = createItem(inflater, ItemType.CANCEL); items.add(new BottomSheetItemWithDescription.Builder() - .setDescription(description) + .setDescription(getString(R.string.track_recording_description)) .setDescriptionColorId(getPrimaryTextColorId(nightMode)) .setTitle(app.getString(R.string.track_recording_title)) .setLayoutId(R.layout.bottom_sheet_item_title_with_description) @@ -68,8 +65,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra } app.getSavingTrackHelper().clearRecordedData(true); dismiss(); - dismissTargetDialog(TripRecordingDiscardBottomFragment.this, - TripRecordingOptionsBottomFragment.class, ACTION_STOP_AND_DISCARD, true); + + Fragment target = getTargetFragment(); + if (target != null) { + Bundle args = new Bundle(); + args.putBoolean(ACTION_STOP_AND_DISMISS, true); + target.setArguments(args); + } + dismissTarget(); } }) .create()); @@ -111,6 +114,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra } } + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).dismiss(); + } + } + @Override protected boolean hideButtonsContainer() { return true; diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java index aa755a4276..ee18485e78 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java @@ -11,7 +11,6 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -36,11 +35,10 @@ import net.osmand.util.Algorithms; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { public static final String TAG = TripRecordingOptionsBottomFragment.class.getSimpleName(); - public static final String ACTION_STOP_AND_DISCARD = "action_stop_and_discard"; - private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file"; + public static final String ACTION_STOP_AND_DISMISS = "action_stop_and_discard"; private static final int SAVE_UPDATE_INTERVAL = 1000; private OsmandApplication app; @@ -72,11 +70,10 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra return settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); } - public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target, SelectedGpxFile selectedGpxFile) { + public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { TripRecordingOptionsBottomFragment fragment = new TripRecordingOptionsBottomFragment(); fragment.setTargetFragment(target, 0); - fragment.setSelectedGpxFile(selectedGpxFile); fragment.show(fragmentManager, TAG); } } @@ -86,18 +83,12 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra app = requiredMyApplication(); settings = app.getSettings(); helper = app.getSavingTrackHelper(); + selectedGpxFile = helper.getCurrentTrack(); LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); final FragmentManager fragmentManager = getFragmentManager(); int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding); int dp36 = getResources().getDimensionPixelSize(R.dimen.context_menu_controller_height); - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE) - && savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) { - selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - } - } - buttonClear = createItem(inflater, ItemType.CLEAR_DATA, hasDataToSave()); final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD); final View buttonOnline = createItem(inflater, ItemType.STOP_ONLINE, hasDataToSave()); @@ -193,12 +184,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra } - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); - } - @Override public void onResume() { super.onResume(); @@ -213,14 +198,7 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra public void onPause() { super.onPause(); stopUpdatingTimeTrackSaved(); - Fragment target = getTargetFragment(); - if (target instanceof TripRecordingBottomFragment) { - if (isDiscard()) { - ((TripRecordingBottomFragment) target).dismiss(); - } else { - ((TripRecordingBottomFragment) target).show(); - } - } + dismissTarget(); } public void show() { @@ -237,32 +215,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra } } - private boolean isDiscard() { - Bundle args = getArguments(); - if (args != null) { - return args.getBoolean(ACTION_STOP_AND_DISCARD); - } - return false; - } - - protected static void dismissTargetDialog(Fragment current, Class targetClass) { - dismissTargetDialog(current, targetClass, null, null); - } - - protected static void dismissTargetDialog(Fragment current, Class targetClass, String booleanKey, Boolean value) { - if (targetClass.isInstance(current.getTargetFragment())) { - Fragment target = current.getTargetFragment(); - if (booleanKey != null && value != null) { - Bundle args = new Bundle(); - args.putBoolean(booleanKey, value); - target.setArguments(args); - } - if (target instanceof DialogFragment) { - ((DialogFragment) target).dismiss(); - } - } - } - public void stopUpdatingTimeTrackSaved() { handler.removeCallbacks(updatingTimeTrackSaved); } @@ -312,17 +264,37 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); if (mapActivity != null && plugin != null) { stopUpdatingTimeTrackSaved(); - settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false); plugin.saveCurrentTrack(null, mapActivity, false, true); + Bundle args = new Bundle(); + args.putBoolean(ACTION_STOP_AND_DISMISS, true); + setArguments(args); dismiss(); - dismissTargetDialog(TripRecordingOptionsBottomFragment.this, TripRecordingBottomFragment.class); - settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); - runUpdatingTimeTrackSaved(); + dismissTarget(); } } }; } + private boolean isDiscard() { + Bundle args = getArguments(); + if (args != null) { + return args.getBoolean(ACTION_STOP_AND_DISMISS); + } + return false; + } + + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingBottomFragment) { + if (isDiscard()) { + ((TripRecordingBottomFragment) target).dismiss(); + } else { + ((TripRecordingBottomFragment) target).show(); + } + } + } + @Nullable public MapActivity getMapActivity() { Activity activity = getActivity(); @@ -346,5 +318,4 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra protected boolean useVerticalButtons() { return true; } - } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java index 5d382480bf..8a0be61836 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java @@ -106,8 +106,8 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); - createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, - R.string.shared_string_show_on_map, TripRecordingStartingBottomFragment.this, new Runnable() { + createShowTrackItem(showTrackContainer, trackAppearanceIcon, R.string.shared_string_show_on_map, + TripRecordingStartingBottomFragment.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -117,7 +117,6 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr updateUpDownBtn(); CardView cardLeft = itemView.findViewById(R.id.button_left); - createItem(app, nightMode, cardLeft, ItemType.CANCEL, true, null); cardLeft.setOnClickListener(new View.OnClickListener() { @Override @@ -127,7 +126,6 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr }); CardView cardCenter = itemView.findViewById(R.id.button_center); - createItem(app, nightMode, cardCenter, ItemType.START_RECORDING, true, null); cardCenter.setOnClickListener(new View.OnClickListener() { @Override @@ -137,7 +135,6 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr }); CardView cardRight = itemView.findViewById(R.id.button_right); - createItem(app, nightMode, cardRight, ItemType.SETTINGS, true, null); cardRight.setOnClickListener(new View.OnClickListener() { @Override @@ -145,7 +142,8 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { hide(); - BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, TripRecordingStartingBottomFragment.this); + BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, + null, new Bundle(), TripRecordingStartingBottomFragment.this); } } }); @@ -241,19 +239,13 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr dismiss(); } - public void show(String... keys) { + public void show() { Dialog dialog = getDialog(); if (dialog != null) { dialog.show(); - for (String key : keys) { - if (key.equals(UPDATE_TRACK_ICON)) { - updateTrackIcon(app, trackAppearanceIcon); - } - if (key.equals(UPDATE_LOGGING_INTERVAL)) { - updateIntervalValue(); - AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); - } - } + updateTrackIcon(app, trackAppearanceIcon); + updateIntervalValue(); + AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); } } @@ -277,5 +269,4 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr protected boolean hideButtonsContainer() { return true; } - } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java index 552b7abb44..b8899dd9c7 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java @@ -61,6 +61,8 @@ import java.util.Map; import static net.osmand.plus.helpers.GpxUiHelper.LineGraphType.ALTITUDE; import static net.osmand.plus.helpers.GpxUiHelper.LineGraphType.SLOPE; import static net.osmand.plus.helpers.GpxUiHelper.LineGraphType.SPEED; +import static net.osmand.plus.myplaces.GPXTabItemType.GPX_TAB_ITEM_ALTITUDE; +import static net.osmand.plus.myplaces.GPXTabItemType.GPX_TAB_ITEM_SPEED; public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvider, ViewAtPositionInterface { @@ -81,14 +83,6 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid private boolean nightMode; private boolean onlyGraphs; - public GPXItemPagerAdapter(@NonNull OsmandApplication app, - @NonNull GpxDisplayItem gpxItem, - @NonNull TrackDisplayHelper displayHelper, - boolean nightMode, - @NonNull SegmentActionsListener actionsListener) { - this(app, gpxItem, displayHelper, nightMode, actionsListener, false); - } - public GPXItemPagerAdapter(@NonNull OsmandApplication app, @NonNull GpxDisplayItem gpxItem, @NonNull TrackDisplayHelper displayHelper, @@ -111,10 +105,10 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid tabTypeList.add(GPXTabItemType.GPX_TAB_ITEM_GENERAL); if (gpxItem != null && gpxItem.analysis != null) { if (gpxItem.analysis.hasElevationData) { - tabTypeList.add(GPXTabItemType.GPX_TAB_ITEM_ALTITUDE); + tabTypeList.add(GPX_TAB_ITEM_ALTITUDE); } if (gpxItem.analysis.isSpeedSpecified()) { - tabTypeList.add(GPXTabItemType.GPX_TAB_ITEM_SPEED); + tabTypeList.add(GPX_TAB_ITEM_SPEED); } } tabTypes = tabTypeList.toArray(new GPXTabItemType[0]); @@ -228,41 +222,21 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid private View getViewForTab(@NonNull ViewGroup container, @NonNull GPXTabItemType tabType) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); - View view; - switch (tabType) { - case GPX_TAB_ITEM_ALTITUDE: - view = inflater.inflate(R.layout.gpx_item_altitude, container, false); - if (onlyGraphs) { - AndroidUiHelper.setVisibility(View.GONE, - view.findViewById(R.id.average_range), - view.findViewById(R.id.ascent_descent) - ); - } - break; - case GPX_TAB_ITEM_SPEED: - view = inflater.inflate(R.layout.gpx_item_speed, container, false); - if (onlyGraphs) { - AndroidUiHelper.setVisibility(View.GONE, - view.findViewById(R.id.average_max), - view.findViewById(R.id.time_distance) - ); - } - break; - case GPX_TAB_ITEM_GENERAL: - default: - view = inflater.inflate(R.layout.gpx_item_general, container, false); - if (onlyGraphs) { - AndroidUiHelper.setVisibility(View.GONE, - view.findViewById(R.id.distance_time_span), - view.findViewById(R.id.start_end_time) - ); - } - break; + int layoutResId; + if (tabType == GPX_TAB_ITEM_ALTITUDE) { + layoutResId = R.layout.gpx_item_altitude; + } else if (tabType == GPX_TAB_ITEM_SPEED) { + layoutResId = R.layout.gpx_item_speed; + } else { + layoutResId = R.layout.gpx_item_general; } + View view = inflater.inflate(layoutResId, container, false); if (onlyGraphs) { AndroidUiHelper.setVisibility(View.GONE, view.findViewById(R.id.gpx_join_gaps_container), + view.findViewById(R.id.top_line_blocks), view.findViewById(R.id.list_divider), + view.findViewById(R.id.bottom_line_blocks), view.findViewById(R.id.details_divider), view.findViewById(R.id.details_view) ); @@ -274,7 +248,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid if (analysis != null && analysis.isSpeedSpecified()) { if (analysis.hasSpeedData) { GpxUiHelper.setupGPXChart(app, chart, 4); - chart.setData(new LineData(getDataSets(chart, GPXTabItemType.GPX_TAB_ITEM_SPEED, SPEED, null))); + chart.setData(new LineData(getDataSets(chart, GPX_TAB_ITEM_SPEED, SPEED, null))); updateChart(chart); chart.setVisibility(View.VISIBLE); } else { @@ -311,16 +285,16 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid } } else { chart.setVisibility(View.GONE); - view.findViewById(R.id.average_max).setVisibility(View.GONE); + view.findViewById(R.id.top_line_blocks).setVisibility(View.GONE); view.findViewById(R.id.list_divider).setVisibility(View.GONE); - view.findViewById(R.id.time_distance).setVisibility(View.GONE); + view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE); } if (!onlyGraphs) { updateJoinGapsInfo(view, position); view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_SPEED); + openAnalyzeOnMap(GPX_TAB_ITEM_SPEED); } }); TextView overflowMenu = view.findViewById(R.id.overflow_menu); @@ -346,7 +320,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid if (analysis != null) { if (analysis.hasElevationData) { GpxUiHelper.setupGPXChart(app, chart, 4); - chart.setData(new LineData(getDataSets(chart, GPXTabItemType.GPX_TAB_ITEM_ALTITUDE, ALTITUDE, SLOPE))); + chart.setData(new LineData(getDataSets(chart, GPX_TAB_ITEM_ALTITUDE, ALTITUDE, SLOPE))); updateChart(chart); chart.setVisibility(View.VISIBLE); } else { @@ -388,16 +362,16 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid } } else { chart.setVisibility(View.GONE); - view.findViewById(R.id.average_range).setVisibility(View.GONE); + view.findViewById(R.id.top_line_blocks).setVisibility(View.GONE); view.findViewById(R.id.list_divider).setVisibility(View.GONE); - view.findViewById(R.id.ascent_descent).setVisibility(View.GONE); + view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE); } if (!onlyGraphs) { updateJoinGapsInfo(view, position); view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_ALTITUDE); + openAnalyzeOnMap(GPX_TAB_ITEM_ALTITUDE); } }); TextView overflowMenu = view.findViewById(R.id.overflow_menu); @@ -453,14 +427,14 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid ((TextView) view.findViewById(R.id.end_date_text)).setText(df.format(end)); } else { view.findViewById(R.id.list_divider).setVisibility(View.GONE); - view.findViewById(R.id.start_end_time).setVisibility(View.GONE); + view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE); } } } else { chart.setVisibility(View.GONE); - view.findViewById(R.id.distance_time_span).setVisibility(View.GONE); + view.findViewById(R.id.top_line_blocks).setVisibility(View.GONE); view.findViewById(R.id.list_divider).setVisibility(View.GONE); - view.findViewById(R.id.start_end_time).setVisibility(View.GONE); + view.findViewById(R.id.bottom_line_blocks).setVisibility(View.GONE); } updateJoinGapsInfo(view, position); if (!onlyGraphs) { @@ -698,7 +672,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid ((TextView) view.findViewById(R.id.distance_text)).setText(OsmAndFormatter.getFormattedDistance(totalDistance, app)); ((TextView) view.findViewById(R.id.duration_text)).setText(Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled())); - } else if (tabType.equals(GPXTabItemType.GPX_TAB_ITEM_SPEED)) { + } else if (tabType.equals(GPX_TAB_ITEM_SPEED)) { long timeMoving = !joinSegments && gpxItem.isGeneralTrack() ? analysis.timeMovingWithoutGaps : analysis.timeMoving; float totalDistanceMoving = !joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceMovingWithoutGaps : analysis.totalDistanceMoving; diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java index 60141d5ccf..ac45fc1294 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java @@ -55,7 +55,7 @@ public class SegmentGPXAdapter extends ArrayAdapter { WrapContentHeightViewPager pager = row.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = row.findViewById(R.id.sliding_tabs); - pager.setAdapter(new GPXItemPagerAdapter(app, item, displayHelper, nightMode, listener)); + pager.setAdapter(new GPXItemPagerAdapter(app, item, displayHelper, nightMode, listener, false)); if (create) { tabLayout.setViewPager(pager); } else { diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index 9e3c633544..52cf2ac54e 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -12,9 +12,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; import androidx.appcompat.widget.SwitchCompat; -import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -107,7 +105,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { private final Class[] excludeParameters; @SafeVarargs - DialogMode(Class ... excludeParameters) { + DialogMode(Class... excludeParameters) { this.excludeParameters = excludeParameters; } @@ -556,7 +554,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { Bundle args = new Bundle(); args.putString(DIALOG_MODE_KEY, dialogMode.name()); BaseSettingsFragment.showInstance(mapActivity, - SettingsScreenType.NAVIGATION, applicationMode, args); + SettingsScreenType.NAVIGATION, applicationMode, args, null); } }) .create(); @@ -695,9 +693,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { } public static void showInstance(MapActivity mapActivity, - Fragment targetFragment, - DialogMode dialogMode, - String appModeKey) { + Fragment targetFragment, + DialogMode dialogMode, + String appModeKey) { try { FragmentManager fm = mapActivity.getSupportFragmentManager(); if (!fm.isStateSaved()) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index 2faf24db46..4c0af32894 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -61,7 +61,6 @@ import net.osmand.plus.activities.OsmandInAppPurchaseActivity; import net.osmand.plus.audionotes.MultimediaNotesFragment; import net.osmand.plus.development.DevelopmentSettingsFragment; import net.osmand.plus.monitoring.MonitoringSettingsFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomFragment; import net.osmand.plus.openplacereviews.OprSettingsFragment; import net.osmand.plus.osmedit.OsmEditingFragment; import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment; @@ -86,7 +85,6 @@ import java.io.Serializable; import java.util.Set; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener, OnPreferenceClickListener, AppModeChangedListener, OnConfirmPreferenceChange { @@ -293,15 +291,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } } - @Override - public void onDestroyView() { - super.onDestroyView(); - Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); - } - } - @Override public void onDetach() { super.onDetach(); @@ -895,24 +884,11 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType) { - return showInstance(activity, screenType, (ApplicationMode) null); - } - - public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, Fragment target) { - return showInstance(activity, screenType, null, target); + return showInstance(activity, screenType, null); } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode) { - return showInstance(activity, screenType, appMode, new Bundle()); - } - - public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode, Fragment target) { - return showInstance(activity, screenType, appMode, new Bundle(), target); - } - - public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, - @Nullable ApplicationMode appMode, @NonNull Bundle args) { - return showInstance(activity, screenType, appMode, args, null); + return showInstance(activity, screenType, appMode, new Bundle(), null); } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @@ -923,9 +899,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl args.putString(APP_MODE_KEY, appMode.getStringKey()); } fragment.setArguments(args); - if (target != null) { - fragment.setTargetFragment(target, 0); - } + fragment.setTargetFragment(target, 0); activity.getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContainer, fragment, screenType.fragmentName) .addToBackStack(DRAWER_SETTINGS_ID + ".new") diff --git a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java index 6eb1be4c16..96478490bb 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java @@ -152,8 +152,8 @@ public class GpxBlockStatisticsBuilder { withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); } } + items.clear(); if (analysis != null) { - items.clear(); switch (initBlocksKey) { case INIT_BLOCKS_GENERAL: { float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; @@ -283,51 +283,52 @@ public class GpxBlockStatisticsBuilder { public void prepareData(String title, String value, @DrawableRes int imageResId, @ColorRes int imageColorId, GPXDataSetType firstType, GPXDataSetType secondType, ItemType itemType) { - if (analysis != null) { - StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); - switch (statBlock.itemType) { - case ITEM_DISTANCE: { - if (analysis.totalDistance != 0f) { - items.add(statBlock); - } - break; + if (analysis == null) { + return; + } + StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); + switch (statBlock.itemType) { + case ITEM_DISTANCE: { + if (analysis.totalDistance != 0f) { + items.add(statBlock); } - case ITEM_DISTANCE_MOVING: { - if (analysis.totalDistanceMoving != 0f) { - items.add(statBlock); - } - break; + break; + } + case ITEM_DISTANCE_MOVING: { + if (analysis.totalDistanceMoving != 0f) { + items.add(statBlock); } - case ITEM_ALTITUDE: { - if (analysis.hasElevationData) { - items.add(statBlock); - } - break; + break; + } + case ITEM_ALTITUDE: { + if (analysis.hasElevationData) { + items.add(statBlock); } - case ITEM_SPEED: { - if (analysis.isSpeedSpecified()) { - items.add(statBlock); - } - break; + break; + } + case ITEM_SPEED: { + if (analysis.isSpeedSpecified()) { + items.add(statBlock); } - case ITEM_TIME: { - if (analysis.timeSpan > 0) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME: { + if (analysis.timeSpan > 0) { + items.add(statBlock); } - case ITEM_TIME_SPAN: { - if (analysis.hasSpeedData) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME_SPAN: { + if (analysis.hasSpeedData) { + items.add(statBlock); } - case ITEM_TIME_MOVING: { - if (analysis.isTimeMoving()) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME_MOVING: { + if (analysis.isTimeMoving()) { + items.add(statBlock); } + break; } } } diff --git a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java index ad266fc2ab..a3ed324543 100644 --- a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java @@ -47,7 +47,7 @@ public class SegmentsCard extends BaseCard { WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs); - pager.setAdapter(new GPXItemPagerAdapter(app, displayItem, displayHelper, nightMode, listener)); + pager.setAdapter(new GPXItemPagerAdapter(app, displayItem, displayHelper, nightMode, listener, false)); tabLayout.setViewPager(pager); container.addView(segmentView); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 958f45193a..e8bf36bc27 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -399,7 +399,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) { Fragment target = getTargetFragment(); if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_TRACK_ICON); + ((TripRecordingStartingBottomFragment) target).show(); } else if (target instanceof TripRecordingBottomFragment) { ((TripRecordingBottomFragment) target).show(UPDATE_TRACK_ICON); }