diff --git a/OsmAnd/res/drawable-hdpi/ic_action_device_top.png b/OsmAnd/res/drawable-hdpi/ic_action_device_top.png new file mode 100644 index 0000000000..c26f11958b Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_device_top.png differ diff --git a/OsmAnd/res/drawable-hdpi/ic_action_device_topbar.png b/OsmAnd/res/drawable-hdpi/ic_action_device_topbar.png new file mode 100644 index 0000000000..2ea354119c Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_device_topbar.png differ diff --git a/OsmAnd/res/drawable-hdpi/ic_action_device_widget.png b/OsmAnd/res/drawable-hdpi/ic_action_device_widget.png new file mode 100644 index 0000000000..ee2abf80f8 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_device_widget.png differ diff --git a/OsmAnd/res/drawable-hdpi/ic_action_history.png b/OsmAnd/res/drawable-hdpi/ic_action_history.png new file mode 100644 index 0000000000..a8e782e09b Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_history.png differ diff --git a/OsmAnd/res/drawable-hdpi/ic_action_marker_passed.png b/OsmAnd/res/drawable-hdpi/ic_action_marker_passed.png new file mode 100644 index 0000000000..b1baa26469 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_marker_passed.png differ diff --git a/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_day.webp b/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_day.webp new file mode 100644 index 0000000000..efc52b4c40 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_day.webp differ diff --git a/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_night.webp b/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_night.webp new file mode 100644 index 0000000000..edaea3b938 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/img_help_markers_topbar_night.webp differ diff --git a/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_day.webp b/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_day.webp new file mode 100644 index 0000000000..5d49a22556 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_day.webp differ diff --git a/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_night.webp b/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_night.webp new file mode 100644 index 0000000000..6c33a9bad7 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/img_help_markers_widgets_night.webp differ diff --git a/OsmAnd/res/drawable-mdpi/ic_action_device_top.png b/OsmAnd/res/drawable-mdpi/ic_action_device_top.png new file mode 100644 index 0000000000..d3e1ebe719 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_device_top.png differ diff --git a/OsmAnd/res/drawable-mdpi/ic_action_device_topbar.png b/OsmAnd/res/drawable-mdpi/ic_action_device_topbar.png new file mode 100644 index 0000000000..9fd6ca7d18 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_device_topbar.png differ diff --git a/OsmAnd/res/drawable-mdpi/ic_action_device_widget.png b/OsmAnd/res/drawable-mdpi/ic_action_device_widget.png new file mode 100644 index 0000000000..042f8d8991 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_device_widget.png differ diff --git a/OsmAnd/res/drawable-mdpi/ic_action_history.png b/OsmAnd/res/drawable-mdpi/ic_action_history.png new file mode 100644 index 0000000000..686d138882 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_history.png differ diff --git a/OsmAnd/res/drawable-mdpi/ic_action_marker_passed.png b/OsmAnd/res/drawable-mdpi/ic_action_marker_passed.png new file mode 100644 index 0000000000..387037d814 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_marker_passed.png differ diff --git a/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_day.webp b/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_day.webp new file mode 100644 index 0000000000..a67217b49b Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_day.webp differ diff --git a/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_night.webp b/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_night.webp new file mode 100644 index 0000000000..92d280e447 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/img_help_markers_topbar_night.webp differ diff --git a/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_day.webp b/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_day.webp new file mode 100644 index 0000000000..3b978f2b56 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_day.webp differ diff --git a/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_night.webp b/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_night.webp new file mode 100644 index 0000000000..6430d12a1c Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/img_help_markers_widgets_night.webp differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_device_top.png b/OsmAnd/res/drawable-xhdpi/ic_action_device_top.png new file mode 100644 index 0000000000..ca3da4bc7e Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_device_top.png differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_device_topbar.png b/OsmAnd/res/drawable-xhdpi/ic_action_device_topbar.png new file mode 100644 index 0000000000..afd531cde9 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_device_topbar.png differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_device_widget.png b/OsmAnd/res/drawable-xhdpi/ic_action_device_widget.png new file mode 100644 index 0000000000..246aac7041 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_device_widget.png differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_history.png b/OsmAnd/res/drawable-xhdpi/ic_action_history.png new file mode 100644 index 0000000000..05e8b4d1ce Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_history.png differ diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_marker_passed.png b/OsmAnd/res/drawable-xhdpi/ic_action_marker_passed.png new file mode 100644 index 0000000000..3d51929b91 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_marker_passed.png differ diff --git a/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_day.webp b/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_day.webp new file mode 100644 index 0000000000..5be299f7f4 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_day.webp differ diff --git a/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_night.webp b/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_night.webp new file mode 100644 index 0000000000..6cecb04ff8 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/img_help_markers_topbar_night.webp differ diff --git a/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_day.webp b/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_day.webp new file mode 100644 index 0000000000..dc08479f27 Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_day.webp differ diff --git a/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_night.webp b/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_night.webp new file mode 100644 index 0000000000..bd71bab2ab Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/img_help_markers_widgets_night.webp differ diff --git a/OsmAnd/res/drawable-xxhdpi/_img_help_markers_topbar_night.webp b/OsmAnd/res/drawable-xxhdpi/_img_help_markers_topbar_night.webp new file mode 100644 index 0000000000..636247ef22 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/_img_help_markers_topbar_night.webp differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_device_top.png b/OsmAnd/res/drawable-xxhdpi/ic_action_device_top.png new file mode 100644 index 0000000000..f33fd77973 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_device_top.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_device_topbar.png b/OsmAnd/res/drawable-xxhdpi/ic_action_device_topbar.png new file mode 100644 index 0000000000..ea92278360 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_device_topbar.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_device_widget.png b/OsmAnd/res/drawable-xxhdpi/ic_action_device_widget.png new file mode 100644 index 0000000000..670655881b Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_device_widget.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_history.png b/OsmAnd/res/drawable-xxhdpi/ic_action_history.png new file mode 100644 index 0000000000..0dcfd41704 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_history.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_marker_passed.png b/OsmAnd/res/drawable-xxhdpi/ic_action_marker_passed.png new file mode 100644 index 0000000000..c3ad4b574c Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_marker_passed.png differ diff --git a/OsmAnd/res/drawable-xxhdpi/img_help_markers_topbar_day.webp b/OsmAnd/res/drawable-xxhdpi/img_help_markers_topbar_day.webp new file mode 100644 index 0000000000..b5e0e28d42 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/img_help_markers_topbar_day.webp differ diff --git a/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_day.webp b/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_day.webp new file mode 100644 index 0000000000..8579102db3 Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_day.webp differ diff --git a/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_night.webp b/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_night.webp new file mode 100644 index 0000000000..6bef739b8f Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/img_help_markers_widgets_night.webp differ diff --git a/OsmAnd/res/layout/split_segments_layout.xml b/OsmAnd/res/layout/split_segments_layout.xml index 20fdb8abfe..410bf5fd8c 100644 --- a/OsmAnd/res/layout/split_segments_layout.xml +++ b/OsmAnd/res/layout/split_segments_layout.xml @@ -1,86 +1,125 @@ - - - - - + android:layout_height="@dimen/dashboard_map_toolbar"> + + + + + + + + + + + + + + - - + android:layout_height="wrap_content" + android:orientation="vertical"> - - - - + android:layout_height="48dp" + android:background="?attr/bg_color" + android:orientation="horizontal" + android:paddingLeft="16dp" + android:paddingRight="16dp"> + android:layout_marginBottom="12dp" + android:layout_marginRight="16dp" + android:layout_marginTop="12dp" + tools:src="@drawable/ic_action_split_interval" /> + + + + + + + + + + + + - + - - - \ No newline at end of file + \ No newline at end of file diff --git a/OsmAnd/res/values-be-rBY/strings.xml b/OsmAnd/res/values-be-rBY/strings.xml index 116e531af2..e540f237e2 100644 --- a/OsmAnd/res/values-be-rBY/strings.xml +++ b/OsmAnd/res/values-be-rBY/strings.xml @@ -1193,7 +1193,7 @@ Miesca parkoŭkі і čas vіdać na paneli kіravańnia OsmAnd і na vіdžecie Niama ŭstalavanych dadzienych dla abranaj movy. Vy chočacie pajścі na Google Play, kab ustalavać? Razviarnuć kіrunak GPX Vykarystoŭvać biahučy punkt pryznačeńnia - Prajścі ŭvieś šlach spačatku + Prajścі ŭvieś šlach Dla hetaha rehіjonu dastupnyja lakalnyja vektarnyja mapy.\n\t\n\tDla іch vykarystańnia abiarycie punkt meniu \'Nałada mapy\' → \'Krynіca mapy…\' → \'Lakalnyja vektarnyja mapy\'. Vyvad hałasavych padkazak Abiarycie kanał dla hałasavych padkazak @@ -2793,9 +2793,9 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd Dadać kropku pierad Dadać kropku paslia Opcyi - OsmAnd dadasć dadatkovyja kropki ŭ zaliežnasci ad typu navihacyi. + OsmAnd zlučyć kropki z maršrutam dlia abranaha profilia. Vy možać zachavać kropki, jak kropki maršrutu ci jak liniju. - Vybrać typ navihacyi + Abrać profiĺ navihacyi Dadać kropki maršrutu Dadać liniju Dadact i zapisać sliady diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index e7c1caefe4..8738d9e21d 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -631,7 +631,7 @@ Файл ня можа быць пераназваны. Файл з такой назвай ужо існуе. - GPX маршрут + GPX-маршрут Некалькі катэгорый POI знойдзены, што адпавядаюць запыту: Лякальных зьвестак для пошуку POI няма. Пошук па назве @@ -715,7 +715,7 @@ Няма ўсталяваных дадзеных для абранай мовы. Вы хочаце пайсьці на Google Play, каб усталяваць? Развярнуць кірунак GPX Выкарыстоўваць цяперашні пункт прызначэньня - Прайсьці ўвесь шлях спачатку + Прайсці ўвесь шлях Для гэтага рэгіёну даступныя лякальныя вэктарныя мапы.\n\t\n\tДля іх выкарыстаньня абярыце пункт мэню \'Налада мапы\' → \'Крыніца мапы…\' → \'Лякальныя вэктарныя мапы\'. Вывад галасавых падказак Абярыце канал для галасавых падказак @@ -1223,8 +1223,8 @@ Паўночная Амэрыка - Канада Эўропа - Італія Эўропа - Вялікабрытанія - Вылічыць адрэзак маршруту OsmAnd без Інтэрнэту - Вылічыць маршрут OsmAnd для першага і апошняга ўчастка маршруту + Разлічыць адрэзак маршруту OsmAnd без Інтэрнэту + Разлічыць маршрут OsmAnd для першага і апошняга ўчастка маршруту Ці хочаце вы выкарыстоўваць адлюстраваны сьлед для навігацыі? Інфармацыя пра маршрут Аддаваць перавагу аўтамагістралям @@ -1289,7 +1289,7 @@ Голас Рознае Лякалізацыя - Перапыненьне музыкі + Прыпыніць музыку Унікальны ідэнтыфікатар прылады Глянуць унікальны рэгістрацыйны ключ прыстасаваньня і наладзіць асабісты канал адсочваньня Гэты модуль дае некаторыя функцыянальныя магчымасці для маніторынгу OpenStreetMap гл. https://osmo.mobi @@ -1605,7 +1605,7 @@ Маршрутныя таксі Маршруты трамваяў і цягнікоў - Пазьбягаць дарогі… + Пазбягаць дарог… Схаваць Уключыць экран Уключаць экран прыстасаваньня пры набліжэньні да павароту @@ -2170,7 +2170,7 @@ Аўтаматычныя абнаўленні Выберыце галасавыя ўказаньні Выберыце ці сьцягніце галасавыя ўказаньні для вашай мовы - Выберыце дарогі, якія вы хочаце пазьбягаць падчас навігацыі + Абярыце дарогі, якія вы хочаце пазбягаць падчас навігацыі Час абнаўленьня Абнаўленьні: %s @@ -2842,9 +2842,9 @@ Дадаць кропку перад Дадаць кропку пасля Опцыі - OsmAnd дадасць дадатковыя кропкі ў залежнасці ад тыпу навігацыі. + OsmAnd злучыць кропкі з маршрутам для абранага профіля. Вы можаць захаваць кропкі, як кропкі маршруту ці як лінію. - Выбраць тып навігацыі + Абраць профіль навігацыі Дадаць кропкі маршруту Дадаць лінію Дадацт і запісаць сляды diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 70b7b621e3..b56f926d09 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -636,7 +636,7 @@ Memòria proporcional %4$s MB (límit de l\'Android %5$s MB, Dalvik %6$s MB).No es troba el mapa base mundial (cobreix tot el món però amb poc detall). És recomanable que us baixeu el fitxer World_basemap_x.obf per gaudir d\'una perspectiva global. No s\'ha trobat les dades descarregades («fora de línia») a la targeta SD. És recomanable que les baixeu per utilitzar mapes sense connexió. No hi ha dades instal·lades per la llengua seleccionada. Voleu anar al Market per instal·lar-ne? - Passa al llarg de la traça sencera + Passa per tota la traça sencera Hi ha un mapa de vectors fora de línia per aquesta localització. \n\t\n\tPer activar-lo aneu a «Menú» → «Configuració del mapa» → «Font de mapes…» → «Mapes de vectors fora de línia». Modifiqueu l\'opacitat de la capa superposada @@ -1116,7 +1116,7 @@ Memòria proporcional %4$s MB (límit de l\'Android %5$s MB, Dalvik %6$s MB). Afegeix com el següent punt de destinació Calcula un segment de ruta a l\'OsmAnd sense Internet - Calcula una ruta a l\'OsmAnd pels seus segments primer i darrer + Calcula una ruta OsmAnd al primer i al darrer segment de la ruta Voleu utilitzar la traça visualitzada per la navegació? adreces per tot el país Correcció d\'altitud mundial @@ -1174,7 +1174,7 @@ Memòria proporcional %4$s MB (límit de l\'Android %5$s MB, Dalvik %6$s MB).Miscel·lània Ubicació Les indicacions de veu suspenen la reproducció de música, no s\'hi superposen - Interrompre la música + Atura la música Identificador únic del dispositiu Configureu els paràmetres de monitorització i el canal de seguiment personal "Aquest connector us ofereix parcialment la funcionalitat de la Monitorització OpenStreetmap, consulteu http://osmo.mobi. diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index b562ce525b..342beb4764 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -274,7 +274,7 @@ Proportional hukommelse %4$s MB (Android grænse %5$s MB, Dalvik %6$s MB).Kollektivtrafiksøgning Favoritsøgning - OsmAnd offline navigation er midlertidig utilgængelig. + Offline navigation er midlertidig utilgængelig. Venstrekørsel Vælg for lande med venstrekørsel @@ -957,7 +957,7 @@ OSM er et i fællesskab drevet, globalt offentligt domæne kortlægningsprojekt. Ny rute beregnet, afstand Ankommet til destinationen Koordinaterne er ugyldige! - Tilbage til OsmAnd-kortet + Tilbage til kortet Indlæser data… Læser lokale data… Sidste OsmAnd kørsel fejlede. Logfilen er i {0}. Rapporter hændelsen og vedhæft logfilen. @@ -1208,11 +1208,11 @@ OSM er et i fællesskab drevet, globalt offentligt domæne kortlægningsprojekt. Indstillinger for navigation Indstillinger for ruteplanlægning Lastbil - Beregn OsmAnd offline rute + Beregn offline rute Kopierer fil (%s) til den ny placering… - Kopierer OsmAnd datafiler til ny destination (%s)… - Kopierer OsmAnd datafiler… + Kopierer datafiler til ny destination (%s)… + Kopierer datafiler… "Siden Android version 4.4 (KitKat) kan man ikke hente og opdatere kort i den tidligere lagerplacering (%s). Skift til den tilladte placering og kopiere alle OsmAnd datafiler dertil?          \n Note 1: De gamle datafiler forbliver urørt. (men kan slettes manuelt). \n Note 2: På den nye placering vil det ikke være muligt at dele filer mellem OsmAnd og OsmAnd+." @@ -1237,8 +1237,8 @@ OSM er et i fællesskab drevet, globalt offentligt domæne kortlægningsprojekt. Tilføj som efterfølgende destination Brug viste spor til navigation? - Beregn OsmAnd rutesegment uden internet - Beregn OsmAnd rute for første og sidste rutesegment + Beregn rutesegment uden internet + Beregn rute for første og sidste rutesegment Walisisk Europa - Italien Europa - Storbritannien diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 822eb587d5..ee69ebb7bb 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -2756,9 +2756,9 @@ Indikas lokon: %1$s x %2$s" Aldoni punkton antaŭe Aldoni punkton sekve Agordoj - OsmAnd aldonos pliajn punktojn depende de speco de navigado. + OsmAnd kunigos punktojn al vojojn ĉe la elektita profilo. Vi povas konservi punktojn kiel kurspunktojn aŭ linion. - Elektu specon de navigado + Elektu profilon de navigado Aldoni kurspunktojn Aldoni linion Aldoni kaj registri spurojn diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index f0f2011120..fe58fbb795 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -621,7 +621,7 @@ Biltegiratzean {1} MB erabiliko dira. Jatorria: Bilatu honen inguruan - Gorde GPX lorratz gisa + Gorde GPX lorratz berri gisa Ibilbidea \'%1$s\' bezala ongi gorde da. Fitxategi-izena: Izen berdineko beste fitxategi bat dago dagoeneko. @@ -2594,7 +2594,7 @@ Area honi dagokio: %1$s x %2$s Ez bidali aplikazioaren erabilera estatistika anonimoak OsmAndek aplikazioan irekitzen dituzun atalei buruzko informazioa jasotzen du. Zure kokalekua ez da inoiz bidaltzen, ezta aplikazioan idazten duzun ezer edo ikusi, bilatu edo deskargatzen dituzun zonaldeei buruzko ezer ere. Ez erakutsi mezuak hasieran - Aplikazioen deskontuak eta tokiko gertaeren inguruko mezuak bistaratzen ditu + Aplikazioen deskontuak eta tokiko gertaera berezien mezuak ezkutatzen ditu Aparkatzeko aukerak Eskerrik asko OsmAnd aplikazioaren bertsio osoa erosteagatik! Menditsua @@ -2771,4 +2771,26 @@ Area honi dagokio: %1$s x %2$s Gehitu puntua aurretik Gehitu puntua atzetik Aukerak - + Eraman guztia historialera + Kalkulatu ibilbidea + Erakutsi norabidea + Ordenatu honela + Markatzaile-aukerak + Ez erabili animazioak + Aplikazioaren animazioak desgaitzen ditu + Jarraitu mapan erakusten + Irten gorde gabe? + Puntuak puntu ala lerro gisa gorde ditakezu + OsmAndek puntuak hautatutako profilaren ibilbideekin lotuko ditu. + Hautatu nabigazio profila + Gehitu ibilbide-puntuak + Gehitu lerroa + Gehitu eta grabatu lorratzak + Grabatu edo inportatu lorratzak ikusteko + Gehitu gogokoak + Gehitu gogokoak mapan edo inportatu hauek fitxategi sistematik + Inportatu lorratza + %1$s fitxategiak ez du bide-punturik, inportatu lorratz gisa? + Mugitu puntua + Gehitu GPX lorratzera + diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 3f4bbf0c60..7aa59b78c1 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2897,4 +2897,9 @@ Copertura e qualità approssimativamente: Salva il Punto Percorso Punto Percorso 1 Aggiungi e registra Tracce + Sposta tutto nella cronologia + Costruisci un percorso + Mostra la direzione + Ordina per + Opzioni marcatori diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 2db8eb449a..dd286f94fb 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -1775,8 +1775,8 @@ Ruteutregning Utseende Pause - OsMo-tjenester kjører - Merknader + OsMo-tjeneste kjører + Varsler Fortsett Pause Tur @@ -2363,10 +2363,11 @@ Representerer området: %1$s x %2$s Tid i bevegelse Varighet Maks. - Velg høydesvingninger + Velg preferanse for høydeforskjeller Flytt alle til historikk Lag rute Vis retning Sorter etter Markøralternativer + I pausemodus diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 487db75de8..ba52304302 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -2831,8 +2831,8 @@ Reprezentuje obszar: %1$s x %2$s Plik %1$s nie zawiera punktów trasy, czy zaimportować go jako ślad? Przesuń punkt Dodaj do śladu GPX -Wciąż wyświetlaj na mapie - Czy wyjść bez zapisywania? +Wyświetlanie na mapie + Zakończyć bez zapisywania? Wyłącz animacje Wyłącza animacje w programie Przenieś wszystkie do historii diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 8ea195ee90..c748d2d941 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -505,7 +505,7 @@ Турагентство Место с хорошим видом Место для лагеря - Место для ночлега + Ночлег Место для пикника Родник Кладбище diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 8efe65f88b..d1786e6d68 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -2472,4 +2472,20 @@ Прозрачно-розовый Берберский язык Переместить все в историю + Сортировать по + Параметры маркера + Не использовать анимацию + Отключение анимации в приложении + Выйти без сохранения? + Сохранить как точки маршрута + Сохранить как линию + Точка маршрута + Редактировать линию + Добавить точку перед + Добавить точку после + Параметры + OsmAnd соединит точки с маршрутом для выбранного профиля. + Вы можете сохранить точки, как точки маршрута или как линию. + Выберите профиль навигации + %1$d из %2$d diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index ab41e69dbc..199d151b92 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -494,7 +494,7 @@ Zvuk zapnutý Zvuk vypnutý Výber hlasových údajov pre navigáciu - Hlasové údaje + Hlasové pokyny Inicializácia hlasových údajov… Nepodporovaná verzia hlasových údajov Vybrané hlasové údaje sú poškodené @@ -2857,4 +2857,9 @@ Zodpovedá oblasti: %1$s x %2$s Vypne animácie v aplikácii Zobrazovať ďalej na mape Ukončiť bez uloženia? + Presunúť všetko do histórie + Zostaviť trasu + Zobraziť smer + Zotriediť podľa + Možnosti značiek diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml index 592996971d..fa0a91fa47 100644 --- a/OsmAnd/res/values-sr/strings.xml +++ b/OsmAnd/res/values-sr/strings.xml @@ -1,4 +1,5 @@ - + + Верзија: Oko Верзија инфо, лиценце, чланови пројекта @@ -428,14 +429,14 @@ Македонски Прочитај више Шта је ново - Сакриј предложене предмете + Предложени објекти Освежи Отпреми Основна карта света (која покрива целу Земљу при погледу издалека) не постоји или је застарела. Молим, преузмите основну карту света за употпуњавање радне средине. КуР-ски код Карта је преузета Карта %1$s је преузета. Може да се вратите на карту и почнете да је користите. - Иди на карту + Прикажи карту Поставља заставицу која приказује прво покретање, све остале поставке оставља непромењеним Подражавај прво покретање програма Дели свој положај @@ -758,7 +759,7 @@ Омогући рад у позадини ГПИкс-а Уписуј путању у датотеку ГПИкс-а Праћење путање по захтеву - Избрисана ставка + Ставка уклоњена избрисане ставке ОПОЗОВИ СВЕ Врста @@ -791,7 +792,7 @@ "Почетно време: %1$tF, %1$tT " "Време завршетка: %1$tF, %1$tT " "Просечна брзина: %1$s " - "Највећа брзина: %1$s " + Највећа брзина: %1$s Просечна висина: %1$s Распон висине: %1$s Падина/успон: %1$s @@ -841,7 +842,7 @@ Име скупа Веза са уређајем Веза са скупом - Повежи се са + Придружи се Направи скуп Дејство услуге ОсМа није успело Надзор Опенстритмапа @@ -1069,7 +1070,7 @@ Стање Сачувај измене Адреса е-поште - Сакриј подземне предмете + Подземни објекти Нема доступних података Уклони Сазнајте више @@ -1111,9 +1112,9 @@ Образац боја линија обриса Најмања брзина бележења - Постави најмању брзину која ће бити бележена тачка - Препознавање покрета бележења - Постави најмање растојање од последњег положаја за бележење тачке + Филтер: Постави најмању брзину при којој ће тачка бити записана + Најмањи померај бележења + Филтер: Постави најмање растојање од последњег положаја за бележење тачке Најмања тачност бележења Постави најмању прецизност за бележење тачке Божићне тачке @@ -1145,7 +1146,7 @@ Добавите за %1$s Добавите за %1$s месечно Добавите неограничено преузимање и надоградње карата више пута месечно: седмично, дневно или часовно. - Пуно издање ОсмАнда са неограниченим преузимањем карата и месечним надоградњама карата. + Неограничена преузимања карти, надоградње, прикључак за Википедију. Миље/метри Прескочи преузимање карата Немате уграђених карата. Можете изабрати карту са списка или преузети карте касније преко Изборника - %1$s. @@ -1178,7 +1179,7 @@ Назад на претрагу Желите ли уклонити изабране ставке из историје? Прикажи на карти %1$s - " дељено преко ОсмАнда" + дељено преко ОсмАнда Врсте Поштански број из @@ -1307,7 +1308,7 @@ Средње Дебело Извештај - Кликните за преглед ЛБ-а пратиоца + Тапните за приказ ИД-а пратиоца Апликацији је сада дозвољен упис на спољно складиште. Неопходно је да ручно поново покренете апликацију. Тражи на растојању %1$s Помери навише @@ -1360,7 +1361,7 @@ Обрнут редослед Да ли желите да очистите историју ознака карата? Ознака карте - Препоручиво је да искључите приказ многоуглова + Препоручиво је да искључите приказ многоуглова. Приказуј многоуглове Пут је препречен Коњски путеви @@ -1389,7 +1390,7 @@ Препокрени претрагу Повећај област претраге Нема ничег пронађеног :( - Покушајте преправити упит претраге или увећајте област претраге + Преправите упит претраге или увећајте област претраге Приказ/скривање белешки ОСМ-а Прикажи белешке ОСМ-а Сакриј белешке ОСМ-а @@ -1415,8 +1416,8 @@ Изаберите поштански број Укључити/искључити самостално увећање карте Тапкање на дугмету радње ће укључити/искључити самоувећање карте према брзини кретања. - Самоувећање карте укључи - Самоувећање карте искључи + Укључи самоувећање карте + Искључи самоувећање карте Додај одредиште Замени одредиште Тапкање на дугме радње ће додати одредиште на средишњи положај екрана. Претходно постављено одредиште ће постати последња међутачка. @@ -1436,15 +1437,15 @@ Не шаљи безимене податке о коришћеном програму Османд прикупља податке о томе које делове програма отварате. Ваш положај се не шаље, нити ишта што унесете у програм нити појединости о областима које видите, тражите или преузмете. Не приказуј поруке при покретању - Приказује попусте у програму и нарочите месне поруке догађаја + Потискује приказ попуста у програму и посебне месне поруке догађаја Могућности паркирања Хвала Вам за куповину пуног издања Османда! Брдовито Мање брдовито Равно - Брзина + Краће руте Уравнотежено - Безбедност + Преферирај споредне Омиљени терен: равно или брдовито Нагиб Додај нови омот @@ -1453,7 +1454,7 @@ Број скретања на овом путу Истакнуте тачке на овом путу Стазе - Највећа дозвољена брзина + Највећа брзина Просечна брзина Време кретања Временски распон @@ -1477,4 +1478,4 @@ Приказуј обрисе и тачке дубине Обриси поморске дубине Заустављено - \ No newline at end of file + diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index f98fb06e01..7fe6f3392a 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -549,7 +549,7 @@ Звук увімкнено Звук вимкнено Виберіть голосові вказівки для навігації - Голосові дані + Голосові настанови Ініціалізуються голосові дані… Голосові дані не підтримуються поточною версією програми Голосові дані неправильного формату або пошкоджені @@ -1179,7 +1179,7 @@ Очистити всі точки Відкрити збережений GPX - Відмінити маршрут + Відхилити маршрут Шукати в навколишніх містах Проміжні точки впорядковано оптимальним чином від поточної до кінцевої. Впорядкувати за відстанню @@ -1524,7 +1524,7 @@ Європа - Великобританія Розрахувати ділянку маршруту OsmAnd без Інтернету Обчислити маршрут OsmAnd для першого та останнього сегментів маршруту - Бажаєте використовувати показаний трек для навігації? + Чи Ви хочете використовувати відображення треку для навігації? Додати як наступний пункт призначення Обрати GPX… Виберіть пункт призначення @@ -1592,7 +1592,7 @@ Місце призначення Голосові підказки призупиняють музику, а не лише зменшують гучність - Пауза музики + Призупинити музику Поділитись маршрутом за допомоги файлу GPX Маршрут наданий через OsmAnd Оголошення прибуття @@ -1748,7 +1748,7 @@ Моя позиція - Почати навігацію по треку? + Почати навігацію уздовж треку? Ви можете вибрати альтернативний маршрут, вибравши дороги, які варто уникати Пішохідні переходи @@ -2261,7 +2261,7 @@ Панель інструментів Віджети - Інші позначки + Інші маркери Недостатньо пам\'яті! Необхідно {3} МБ тимчасової та {1} МБ постійної пам\'яті. На разі доступно лише {2} МБ. @@ -2744,7 +2744,7 @@ Переважний рельєф: рівнинний або гористий Вибрати пересіченість місцевості Призупинено - Можливо, буде потрібно дуже багато часу для локального (оффлайн) розрахунку маршруту. Будь ласка, додайте один або більше проміжних пунктів на маршруті, якщо розрахунок не завершений через 10 чи більше хвилин. + Цей маршрут може бути надто довгим для розрахунку. Будь ласка, додайте проміжні пункти призначення, якщо протягом 10 хвилин не знайдено жодного результату. "OsmAnd (OSM Автоматична Навігація До цілі) — застосунок для мап і навігації з доступом до безкоштовних високоякісних глобальних даних OpenStreetMap (OSM). \n \nНасолоджуйтесь голосовою та візуальною навігацією, переглядайте цікаві точки (англ. POI), створюйте та керуйте GPX-треками, переглядайте контурні лінії та дані про висоту (за допомогою зовнішнього втулка), перемикайтеся між режимами автомобіліста, велосипедиста й пішохода, редагуйте OSM та ще багато цікавого." diff --git a/OsmAnd/src/net/osmand/plus/OsmandBackupAgent.java b/OsmAnd/src/net/osmand/plus/OsmandBackupAgent.java index 1b6cee8980..32b3b91122 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandBackupAgent.java +++ b/OsmAnd/src/net/osmand/plus/OsmandBackupAgent.java @@ -25,7 +25,7 @@ public class OsmandBackupAgent extends BackupAgentHelper { SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, prefs); addHelper("osmand.settings", helper); - FileBackupHelper fileBackupHelper = new FileBackupHelper(this, FavouritesDbHelper.FAVOURITE_DB_NAME); - addHelper("osmand.favorites", fileBackupHelper); + FileBackupHelper fileBackupHelper = new FileBackupHelper(this, FavouritesDbHelper.FILE_TO_BACKUP); + addHelper(FavouritesDbHelper.FILE_TO_BACKUP, fileBackupHelper); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index 66d8822c71..aff88e1662 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -30,7 +30,7 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.measurementtool.NewGpxData; import net.osmand.plus.myplaces.FavoritesActivity; -import net.osmand.plus.myplaces.SplitSegmentFragment; +import net.osmand.plus.myplaces.SplitSegmentDialogFragment; import net.osmand.plus.myplaces.TrackPointFragment; import net.osmand.plus.myplaces.TrackSegmentFragment; import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint; @@ -61,10 +61,6 @@ public class TrackActivity extends TabActivity { private boolean openPointsTab = false; private boolean openTracksList = false; - public PagerSlidingTabStrip getSlidingTabLayout() { - return slidingTabLayout; - } - @Override public void onCreate(Bundle icicle) { this.app = getMyApplication(); @@ -294,8 +290,8 @@ public class TrackActivity extends TabActivity { Fragment frag = f.get(); if (frag instanceof TrackSegmentFragment) { ((TrackSegmentFragment) frag).updateContent(); - } else if (frag instanceof SplitSegmentFragment) { - ((SplitSegmentFragment) frag).reloadSplitFragment(); + } else if (frag instanceof SplitSegmentDialogFragment) { + ((SplitSegmentDialogFragment) frag).updateContent(); } else if (frag instanceof TrackPointFragment) { ((TrackPointFragment) frag).setContent(); } @@ -348,23 +344,6 @@ public class TrackActivity extends TabActivity { int itemId = item.getItemId(); switch (itemId) { case android.R.id.home: - int backStackEntriesCount = getSupportFragmentManager().getBackStackEntryCount(); - if (backStackEntriesCount > 0) { - FragmentManager.BackStackEntry backStackEntry = getSupportFragmentManager().getBackStackEntryAt(getSupportFragmentManager().getBackStackEntryCount() - 1); - if (backStackEntry.getName().equals(SplitSegmentFragment.TAG)) { - for (WeakReference f : fragList) { - Fragment frag = f.get(); - if (frag instanceof TrackSegmentFragment) { - ((TrackSegmentFragment) frag).updateSplitView(); - } - } - getSupportFragmentManager().popBackStack(); - if (isHavingWayPoints() || isHavingRoutePoints()) { - getSlidingTabLayout().setVisibility(View.VISIBLE); - } - return true; - } - } if (getIntent().hasExtra(MapActivity.INTENT_KEY_PARENT_MAP_ACTIVITY) || openTracksList) { OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); final Intent favorites = new Intent(this, appCustomization.getFavoritesActivity()); @@ -379,25 +358,17 @@ public class TrackActivity extends TabActivity { return false; } - @Override - public void onBackPressed() { - int backStackEntriesCount = getSupportFragmentManager().getBackStackEntryCount(); - if (backStackEntriesCount > 0) { - FragmentManager.BackStackEntry backStackEntry = getSupportFragmentManager().getBackStackEntryAt(getSupportFragmentManager().getBackStackEntryCount() - 1); - if (backStackEntry.getName().equals(SplitSegmentFragment.TAG)) { - for (WeakReference f : fragList) { - Fragment frag = f.get(); - if (frag instanceof TrackSegmentFragment) { - ((TrackSegmentFragment) frag).updateSplitView(); - } - } - getSupportFragmentManager().popBackStack(); - if (isHavingWayPoints() || isHavingRoutePoints()) { - getSlidingTabLayout().setVisibility(View.VISIBLE); - } - return; + public void updateSplitView() { + for (WeakReference f : fragList) { + Fragment frag = f.get(); + if (frag instanceof TrackSegmentFragment) { + ((TrackSegmentFragment) frag).updateSplitView(); } } + } + + @Override + public void onBackPressed() { if (openTracksList) { OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization(); final Intent favorites = new Intent(this, appCustomization.getFavoritesActivity()); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java new file mode 100644 index 0000000000..29f545e7bb --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java @@ -0,0 +1,719 @@ +package net.osmand.plus.myplaces; + +import android.content.DialogInterface; +import android.content.res.ColorStateList; +import android.graphics.Paint; +import android.graphics.Rect; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; +import android.support.v7.app.ActionBar; +import android.support.v7.widget.ListPopupWindow; +import android.support.v7.widget.Toolbar; +import android.util.DisplayMetrics; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AbsListView; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import net.osmand.AndroidUtils; +import net.osmand.plus.GPXUtilities; +import net.osmand.plus.GPXUtilities.GPXTrackAnalysis; +import net.osmand.plus.GpxSelectionHelper; +import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; +import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; +import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; +import net.osmand.plus.IconsCache; +import net.osmand.plus.OsmAndFormatter; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.TrackActivity; +import net.osmand.plus.helpers.FontCache; +import net.osmand.util.Algorithms; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import gnu.trove.list.array.TIntArrayList; + +import static net.osmand.plus.myplaces.TrackSegmentFragment.ARG_TO_FILTER_SHORT_TRACKS; + +public class SplitSegmentDialogFragment extends DialogFragment { + + public final static String TAG = "SPLIT_SEGMENT_DIALOG_FRAGMENT"; + private OsmandApplication app; + + private SplitSegmentsAdapter adapter; + private View headerView; + + private GpxDisplayItemType[] filterTypes = {GpxDisplayItemType.TRACK_SEGMENT}; + private List options = new ArrayList<>(); + private List distanceSplit = new ArrayList<>(); + private TIntArrayList timeSplit = new TIntArrayList(); + private int selectedSplitInterval; + private IconsCache ic; + private int minMaxSpeedLayoutWidth; + private Paint minMaxSpeedPaint; + private Rect minMaxSpeedTextBounds; + private ListView listView; + private ProgressBar progressBar; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + app = getMyApplication(); + ic = app.getIconsCache(); + boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME; + int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme; + setStyle(STYLE_NO_FRAME, themeId); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + listView.setBackgroundColor(getResources().getColor( + getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light + : R.color.ctx_menu_info_view_bg_dark)); + getTrackActivity().onAttachFragment(this); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + minMaxSpeedPaint = new Paint(); + minMaxSpeedPaint.setTextSize(getResources().getDimension(R.dimen.default_split_segments_data)); + minMaxSpeedPaint.setTypeface(FontCache.getFont(getContext(), "fonts/Roboto-Medium.ttf")); + minMaxSpeedPaint.setStyle(Paint.Style.FILL); + minMaxSpeedTextBounds = new Rect(); + + final View view = getActivity().getLayoutInflater().inflate(R.layout.split_segments_layout, container, false); + + Toolbar toolbar = (Toolbar) view.findViewById(R.id.split_interval_toolbar); + TextView titleTextView = (TextView) toolbar.findViewById(R.id.title); + if (app.getSettings().isLightContent()) { + titleTextView.setTextAppearance(getContext(), R.style.Widget_Styled_LightActionBarHeader); + } else { + titleTextView.setTextAppearance(getContext(), R.style.TextAppearance_AppCompat_Widget_ActionBar_Title); + } + ActionBar trackActivityActionBar = getTrackActivity().getSupportActionBar(); + if (trackActivityActionBar != null) { + titleTextView.setText(trackActivityActionBar.getTitle()); + } + toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back)); + toolbar.setNavigationOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + + progressBar = view.findViewById(R.id.progress_bar); + + listView = (ListView) view.findViewById(R.id.list); + listView.setDivider(null); + listView.setDividerHeight(0); + + adapter = new SplitSegmentsAdapter(new ArrayList()); + headerView = view.findViewById(R.id.header_layout); + ((ImageView) headerView.findViewById(R.id.header_split_image)).setImageDrawable(ic.getIcon(R.drawable.ic_action_split_interval, app.getSettings().isLightContent() ? R.color.icon_color : 0)); + + listView.addHeaderView(getActivity().getLayoutInflater().inflate(R.layout.gpx_split_segments_empty_header, null, false)); + listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false)); + + listView.setOnScrollListener(new AbsListView.OnScrollListener() { + int previousYPos = -1; + + @Override + public void onScrollStateChanged(AbsListView absListView, int i) { + if (i == SCROLL_STATE_IDLE) { + previousYPos = -1; + } + } + + @Override + public void onScroll(AbsListView absListView, int i, int i1, int i2) { + View c = absListView.getChildAt(0); + if (c != null) { + int currentYPos = -c.getTop() + absListView.getFirstVisiblePosition() * c.getHeight(); + if (previousYPos == -1) { + previousYPos = currentYPos; + } + + float yTranslationToSet = headerView.getTranslationY() + (previousYPos - currentYPos); + if (yTranslationToSet < 0 && yTranslationToSet > -headerView.getHeight()) { + headerView.setTranslationY(yTranslationToSet); + } else if (yTranslationToSet < -headerView.getHeight()) { + headerView.setTranslationY(-headerView.getHeight()); + } else if (yTranslationToSet > 0) { + headerView.setTranslationY(0); + } + + previousYPos = currentYPos; + } + } + }); + + listView.setAdapter(adapter); + + return view; + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + updateContent(); + } + + private void updateHeader() { + final View splitIntervalView = headerView.findViewById(R.id.split_interval_view); + + if (getGpx() != null && !getGpx().showCurrentTrack && adapter.getCount() > 0) { + setupSplitIntervalView(splitIntervalView); + if (options.size() == 0) { + prepareSplitIntervalAdapterData(); + } + updateSplitIntervalView(splitIntervalView); + splitIntervalView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final ListPopupWindow popup = new ListPopupWindow(getActivity()); + popup.setAnchorView(splitIntervalView); + popup.setContentWidth(AndroidUtils.dpToPx(app, 200f)); + popup.setModal(true); + popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP); + popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f)); + popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f)); + popup.setAdapter(new ArrayAdapter<>(getTrackActivity(), + R.layout.popup_list_text_item, options)); + popup.setOnItemClickListener(new AdapterView.OnItemClickListener() { + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + selectedSplitInterval = position; + GpxSelectionHelper.SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), true, false); + final List groups = getDisplayGroups(); + if (groups.size() > 0) { + updateSplit(groups, sf); + } + popup.dismiss(); + updateSplitIntervalView(splitIntervalView); + } + }); + popup.show(); + } + }); + splitIntervalView.setVisibility(View.VISIBLE); + } else { + splitIntervalView.setVisibility(View.GONE); + } + } + + public void updateContent() { + if (getTrackActivity() != null) { + adapter.clear(); + adapter.setNotifyOnChange(false); + GpxDisplayItem overviewSegments = getOverviewSegment(); + adapter.add(overviewSegments); + List splitSegments = getSplitSegments(); + adapter.addAll(splitSegments); + adapter.notifyDataSetChanged(); + listView.setSelection(0); + headerView.setTranslationY(0); + updateHeader(); + } + } + + private void updateSplit(List groups, GpxSelectionHelper.SelectedGpxFile sf) { + new SplitTrackAsyncTask(sf, groups).execute((Void) null); + } + + private void setupSplitIntervalView(View view) { + final TextView title = (TextView) view.findViewById(R.id.split_interval_title); + final TextView text = (TextView) view.findViewById(R.id.split_interval_text); + final ImageView img = (ImageView) view.findViewById(R.id.split_interval_arrow); + int colorId; + final List groups = getDisplayGroups(); + if (groups.size() > 0) { + colorId = app.getSettings().isLightContent() ? + R.color.primary_text_light : R.color.primary_text_dark; + } else { + colorId = app.getSettings().isLightContent() ? + R.color.secondary_text_light : R.color.secondary_text_dark; + } + int color = app.getResources().getColor(colorId); + title.setTextColor(color); + text.setTextColor(color); + img.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, colorId)); + } + + private void updateSplitIntervalView(View view) { + final TextView text = (TextView) view.findViewById(R.id.split_interval_text); + if (selectedSplitInterval == 0) { + text.setText(getString(R.string.shared_string_none)); + } else { + text.setText(options.get(selectedSplitInterval)); + } + } + + private GPXUtilities.GPXFile getGpx() { + return getTrackActivity().getGpx(); + } + + public TrackActivity getTrackActivity() { + return (TrackActivity) getActivity(); + } + + private void prepareSplitIntervalAdapterData() { + final List groups = getDisplayGroups(); + + options.add(app.getString(R.string.shared_string_none)); + distanceSplit.add(-1d); + timeSplit.add(-1); + addOptionSplit(30, true, groups); // 50 feet, 20 yards, 20 + // m + addOptionSplit(60, true, groups); // 100 feet, 50 yards, + // 50 m + addOptionSplit(150, true, groups); // 200 feet, 100 yards, + // 100 m + addOptionSplit(300, true, groups); // 500 feet, 200 yards, + // 200 m + addOptionSplit(600, true, groups); // 1000 feet, 500 yards, + // 500 m + addOptionSplit(1500, true, groups); // 2000 feet, 1000 yards, 1 km + addOptionSplit(3000, true, groups); // 1 mi, 2 km + addOptionSplit(6000, true, groups); // 2 mi, 5 km + addOptionSplit(15000, true, groups); // 5 mi, 10 km + + addOptionSplit(15, false, groups); + addOptionSplit(30, false, groups); + addOptionSplit(60, false, groups); + addOptionSplit(120, false, groups); + addOptionSplit(150, false, groups); + addOptionSplit(300, false, groups); + addOptionSplit(600, false, groups); + addOptionSplit(900, false, groups); + addOptionSplit(1800, false, groups); + addOptionSplit(3600, false, groups); + } + + private List getDisplayGroups() { + return filterGroups(true); + } + + private void addOptionSplit(int value, boolean distance, List model) { + if (distance) { + double dvalue = OsmAndFormatter.calculateRoundedDist(value, app); + options.add(OsmAndFormatter.getFormattedDistance((float) dvalue, app)); + distanceSplit.add(dvalue); + timeSplit.add(-1); + if (Math.abs(model.get(0).getSplitDistance() - dvalue) < 1) { + selectedSplitInterval = distanceSplit.size() - 1; + } + } else { + if (value < 60) { + options.add(value + " " + app.getString(R.string.int_seconds)); + } else if (value % 60 == 0) { + options.add((value / 60) + " " + app.getString(R.string.int_min)); + } else { + options.add((value / 60f) + " " + app.getString(R.string.int_min)); + } + distanceSplit.add(-1d); + timeSplit.add(value); + if (model.get(0).getSplitTime() == value) { + selectedSplitInterval = distanceSplit.size() - 1; + } + } + } + + private List filterGroups(boolean useDisplayGroups) { + List groups = new ArrayList<>(); + if (getTrackActivity() != null) { + List result = getTrackActivity().getGpxFile(useDisplayGroups); + for (GpxDisplayGroup group : result) { + boolean add = hasFilterType(group.getType()); + if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) { + Iterator item = group.getModifiableList().iterator(); + while (item.hasNext()) { + GpxDisplayItem it2 = item.next(); + if (it2.analysis != null && it2.analysis.totalDistance < 100) { + item.remove(); + } + } + if (group.getModifiableList().isEmpty()) { + add = false; + } + } + if (add) { + groups.add(group); + } + + } + } + return groups; + } + + private List getSplitSegments() { + List result = getTrackActivity().getGpxFile(true); + List splitSegments = new ArrayList<>(); + if (result != null && result.size() > 0) { + if (result.get(0).isSplitDistance() || result.get(0).isSplitTime()) { + splitSegments.addAll(result.get(0).getModifiableList()); + } + } + return splitSegments; + } + + private GpxDisplayItem getOverviewSegment() { + List result = getTrackActivity().getGpxFile(false); + GpxDisplayItem overviewSegment = null; + if (result.size() > 0) { + overviewSegment = result.get(0).getModifiableList().get(0); + } + return overviewSegment; + } + + private boolean isArgumentTrue(@NonNull String arg) { + return getArguments() != null && getArguments().getBoolean(arg); + } + + protected boolean hasFilterType(GpxDisplayItemType filterType) { + for (GpxDisplayItemType type : filterTypes) { + if (type == filterType) { + return true; + } + } + return false; + } + + @Override + public void dismiss() { + getTrackActivity().updateSplitView(); + super.dismiss(); + } + + @Override + public void onCancel(DialogInterface dialog) { + getTrackActivity().updateSplitView(); + super.onCancel(dialog); + } + + private class SplitSegmentsAdapter extends ArrayAdapter { + + SplitSegmentsAdapter(List items) { + super(getActivity(), 0, items); + } + + ColorStateList defaultTextColor; + + @NonNull + @Override + public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + GpxDisplayItem currentGpxDisplayItem = getItem(position); + if (convertView == null) { + convertView = getTrackActivity().getLayoutInflater().inflate(R.layout.gpx_split_segment_fragment, parent, false); + } + convertView.setOnClickListener(null); + TextView overviewTextView = (TextView) convertView.findViewById(R.id.overview_text); + ImageView overviewImageView = (ImageView) convertView.findViewById(R.id.overview_image); + if (position == 0) { + overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + if (defaultTextColor == null) { + defaultTextColor = overviewTextView.getTextColors(); + } + overviewTextView.setTextColor(defaultTextColor); + overviewTextView.setText(app.getString(R.string.shared_string_overview)); + if (currentGpxDisplayItem != null) { + ((TextView) convertView.findViewById(R.id.fragment_count_text)).setText(app.getString(R.string.shared_string_time_span) + ": " + Algorithms.formatDuration((int) (currentGpxDisplayItem.analysis.timeSpan / 1000), app.accessibilityEnabled())); + } + } else { + if (currentGpxDisplayItem != null && currentGpxDisplayItem.analysis != null) { + overviewTextView.setTextColor(app.getSettings().isLightContent() ? app.getResources().getColor(R.color.gpx_split_overview_light) : app.getResources().getColor(R.color.gpx_split_overview_dark)); + if (currentGpxDisplayItem.group.isSplitDistance()) { + overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_overview_light : R.color.gpx_split_overview_dark)); + overviewTextView.setText(""); + double metricStart = currentGpxDisplayItem.analysis.metricEnd - currentGpxDisplayItem.analysis.totalDistance; + overviewTextView.append(OsmAndFormatter.getFormattedDistance((float) metricStart, app)); + overviewTextView.append(" - "); + overviewTextView.append(OsmAndFormatter.getFormattedDistance((float) currentGpxDisplayItem.analysis.metricEnd, app)); + } else if (currentGpxDisplayItem.group.isSplitTime()) { + overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_overview_light : R.color.gpx_split_overview_dark)); + overviewTextView.setText(""); + double metricStart = currentGpxDisplayItem.analysis.metricEnd - (currentGpxDisplayItem.analysis.timeSpan / 1000); + overviewTextView.append(OsmAndFormatter.getFormattedDuration((int) metricStart, app)); + overviewTextView.append(" - "); + overviewTextView.append(OsmAndFormatter.getFormattedDuration((int) currentGpxDisplayItem.analysis.metricEnd, app)); + } + ((TextView) convertView.findViewById(R.id.fragment_count_text)).setText(app.getString(R.string.of, position, adapter.getCount() - 1)); + } + } + + ((ImageView) convertView.findViewById(R.id.start_time_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_start_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.end_time_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_end_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.average_altitude_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_average_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.altitude_range_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_range_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.ascent_descent_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_descent_ascent_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.moving_time_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_moving_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.average_speed_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_speed_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + ((ImageView) convertView.findViewById(R.id.max_speed_image)) + .setImageDrawable(ic.getIcon(R.drawable.ic_action_max_speed_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + + if (currentGpxDisplayItem != null) { + GPXTrackAnalysis analysis = currentGpxDisplayItem.analysis; + if (analysis != null) { + ImageView distanceOrTimeSpanImageView = ((ImageView) convertView.findViewById(R.id.distance_or_timespan_image)); + TextView distanceOrTimeSpanValue = (TextView) convertView.findViewById(R.id.distance_or_time_span_value); + TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text); + if (position == 0) { + distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); + distanceOrTimeSpanText.setText(app.getString(R.string.distance)); + } else { + if (currentGpxDisplayItem.group.isSplitDistance()) { + distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + if (analysis.timeSpan > 0) { + distanceOrTimeSpanValue.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled())); + } else { + distanceOrTimeSpanValue.setText("-"); + } + distanceOrTimeSpanText.setText(app.getString(R.string.shared_string_time_span)); + } else if (currentGpxDisplayItem.group.isSplitTime()) { + distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); + distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); + distanceOrTimeSpanText.setText(app.getString(R.string.distance)); + } + } + + TextView startTimeValue = (TextView) convertView.findViewById(R.id.start_time_value); + TextView startDateValue = (TextView) convertView.findViewById(R.id.start_date_value); + TextView endTimeValue = (TextView) convertView.findViewById(R.id.end_time_value); + TextView endDateValue = (TextView) convertView.findViewById(R.id.end_date_value); + if (analysis.timeSpan > 0) { + DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT); + DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM); + + Date start = new Date(analysis.startTime); + startTimeValue.setText(tf.format(start)); + startDateValue.setText(df.format(start)); + + Date end = new Date(analysis.endTime); + endTimeValue.setText(tf.format(end)); + endDateValue.setText(df.format(end)); + } else { + startTimeValue.setText("-"); + startDateValue.setText("-"); + endTimeValue.setText("-"); + endDateValue.setText("-"); + } + + View elevationDivider = convertView.findViewById(R.id.elevation_divider); + View elevationSection = convertView.findViewById(R.id.elevation_layout); + if (analysis.hasElevationData) { + elevationDivider.setVisibility(View.VISIBLE); + elevationSection.setVisibility(View.VISIBLE); + + ((TextView) convertView.findViewById(R.id.average_altitude_value)) + .setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app)); + + String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); + String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); + String min_max_elevation = min.substring(0, min.indexOf(" ")).concat("/").concat(max); + if (min_max_elevation.length() > 9) { + (convertView.findViewById(R.id.min_altitude_value)) + .setVisibility(View.VISIBLE); + (convertView.findViewById(R.id.max_altitude_value)) + .setVisibility(View.VISIBLE); + ((TextView) convertView.findViewById(R.id.min_altitude_value)) + .setText(min); + ((TextView) convertView.findViewById(R.id.max_altitude_value)) + .setText(max); + (convertView.findViewById(R.id.min_max_altitude_value)) + .setVisibility(View.GONE); + } else { + (convertView.findViewById(R.id.min_max_altitude_value)) + .setVisibility(View.VISIBLE); + ((TextView) convertView.findViewById(R.id.min_max_altitude_value)) + .setText(min_max_elevation); + (convertView.findViewById(R.id.min_altitude_value)) + .setVisibility(View.GONE); + (convertView.findViewById(R.id.max_altitude_value)) + .setVisibility(View.GONE); + } + + TextView ascentValue = (TextView) convertView.findViewById(R.id.ascent_value); + TextView descentValue = (TextView) convertView.findViewById(R.id.descent_value); + TextView ascentDescentValue = (TextView) convertView.findViewById(R.id.ascent_descent_value); + + String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); + String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); + String asc_desc = asc.substring(0, asc.indexOf(" ")).concat("/").concat(desc); + if (asc_desc.length() > 9) { + ascentValue.setVisibility(View.VISIBLE); + descentValue.setVisibility(View.VISIBLE); + ascentValue.setText(asc); + descentValue.setText(desc); + ascentDescentValue.setVisibility(View.GONE); + } else { + ascentDescentValue.setVisibility(View.VISIBLE); + ascentDescentValue.setText(asc_desc); + ascentValue.setVisibility(View.GONE); + descentValue.setVisibility(View.GONE); + } + + } else { + elevationDivider.setVisibility(View.GONE); + elevationSection.setVisibility(View.GONE); + } + + View speedDivider = convertView.findViewById(R.id.speed_divider); + View speedSection = convertView.findViewById(R.id.speed_layout); + if (analysis.hasSpeedData) { + speedDivider.setVisibility(View.VISIBLE); + speedSection.setVisibility(View.VISIBLE); + + ((TextView) convertView.findViewById(R.id.moving_time_value)) + .setText(Algorithms.formatDuration((int) (analysis.timeMoving / 1000), app.accessibilityEnabled())); + ((TextView) convertView.findViewById(R.id.average_speed_value)) + .setText(OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app)); + + String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app); + String minSpeed = OsmAndFormatter.getFormattedSpeed(analysis.minSpeed, app); + String maxMinSpeed; + if (maxSpeed.contains(" ")) { + maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf(" ")).concat("/").concat(minSpeed); + } else { + maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf("-")).concat("/").concat(minSpeed); + } + + if (minMaxSpeedLayoutWidth == 0) { + DisplayMetrics metrics = new DisplayMetrics(); + getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); + int screenWidth = metrics.widthPixels; + int widthWithoutSidePadding = screenWidth - AndroidUtils.dpToPx(getActivity(), 32); + int singleLayoutWidth = widthWithoutSidePadding / 3; + int twoLayouts = 2 * (singleLayoutWidth + AndroidUtils.dpToPx(getActivity(), 3)); + minMaxSpeedLayoutWidth = widthWithoutSidePadding - twoLayouts - AndroidUtils.dpToPx(getActivity(), 28); + } + + minMaxSpeedPaint.getTextBounds(maxMinSpeed, 0, maxMinSpeed.length(), minMaxSpeedTextBounds); + int minMaxStringWidth = minMaxSpeedTextBounds.width(); + + if (analysis.minSpeed == 0) { + (convertView.findViewById(R.id.max_speed_value)) + .setVisibility(View.VISIBLE); + (convertView.findViewById(R.id.min_speed_value)) + .setVisibility(View.GONE); + ((TextView) convertView.findViewById(R.id.max_speed_value)) + .setText(maxSpeed); + (convertView.findViewById(R.id.max_min_speed_value)) + .setVisibility(View.GONE); + ((TextView) convertView.findViewById(R.id.max_min_speed_text)) + .setText(app.getString(R.string.shared_string_max)); + } else if (minMaxStringWidth > minMaxSpeedLayoutWidth) { + (convertView.findViewById(R.id.max_speed_value)) + .setVisibility(View.VISIBLE); + (convertView.findViewById(R.id.min_speed_value)) + .setVisibility(View.VISIBLE); + ((TextView) convertView.findViewById(R.id.max_speed_value)) + .setText(maxSpeed); + ((TextView) convertView.findViewById(R.id.min_speed_value)) + .setText(minSpeed); + (convertView.findViewById(R.id.max_min_speed_value)) + .setVisibility(View.GONE); + ((TextView) convertView.findViewById(R.id.max_min_speed_text)) + .setText(app.getString(R.string.max_min)); + } else { + (convertView.findViewById(R.id.max_min_speed_value)) + .setVisibility(View.VISIBLE); + ((TextView) convertView.findViewById(R.id.max_min_speed_value)) + .setText(maxMinSpeed); + (convertView.findViewById(R.id.max_speed_value)) + .setVisibility(View.GONE); + (convertView.findViewById(R.id.min_speed_value)) + .setVisibility(View.GONE); + ((TextView) convertView.findViewById(R.id.max_min_speed_text)) + .setText(app.getString(R.string.max_min)); + } + } else { + speedDivider.setVisibility(View.GONE); + speedSection.setVisibility(View.GONE); + } + } + } + return convertView; + } + } + + private class SplitTrackAsyncTask extends AsyncTask { + @Nullable + private final GpxSelectionHelper.SelectedGpxFile mSelectedGpxFile; + + private final List groups; + + SplitTrackAsyncTask(@Nullable GpxSelectionHelper.SelectedGpxFile selectedGpxFile, List groups) { + mSelectedGpxFile = selectedGpxFile; + this.groups = groups; + } + + protected void onPreExecute() { + progressBar.setVisibility(View.VISIBLE); + } + + protected void onPostExecute(Void result) { + progressBar.setVisibility(View.GONE); + if (mSelectedGpxFile != null) { + List groups = getDisplayGroups(); + mSelectedGpxFile.setDisplayGroups(groups); + } + updateContent(); + } + + @Override + protected Void doInBackground(Void... params) { + for (GpxDisplayGroup model : groups) { + if (selectedSplitInterval == 0) { + model.noSplit(app); + } else if (distanceSplit.get(selectedSplitInterval) > 0) { + model.splitByDistance(app, distanceSplit.get(selectedSplitInterval)); + } else if (timeSplit.get(selectedSplitInterval) > 0) { + model.splitByTime(app, timeSplit.get(selectedSplitInterval)); + } + } + + return null; + } + } + + private OsmandApplication getMyApplication() { + return (OsmandApplication) getActivity().getApplication(); + } + + public static boolean showInstance(TrackActivity trackActivity) { + try { + SplitSegmentDialogFragment fragment = new SplitSegmentDialogFragment(); + fragment.show(trackActivity.getSupportFragmentManager(), TAG); + return true; + } catch (RuntimeException e) { + return false; + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentFragment.java deleted file mode 100644 index 9edec0db4a..0000000000 --- a/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentFragment.java +++ /dev/null @@ -1,690 +0,0 @@ -package net.osmand.plus.myplaces; - -import android.content.res.ColorStateList; -import android.graphics.Paint; -import android.graphics.Rect; -import android.os.AsyncTask; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.widget.ListPopupWindow; -import android.util.DisplayMetrics; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AbsListView; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; - -import net.osmand.AndroidUtils; -import net.osmand.plus.GPXUtilities; -import net.osmand.plus.GPXUtilities.GPXTrackAnalysis; -import net.osmand.plus.GpxSelectionHelper; -import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; -import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; -import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; -import net.osmand.plus.IconsCache; -import net.osmand.plus.OsmAndFormatter; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.R; -import net.osmand.plus.activities.TrackActivity; -import net.osmand.plus.base.OsmAndListFragment; -import net.osmand.plus.helpers.FontCache; -import net.osmand.util.Algorithms; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import gnu.trove.list.array.TIntArrayList; - -import static net.osmand.plus.myplaces.TrackSegmentFragment.ARG_TO_FILTER_SHORT_TRACKS; - -public class SplitSegmentFragment extends OsmAndListFragment { - - public final static String TAG = "SPLIT_SEGMENT_FRAGMENT"; - private OsmandApplication app; - - private SplitSegmentsAdapter adapter; - private View headerView; - - private GpxDisplayItemType[] filterTypes = { GpxDisplayItemType.TRACK_SEGMENT }; - private List options = new ArrayList<>(); - private List distanceSplit = new ArrayList<>(); - private TIntArrayList timeSplit = new TIntArrayList(); - private int selectedSplitInterval; - private IconsCache ic; - private int minMaxSpeedLayoutWidth; - private Paint minMaxSpeedPaint; - private Rect minMaxSpeedTextBounds; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - app = getMyApplication(); - ic = app.getIconsCache(); - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - updateContent(); - // Obsolete: updateHeader(); - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - getListView().setBackgroundColor(getResources().getColor( - getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light - : R.color.ctx_menu_info_view_bg_dark)); - getTrackActivity().onAttachFragment(this); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.clear(); - getTrackActivity().getClearToolbar(false); - } - - @Override - public ArrayAdapter getAdapter() { - return adapter; - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - setHasOptionsMenu(true); - - minMaxSpeedPaint = new Paint(); - minMaxSpeedPaint.setTextSize(getResources().getDimension(R.dimen.default_split_segments_data)); - minMaxSpeedPaint.setTypeface(FontCache.getFont(getContext(), "fonts/Roboto-Medium.ttf")); - minMaxSpeedPaint.setStyle(Paint.Style.FILL); - minMaxSpeedTextBounds = new Rect(); - - final View view = getActivity().getLayoutInflater().inflate(R.layout.split_segments_layout, container, false); - - final ListView listView = (ListView) view.findViewById(android.R.id.list); - listView.setDivider(null); - listView.setDividerHeight(0); - - adapter = new SplitSegmentsAdapter(new ArrayList()); - headerView = view.findViewById(R.id.header_layout); - ((ImageView) headerView.findViewById(R.id.header_split_image)).setImageDrawable(ic.getIcon(R.drawable.ic_action_split_interval, app.getSettings().isLightContent() ? R.color.icon_color : 0)); - - listView.addHeaderView(getActivity().getLayoutInflater().inflate(R.layout.gpx_split_segments_empty_header, null, false)); - listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false)); - - setListAdapter(adapter); - - listView.setOnScrollListener(new AbsListView.OnScrollListener() { - int previousYPos = -1; - - @Override - public void onScrollStateChanged(AbsListView absListView, int i) { - if (i == SCROLL_STATE_IDLE) { - previousYPos = -1; - } - } - - @Override - public void onScroll(AbsListView absListView, int i, int i1, int i2) { - View c = absListView.getChildAt(0); - if (c != null) { - int currentYPos = -c.getTop() + absListView.getFirstVisiblePosition() * c.getHeight(); - if (previousYPos == -1) { - previousYPos = currentYPos; - } - - float yTranslationToSet = headerView.getTranslationY() + (previousYPos - currentYPos); - if (yTranslationToSet < 0 && yTranslationToSet > -headerView.getHeight()) { - headerView.setTranslationY(yTranslationToSet); - } else if (yTranslationToSet < -headerView.getHeight()) { - headerView.setTranslationY(-headerView.getHeight()); - } else if (yTranslationToSet > 0) { - headerView.setTranslationY(0); - } - - previousYPos = currentYPos; - } - } - }); - - return view; - } - - private void updateHeader() { - final View splitIntervalView = headerView.findViewById(R.id.split_interval_view); - - if (getGpx() != null && !getGpx().showCurrentTrack && adapter.getCount() > 0) { - setupSplitIntervalView(splitIntervalView); - if (options.size() == 0) { - prepareSplitIntervalAdapterData(); - } - updateSplitIntervalView(splitIntervalView); - splitIntervalView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - final ListPopupWindow popup = new ListPopupWindow(getActivity()); - popup.setAnchorView(splitIntervalView); - popup.setContentWidth(AndroidUtils.dpToPx(app, 200f)); - popup.setModal(true); - popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP); - popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f)); - popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f)); - popup.setAdapter(new ArrayAdapter<>(getTrackActivity(), - R.layout.popup_list_text_item, options)); - popup.setOnItemClickListener(new AdapterView.OnItemClickListener() { - - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - selectedSplitInterval = position; - GpxSelectionHelper.SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), true, false); - final List groups = getDisplayGroups(); - if (groups.size() > 0) { - updateSplit(groups, sf); - } - popup.dismiss(); - updateSplitIntervalView(splitIntervalView); - } - }); - popup.show(); - } - }); - splitIntervalView.setVisibility(View.VISIBLE); - } else { - splitIntervalView.setVisibility(View.GONE); - } - } - - public void updateContent() { - adapter.clear(); - adapter.setNotifyOnChange(false); - GpxDisplayItem overviewSegments = getOverviewSegment(); - adapter.add(overviewSegments); - List splitSegments = getSplitSegments(); - adapter.addAll(splitSegments); - // Obsolete: adapter.setNotifyOnChange(true); - adapter.notifyDataSetChanged(); - getListView().setSelection(0); - headerView.setTranslationY(0); - updateHeader(); - } - - private void updateSplit(List groups, GpxSelectionHelper.SelectedGpxFile sf) { - new SplitTrackAsyncTask(sf, groups).execute((Void) null); - } - - private void setupSplitIntervalView(View view) { - final TextView title = (TextView) view.findViewById(R.id.split_interval_title); - final TextView text = (TextView) view.findViewById(R.id.split_interval_text); - final ImageView img = (ImageView) view.findViewById(R.id.split_interval_arrow); - int colorId; - final List groups = getDisplayGroups(); - if (groups.size() > 0) { - colorId = app.getSettings().isLightContent() ? - R.color.primary_text_light : R.color.primary_text_dark; - } else { - colorId = app.getSettings().isLightContent() ? - R.color.secondary_text_light : R.color.secondary_text_dark; - } - int color = app.getResources().getColor(colorId); - title.setTextColor(color); - text.setTextColor(color); - img.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, colorId)); - } - - private void updateSplitIntervalView(View view) { - final TextView text = (TextView) view.findViewById(R.id.split_interval_text); - if (selectedSplitInterval == 0) { - text.setText(getString(R.string.shared_string_none)); - } else { - text.setText(options.get(selectedSplitInterval)); - } - } - - private GPXUtilities.GPXFile getGpx() { - return getTrackActivity().getGpx(); - } - - public TrackActivity getTrackActivity() { - return (TrackActivity) getActivity(); - } - - private void prepareSplitIntervalAdapterData() { - final List groups = getDisplayGroups(); - - options.add(app.getString(R.string.shared_string_none)); - distanceSplit.add(-1d); - timeSplit.add(-1); - addOptionSplit(30, true, groups); // 50 feet, 20 yards, 20 - // m - addOptionSplit(60, true, groups); // 100 feet, 50 yards, - // 50 m - addOptionSplit(150, true, groups); // 200 feet, 100 yards, - // 100 m - addOptionSplit(300, true, groups); // 500 feet, 200 yards, - // 200 m - addOptionSplit(600, true, groups); // 1000 feet, 500 yards, - // 500 m - addOptionSplit(1500, true, groups); // 2000 feet, 1000 yards, 1 km - addOptionSplit(3000, true, groups); // 1 mi, 2 km - addOptionSplit(6000, true, groups); // 2 mi, 5 km - addOptionSplit(15000, true, groups); // 5 mi, 10 km - - addOptionSplit(15, false, groups); - addOptionSplit(30, false, groups); - addOptionSplit(60, false, groups); - addOptionSplit(120, false, groups); - addOptionSplit(150, false, groups); - addOptionSplit(300, false, groups); - addOptionSplit(600, false, groups); - addOptionSplit(900, false, groups); - addOptionSplit(1800, false, groups); - addOptionSplit(3600, false, groups); - } - - private List getDisplayGroups() { - return filterGroups(true); - } - - private void addOptionSplit(int value, boolean distance, List model) { - if (distance) { - double dvalue = OsmAndFormatter.calculateRoundedDist(value, app); - options.add(OsmAndFormatter.getFormattedDistance((float) dvalue, app)); - distanceSplit.add(dvalue); - timeSplit.add(-1); - if (Math.abs(model.get(0).getSplitDistance() - dvalue) < 1) { - selectedSplitInterval = distanceSplit.size() - 1; - } - } else { - if (value < 60) { - options.add(value + " " + app.getString(R.string.int_seconds)); - } else if (value % 60 == 0) { - options.add((value / 60) + " " + app.getString(R.string.int_min)); - } else { - options.add((value / 60f) + " " + app.getString(R.string.int_min)); - } - distanceSplit.add(-1d); - timeSplit.add(value); - if (model.get(0).getSplitTime() == value) { - selectedSplitInterval = distanceSplit.size() - 1; - } - } - } - - private List filterGroups(boolean useDisplayGroups) { - List groups = new ArrayList<>(); - if (getTrackActivity() != null) { - List result = getTrackActivity().getGpxFile(useDisplayGroups); - for (GpxDisplayGroup group : result) { - boolean add = hasFilterType(group.getType()); - if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) { - Iterator item = group.getModifiableList().iterator(); - while (item.hasNext()) { - GpxDisplayItem it2 = item.next(); - if (it2.analysis != null && it2.analysis.totalDistance < 100) { - item.remove(); - } - } - if (group.getModifiableList().isEmpty()) { - add = false; - } - } - if (add) { - groups.add(group); - } - - } - } - return groups; - } - - private List getSplitSegments() { - List result = getTrackActivity().getGpxFile(true); - List splitSegments = new ArrayList<>(); - if (result != null && result.size() > 0) { - if (result.get(0).isSplitDistance() || result.get(0).isSplitTime()) { - splitSegments.addAll(result.get(0).getModifiableList()); - } - } - return splitSegments; - } - - private GpxDisplayItem getOverviewSegment() { - List result = getTrackActivity().getGpxFile(false); - GpxDisplayItem overviewSegment = null; - if (result.size() > 0) { - overviewSegment = result.get(0).getModifiableList().get(0); - } - return overviewSegment; - } - - private boolean isArgumentTrue(@NonNull String arg) { - return getArguments() != null && getArguments().getBoolean(arg); - } - - protected boolean hasFilterType(GpxDisplayItemType filterType) { - for (GpxDisplayItemType type : filterTypes) { - if (type == filterType) { - return true; - } - } - return false; - } - - public void reloadSplitFragment() { - getFragmentManager() - .beginTransaction() - .detach(this) - .attach(this) - .commit(); - } - - private class SplitSegmentsAdapter extends ArrayAdapter { - - SplitSegmentsAdapter(List items) { - super(getActivity(), 0, items); - } - - ColorStateList defaultTextColor; - - @NonNull - @Override - public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { - GpxDisplayItem currentGpxDisplayItem = getItem(position); - if (convertView == null) { - convertView = getTrackActivity().getLayoutInflater().inflate(R.layout.gpx_split_segment_fragment, parent, false); - } - convertView.setOnClickListener(null); - TextView overviewTextView = (TextView) convertView.findViewById(R.id.overview_text); - ImageView overviewImageView = (ImageView) convertView.findViewById(R.id.overview_image); - if (position == 0) { - overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - if (defaultTextColor == null) { - defaultTextColor = overviewTextView.getTextColors(); - } - overviewTextView.setTextColor(defaultTextColor); - overviewTextView.setText(app.getString(R.string.shared_string_overview)); - if (currentGpxDisplayItem != null) { - ((TextView) convertView.findViewById(R.id.fragment_count_text)).setText(app.getString(R.string.shared_string_time_span) + ": " + Algorithms.formatDuration((int) (currentGpxDisplayItem.analysis.timeSpan / 1000), app.accessibilityEnabled())); - } - } else { - if (currentGpxDisplayItem != null && currentGpxDisplayItem.analysis != null) { - overviewTextView.setTextColor(app.getSettings().isLightContent() ? app.getResources().getColor(R.color.gpx_split_overview_light) : app.getResources().getColor(R.color.gpx_split_overview_dark)); - if (currentGpxDisplayItem.group.isSplitDistance()) { - overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_overview_light : R.color.gpx_split_overview_dark)); - overviewTextView.setText(""); - double metricStart = currentGpxDisplayItem.analysis.metricEnd - currentGpxDisplayItem.analysis.totalDistance; - overviewTextView.append(OsmAndFormatter.getFormattedDistance((float) metricStart, app)); - overviewTextView.append(" - "); - overviewTextView.append(OsmAndFormatter.getFormattedDistance((float) currentGpxDisplayItem.analysis.metricEnd, app)); - } else if (currentGpxDisplayItem.group.isSplitTime()) { - overviewImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_overview_light : R.color.gpx_split_overview_dark)); - overviewTextView.setText(""); - double metricStart = currentGpxDisplayItem.analysis.metricEnd - (currentGpxDisplayItem.analysis.timeSpan / 1000); - overviewTextView.append(OsmAndFormatter.getFormattedDuration((int) metricStart, app)); - overviewTextView.append(" - "); - overviewTextView.append(OsmAndFormatter.getFormattedDuration((int) currentGpxDisplayItem.analysis.metricEnd, app)); - } - ((TextView) convertView.findViewById(R.id.fragment_count_text)).setText(app.getString(R.string.of, position, adapter.getCount() - 1)); - } - } - - ((ImageView) convertView.findViewById(R.id.start_time_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_start_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.end_time_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_end_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.average_altitude_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_average_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.altitude_range_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_range_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.ascent_descent_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_altitude_descent_ascent_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.moving_time_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_moving_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.average_speed_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_speed_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - ((ImageView) convertView.findViewById(R.id.max_speed_image)) - .setImageDrawable(ic.getIcon(R.drawable.ic_action_max_speed_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - - if (currentGpxDisplayItem != null) { - GPXTrackAnalysis analysis = currentGpxDisplayItem.analysis; - if (analysis != null) { - ImageView distanceOrTimeSpanImageView = ((ImageView) convertView.findViewById(R.id.distance_or_timespan_image)); - TextView distanceOrTimeSpanValue = (TextView) convertView.findViewById(R.id.distance_or_time_span_value); - TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text); - if (position == 0) { - distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); - distanceOrTimeSpanText.setText(app.getString(R.string.distance)); - } else { - if (currentGpxDisplayItem.group.isSplitDistance()) { - distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - if (analysis.timeSpan > 0) { - distanceOrTimeSpanValue.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled())); - } else { - distanceOrTimeSpanValue.setText("-"); - } - distanceOrTimeSpanText.setText(app.getString(R.string.shared_string_time_span)); - } else if (currentGpxDisplayItem.group.isSplitTime()) { - distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); - distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); - distanceOrTimeSpanText.setText(app.getString(R.string.distance)); - } - } - - TextView startTimeValue = (TextView) convertView.findViewById(R.id.start_time_value); - TextView startDateValue = (TextView) convertView.findViewById(R.id.start_date_value); - TextView endTimeValue = (TextView) convertView.findViewById(R.id.end_time_value); - TextView endDateValue = (TextView) convertView.findViewById(R.id.end_date_value); - if (analysis.timeSpan > 0) { - DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT); - DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM); - - Date start = new Date(analysis.startTime); - startTimeValue.setText(tf.format(start)); - startDateValue.setText(df.format(start)); - - Date end = new Date(analysis.endTime); - endTimeValue.setText(tf.format(end)); - endDateValue.setText(df.format(end)); - } else { - startTimeValue.setText("-"); - startDateValue.setText("-"); - endTimeValue.setText("-"); - endDateValue.setText("-"); - } - - View elevationDivider = convertView.findViewById(R.id.elevation_divider); - View elevationSection = convertView.findViewById(R.id.elevation_layout); - if (analysis.hasElevationData) { - elevationDivider.setVisibility(View.VISIBLE); - elevationSection.setVisibility(View.VISIBLE); - - ((TextView) convertView.findViewById(R.id.average_altitude_value)) - .setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app)); - - String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); - String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); - String min_max_elevation = min.substring(0, min.indexOf(" ")).concat("/").concat(max); - if (min_max_elevation.length() > 9) { - (convertView.findViewById(R.id.min_altitude_value)) - .setVisibility(View.VISIBLE); - (convertView.findViewById(R.id.max_altitude_value)) - .setVisibility(View.VISIBLE); - ((TextView) convertView.findViewById(R.id.min_altitude_value)) - .setText(min); - ((TextView) convertView.findViewById(R.id.max_altitude_value)) - .setText(max); - (convertView.findViewById(R.id.min_max_altitude_value)) - .setVisibility(View.GONE); - } else { - (convertView.findViewById(R.id.min_max_altitude_value)) - .setVisibility(View.VISIBLE); - ((TextView) convertView.findViewById(R.id.min_max_altitude_value)) - .setText(min_max_elevation); - (convertView.findViewById(R.id.min_altitude_value)) - .setVisibility(View.GONE); - (convertView.findViewById(R.id.max_altitude_value)) - .setVisibility(View.GONE); - } - - TextView ascentValue = (TextView) convertView.findViewById(R.id.ascent_value); - TextView descentValue = (TextView) convertView.findViewById(R.id.descent_value); - TextView ascentDescentValue = (TextView) convertView.findViewById(R.id.ascent_descent_value); - - String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); - String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); - String asc_desc = asc.substring(0, asc.indexOf(" ")).concat("/").concat(desc); - if (asc_desc.length() > 9) { - ascentValue.setVisibility(View.VISIBLE); - descentValue.setVisibility(View.VISIBLE); - ascentValue.setText(asc); - descentValue.setText(desc); - ascentDescentValue.setVisibility(View.GONE); - } else { - ascentDescentValue.setVisibility(View.VISIBLE); - ascentDescentValue.setText(asc_desc); - ascentValue.setVisibility(View.GONE); - descentValue.setVisibility(View.GONE); - } - - } else { - elevationDivider.setVisibility(View.GONE); - elevationSection.setVisibility(View.GONE); - } - - View speedDivider = convertView.findViewById(R.id.speed_divider); - View speedSection = convertView.findViewById(R.id.speed_layout); - if (analysis.hasSpeedData) { - speedDivider.setVisibility(View.VISIBLE); - speedSection.setVisibility(View.VISIBLE); - - ((TextView) convertView.findViewById(R.id.moving_time_value)) - .setText(Algorithms.formatDuration((int) (analysis.timeMoving / 1000), app.accessibilityEnabled())); - ((TextView) convertView.findViewById(R.id.average_speed_value)) - .setText(OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app)); - - String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app); - String minSpeed = OsmAndFormatter.getFormattedSpeed(analysis.minSpeed, app); - String maxMinSpeed; - if (maxSpeed.contains(" ")) { - maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf(" ")).concat("/").concat(minSpeed); - } else { - maxMinSpeed = maxSpeed.substring(0, maxSpeed.indexOf("-")).concat("/").concat(minSpeed); - } - - if (minMaxSpeedLayoutWidth == 0) { - DisplayMetrics metrics = new DisplayMetrics(); - getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); - int screenWidth = metrics.widthPixels; - int widthWithoutSidePadding = screenWidth - AndroidUtils.dpToPx(getActivity(), 32); - int singleLayoutWidth = widthWithoutSidePadding / 3; - int twoLayouts = 2 * (singleLayoutWidth + AndroidUtils.dpToPx(getActivity(), 3)); - minMaxSpeedLayoutWidth = widthWithoutSidePadding - twoLayouts - AndroidUtils.dpToPx(getActivity(), 28); - } - - minMaxSpeedPaint.getTextBounds(maxMinSpeed, 0, maxMinSpeed.length(), minMaxSpeedTextBounds); - int minMaxStringWidth = minMaxSpeedTextBounds.width(); - - if (analysis.minSpeed == 0) { - (convertView.findViewById(R.id.max_speed_value)) - .setVisibility(View.VISIBLE); - (convertView.findViewById(R.id.min_speed_value)) - .setVisibility(View.GONE); - ((TextView) convertView.findViewById(R.id.max_speed_value)) - .setText(maxSpeed); - (convertView.findViewById(R.id.max_min_speed_value)) - .setVisibility(View.GONE); - ((TextView) convertView.findViewById(R.id.max_min_speed_text)) - .setText(app.getString(R.string.shared_string_max)); - } else if (minMaxStringWidth > minMaxSpeedLayoutWidth) { - (convertView.findViewById(R.id.max_speed_value)) - .setVisibility(View.VISIBLE); - (convertView.findViewById(R.id.min_speed_value)) - .setVisibility(View.VISIBLE); - ((TextView) convertView.findViewById(R.id.max_speed_value)) - .setText(maxSpeed); - ((TextView) convertView.findViewById(R.id.min_speed_value)) - .setText(minSpeed); - (convertView.findViewById(R.id.max_min_speed_value)) - .setVisibility(View.GONE); - ((TextView) convertView.findViewById(R.id.max_min_speed_text)) - .setText(app.getString(R.string.max_min)); - } else { - (convertView.findViewById(R.id.max_min_speed_value)) - .setVisibility(View.VISIBLE); - ((TextView) convertView.findViewById(R.id.max_min_speed_value)) - .setText(maxMinSpeed); - (convertView.findViewById(R.id.max_speed_value)) - .setVisibility(View.GONE); - (convertView.findViewById(R.id.min_speed_value)) - .setVisibility(View.GONE); - ((TextView) convertView.findViewById(R.id.max_min_speed_text)) - .setText(app.getString(R.string.max_min)); - } - } else { - speedDivider.setVisibility(View.GONE); - speedSection.setVisibility(View.GONE); - } - } - } - return convertView; - } - } - - private class SplitTrackAsyncTask extends AsyncTask { - @Nullable - private final GpxSelectionHelper.SelectedGpxFile mSelectedGpxFile; - @NonNull private final TrackActivity mActivity; - - private final List groups; - - SplitTrackAsyncTask(@Nullable GpxSelectionHelper.SelectedGpxFile selectedGpxFile, List groups) { - mSelectedGpxFile = selectedGpxFile; - mActivity = getTrackActivity(); - this.groups = groups; - } - - protected void onPostExecute(Void result) { - if (!mActivity.isFinishing()) { - mActivity.setSupportProgressBarIndeterminateVisibility(false); - } - if (mSelectedGpxFile != null) { - List groups = getDisplayGroups(); - mSelectedGpxFile.setDisplayGroups(groups); - } - updateContent(); - } - - protected void onPreExecute() { - mActivity.setSupportProgressBarIndeterminateVisibility(true); - } - - @Override - protected Void doInBackground(Void... params) { - for (GpxDisplayGroup model : groups) { - OsmandApplication application = mActivity.getMyApplication(); - if (selectedSplitInterval == 0) { - model.noSplit(application); - } else if (distanceSplit.get(selectedSplitInterval) > 0) { - model.splitByDistance(application, distanceSplit.get(selectedSplitInterval)); - } else if (timeSplit.get(selectedSplitInterval) > 0) { - model.splitByTime(application, timeSplit.get(selectedSplitInterval)); - } - } - - return null; - } - } -} diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index a84e07a802..ba5ec52e89 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -124,7 +124,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { private OsmandApplication app; private SegmentGPXAdapter adapter; - private GpxDisplayItemType[] filterTypes = { GpxSelectionHelper.GpxDisplayItemType.TRACK_SEGMENT }; + private GpxDisplayItemType[] filterTypes = {GpxSelectionHelper.GpxDisplayItemType.TRACK_SEGMENT}; private List options = new ArrayList<>(); private List distanceSplit = new ArrayList<>(); private TIntArrayList timeSplit = new TIntArrayList(); @@ -638,10 +638,10 @@ public class TrackSegmentFragment extends OsmAndListFragment { public void updateSplitView() { if (getGpx() != null) { - SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false); + SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat) headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false); final List groups = getDisplayGroups(); if (groups.size() > 0) { - updateSplit(groups, ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null); + updateSplit(groups, ((SwitchCompat) headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null); if (getGpxDataItem() != null) { updateSplitInDatabase(); } @@ -840,7 +840,6 @@ public class TrackSegmentFragment extends OsmAndListFragment { for (GpxDisplayItem i : flatten(groups)) { adapter.add(i); } - // Obsolete: adapter.setNotifyOnChange(true); adapter.notifyDataSetChanged(); if (getActivity() != null) { updateHeader(); @@ -849,7 +848,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { protected List flatten(List groups) { ArrayList list = new ArrayList<>(); - for(GpxDisplayGroup g : groups) { + for (GpxDisplayGroup g : groups) { list.addAll(g.getModifiableList()); } return list; @@ -1645,7 +1644,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { @Override public void select(View tab) { - GPXTabItemType tabType = GPXTabItemType.valueOf((String)tab.getTag()); + GPXTabItemType tabType = GPXTabItemType.valueOf((String) tab.getTag()); ImageView img = (ImageView) tab.findViewById(R.id.tab_image); int imageId = getImageId(tabType); switch (tabs.getTabSelectionType()) { @@ -1660,7 +1659,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { @Override public void deselect(View tab) { - GPXTabItemType tabType = GPXTabItemType.valueOf((String)tab.getTag()); + GPXTabItemType tabType = GPXTabItemType.valueOf((String) tab.getTag()); ImageView img = (ImageView) tab.findViewById(R.id.tab_image); int imageId = getImageId(tabType); switch (tabs.getTabSelectionType()) { @@ -1773,12 +1772,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { } void openSplitIntervalScreen() { - getTrackActivity().getSupportFragmentManager() - .beginTransaction() - .replace(R.id.track_activity_layout, new SplitSegmentFragment()) - .addToBackStack(SplitSegmentFragment.TAG) - .commit(); - getTrackActivity().getSlidingTabLayout().setVisibility(View.GONE); + SplitSegmentDialogFragment.showInstance(getTrackActivity()); } private class SaveGpxAsyncTask extends AsyncTask { @@ -1820,8 +1814,10 @@ public class TrackSegmentFragment extends OsmAndListFragment { private class SplitTrackAsyncTask extends AsyncTask { @Nullable private final SelectedGpxFile mSelectedGpxFile; - @NonNull private final TrackSegmentFragment mFragment; - @NonNull private final TrackActivity mActivity; + @NonNull + private final TrackSegmentFragment mFragment; + @NonNull + private final TrackActivity mActivity; private final List groups;