diff --git a/LICENSE b/LICENSE index a739fdd6b9..c26d37ee1c 100644 --- a/LICENSE +++ b/LICENSE @@ -62,6 +62,10 @@ - Madrid: «MetroMadridLogo» (Przemysław Sakrajda) - own work based on (na podstawie) www.metromadrid.es. Under Public domain Commons license from the site - https://commons.wikimedia.org/wiki/File:MetroMadridLogo.svg#/media/File:MetroMadridLogo.svg - London: «Underground» (Dream out loud) - own work. Under Public domain Commons license from the site - https://commons.wikimedia.org/wiki/File:Underground.svg#/media/File:Underground.svg - Barcelona: «Logometrobcn» (Javitomad) - own work. Under GFDL license - https://commons.wikimedia.org/wiki/File:Logometrobcn.svg#/media/File:Logometrobcn.svg + - Tokyo: "Tokyo Metro logo (full)" by Imagener - Tokyo Metro Company. Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:Tokyo_Metro_logo_(full).svg#/media/File:Tokyo_Metro_logo_(full).svg + - Chicago: «Логотип Chicago Transit Authority» - http://brandsoftheworld.com/, http://en.wikipedia.org/wiki/Image:Chicago_Transit_Authority_Logo.svg. Under Fair use license from site- https://ru.wikipedia.org/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Chicago_Transit_Authority.svg#/media/File:%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Chicago_Transit_Authority.svg + - Osaka:«Osaka Metro Logo» (Osaka_Municipal_Subway_logo_001.JPG: Tennen-Gasderivative work: () - Hand coded. Own work, based on Osaka_Municipal_Subway_logo_001.JPG. Under Public domain Commons license from the site - https://commons.wikimedia.org/wiki/File:Osaka_Metro_Logo.svg#/media/File:Osaka_Metro_Logo.svg + - Stockholm: «Stockholm metro symbol» svg graphics by (Kildor) - own work. Licensed under Public Domain via Commons from site - https://commons.wikimedia.org/wiki/File:Stockholm_metro_symbol.svg#/media/File:Stockholm_metro_symbol.svg * Integration with Qt library in (https://github.com/osmandapp/Osmand-core/) - dynamic linking - LGPL (http://www.qt.io/qt-licensing-terms/) diff --git a/OsmAnd-java/src/net/osmand/util/Algorithms.java b/OsmAnd-java/src/net/osmand/util/Algorithms.java index 7da3e44d21..e6fa8347bd 100644 --- a/OsmAnd-java/src/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/net/osmand/util/Algorithms.java @@ -1,6 +1,10 @@ package net.osmand.util; +import net.osmand.PlatformUtil; + +import org.apache.commons.logging.Log; + import java.io.BufferedReader; import java.io.Closeable; import java.io.EOFException; @@ -11,7 +15,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; @@ -20,10 +23,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import net.osmand.PlatformUtil; - -import org.apache.commons.logging.Log; - /** * Basic algorithms that are not in jdk @@ -504,6 +503,21 @@ public class Algorithms { return hours + ":" + min + ":" + sec; } } + + public static String formatMinutesDuration(int minutes) { + if (minutes < 60) { + return String.valueOf(minutes); + } else { + String min; + if (minutes % 60 < 10) { + min = "0" + (minutes % 60); + } else { + min = (minutes % 60) + ""; + } + int hours = minutes / 60; + return hours + ":" + min; + } + } public static > T parseEnumValue(T[] cl, String val, T defaultValue){ for(int i = 0; i< cl.length; i++) { diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index 30d9f0cd87..f95a264282 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -743,7 +743,7 @@ public class OpeningHoursParser { * @param format the string to parse * @return the OpeningHours object */ - private static OpeningHoursParser.OpeningHours parseOpenedHoursHandleErrors(String format){ + public static OpeningHoursParser.OpeningHours parseOpenedHoursHandleErrors(String format){ if(format == null) { return null; } diff --git a/OsmAnd/res/layout/download_index_fragment.xml b/OsmAnd/res/layout/download_index_fragment.xml index 83fdecf566..4c11ce3e45 100644 --- a/OsmAnd/res/layout/download_index_fragment.xml +++ b/OsmAnd/res/layout/download_index_fragment.xml @@ -3,6 +3,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> + + tools:text="@string/device_memory"/> + + + + + + + + + + + + + + + + + Adgang privat Ingen adgang Adgang destination - Adgang tolerant + Adgang med tilladelse Kundenadgang Adgang for levering Adgang for landbrug @@ -1042,8 +1042,8 @@ Biler Cykler - Drikkevand - Ikke drikkevand + Drikkevand: ja + Drikkevand: nej Overvåget Ikke overvåget Sæsonbestemt @@ -1229,7 +1229,7 @@ Naturisme: forbudt Naturisme: obligatorisk Naturisme: sædvane - Naturisme: liberalt + Naturisme: med tilladelse Højde Højde over havoverfladen @@ -1381,7 +1381,7 @@ Pistepreparering: offpiste Pistepreparering: snescooter Pistepreparering: skating - Pistepreparering: ingen + Pistepreparering: nej Pistepreparering: pukkelpist Havetype: beboelse @@ -1593,71 +1593,71 @@ Internetadgang - gebyr Internetadgang - inget gebyr -Kun vegetarisk kost - Vegetarisk kost - Vegetarisk kost: ingen - Vegetarisk kost: få +Kun vegetarkost + Vegetarkost + Vegetarkost: nej + Vegetarkost: kun få Kun veganerkost Veganerkost - Veganerkost: ingen + Veganerkost: nej Kun glutenfri kost Glutenfri kost - Glutenfri kost: ingen + Glutenfri kost: nej Kun kosher kost Kosher kost - Kosher kost: ingen + Kosher kost: nej Kun halal kost Halal kost - Halal kost: ingen + Halal kost: nej Kun laktosefri kost Laktosefri kost - Laktosefri kost: ingen - Pescetarian kost + Laktosefri kost: nej + pesco-vegetarkost - Drive-in: Ja - Drive-in: ingen - Drive-through: Ja - Drive-through: Ja + Drive-in: ja + Drive-in: nej + Drive-through: ja + Drive-through: nej - Bryggeriet navn + Bryggerinavn Mikrobryggeri Ingen mikrobryggeri Takeway - Ingen takeway - Takeway kun + Ingen takeaway + Kun takeaway Levering Ingen levering - Levering kun + Kun levering - Udendørs siddepladser - Ingen udendørs siddepladser - Udendørs siddepladser: terrasse - Udendørs siddepladser: fortovet - Udendørs siddepladser: gågaden - Udendørs siddepladser: haven - Udendørs siddepladser: gårdhave + Udendørsservering + Ingen udendørsservering + Udendørsservering: terrasse + Udendørsservering: fortov + Udendørsservering: gågade + Udendørsservering: have + Udendørsservering: gårdhave Cocktails Brugte varer Ingen brugte varer - Brugte varer kun + Kun brugte varer Dele Forhandler Reparation Ingen reparation - Reparation af El-køretøjer - Motorcykel Reparation + Reparation af elektriske køretøjer + Motorcykel reparation Selvbetjening Ingen selvbetjening Automatiseret Ikke automatiseret Fuld service Børsteløs - Børsteløs: ingen + Børsteløs: nej Fly tankstation Offentligt bad @@ -1665,22 +1665,78 @@ Mand Forbudt for mænd Kvinde - Forbudt for kvindelige + Forbudt for kvinder Indendørs Udendørs Med toiletter Uden toiletter - Adgang til toiletter for kørestole: Ja - Adgang til toiletter for kørestole: ingen - Toiletter adgang: kunder - Toiletter adgang: eftergivende - Toiletter adgang: Fællesskabet - Toiletter adgang: offentlig + Adgang til toiletter for kørestole: ja + Adgang til toiletter for kørestole: nej + Toiletadgang: kunder + Toiletadgang: med tilladelse + Toiletadgang: fællesskab + Toiletadgang: offentlig - Ble puslebord - Ingen ble puslebord - Ble skiftende rum + Puslebord + Ingen puslebord + Puslerum -begivenheder mødested +Kulturhus - + Bilvask: nej + + Parkering tidsfrist + + Parkeringsbilletter + Cigaretter + Billetter til offentlig transport + Drikkevarer + Slik + Pakke afhentning og post Indsendelsesservice + Kondomer + Frimærker + Cykelslanger + Mad + Drikkevarer og mad + Benzinautomat + Pakke afhentning + Pakke Indsendelsesservice + Mælk + Souvenirmønt + Brød + Tyggegummi + Parkeringsbilletter; billetter til offentlig transport + Kaffe + Vejafgiftautomat + Billetautomat + Vandautomat + Telefon værdikuponer + Dyrefoder + Køreplaner + Drikkevarer og slik + Gavekort + DVD + Stearinlys + Legetøj + Is + SIM-kort + + Branche + + Krigsmindesmærke + Plakette + Statue + Sten + Stele + Buste + Koshinto + "Blå plakette" + Jizo + Kors + Køretøj + Obelisk + +Hundeposer + Inskription + + diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 63c33ac89a..c9ee9967b4 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -2160,4 +2160,5 @@ Vælg enhed for hastighed Tilføj ny Vælg kategori - + Henter - %1$d fil + diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index b5c6666aac..33a7f95cd1 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -1022,8 +1022,8 @@ Bicicletas Duchas - Agua potable - Agua no potable + Con agua potable + Sin agua potable Supervisado Sin supervisión Estacional @@ -1659,4 +1659,54 @@ Sin cambiador de pañales Habitación para cambio de pañales +Lavado de autos: no + + Estadía máxima + + Tickets de estacionamiento + Cigarrillos + Bolsas para excremento + Tickets de transporte público + Bebidas + Dulces + Condones + Sellos + Tubos de bicicleta + Comida + Bebidas y comidas + Surtidor de combustible + Leche + Pan + Chicles + Tickets de estacionamiento y transporte público + Café + Tickets de peaje + Surtidor de tickets + Surtidor de agua + Vales de teléfono + Comida animal + Planes de transporte público + Bebidas y dulces + Vales + DVD + Velas + Juguetes + Helados + Tarjetas SIM + + Rama + + Memorial de guerra + Placa + Estatua + Piedra + Estrella + Busto + Placa azul + Cruz + Vehículo + Obelisco + + Inscripción + diff --git a/OsmAnd/res/values-es/phrases.xml b/OsmAnd/res/values-es/phrases.xml index 63b5771726..de247e7341 100644 --- a/OsmAnd/res/values-es/phrases.xml +++ b/OsmAnd/res/values-es/phrases.xml @@ -1026,8 +1026,8 @@ Bicicletas Duchas - Agua potable - Agua no potable + Agua potable: sí + Agua potable: no Supervisado Sin supervisión Estacional @@ -1663,4 +1663,28 @@ Sin cambiador de pañales Habitación para cambio de pañales +Cigarrillos + Bebidas + Preservativos + Sellos + Comida + Bebidas y comida + Leche + Pan + Chicles + Café + Comida para animales + Bebidas y dulces + DVD + Velas + Juguetes + Helado + Tarjetas SIM + + Estatua + Vehículo + Obelisco + + Inscripción + diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index dc972c8307..0dedda6007 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2033,7 +2033,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Gestisci Modifica Filtra per nome - Digita per cercare fra tutti i PDI + Scrivi per cercare fra tutti i PDI Europa - Paesi Bassi Copia dei file fallita Memoria esterna @@ -2127,7 +2127,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz Ci teniamo molto Valuta questa app Dicci perché. - Per favore dai a OsmAnd la tua valutazione su Google Play + Dai a OsmAnd un punteggio su Google Play Dicci cosa cambieresti in questa app. Aggiornamenti automatici Caricamento fallito diff --git a/OsmAnd/res/values-ku/strings.xml b/OsmAnd/res/values-ku/strings.xml index af4295a6f8..32fe8db690 100644 --- a/OsmAnd/res/values-ku/strings.xml +++ b/OsmAnd/res/values-ku/strings.xml @@ -12,4 +12,6 @@ Vai vēlaties, lai OsmAnd kopē uz jauno vietu arī savus datu failus? Norādītajā direktorijā nevar veidot Kartes Nu Texe + Milla Bahra + Tomara Ger diff --git a/OsmAnd/res/values-pt-rBR/phrases.xml b/OsmAnd/res/values-pt-rBR/phrases.xml index 32ade2a7b4..a776e2dc20 100644 --- a/OsmAnd/res/values-pt-rBR/phrases.xml +++ b/OsmAnd/res/values-pt-rBR/phrases.xml @@ -910,17 +910,17 @@ Operador Bandeira - Fiscalização:semáforo - Fiscalização:velocidade máxima - Fiscalização:peso máximo - Fiscalização:distância mínima - Fiscalização:acesso - Fiscalização:pedágio + Fiscalização: semáforo + Fiscalização: velocidade máxima + Fiscalização: peso máximo + Fiscalização: distância mínima + Fiscalização: acesso + Fiscalização: pedágio Área de conservação Horário de coleta - Fiscalização:verificação + Fiscalização: verificação Linha de corte País Taxa @@ -1023,8 +1023,8 @@ Bicicletas Chuveiro - Água potável - Água impotável + Com água potável + Sem água potável Supervisionado Sem supervisão Sazonal @@ -1277,9 +1277,9 @@ Terminal de informação Marcador de rota Mapa de caminhadas - Informações sobre natureza - Informações sobre vida selvagem - Informações sobre história + Ponto de informação: natureza + Ponto de informação: vida selvagem + Ponto de informação: história Placa Audioguia Mapa ciclístico @@ -1351,4 +1351,6 @@ Cadeira de rodas: não permitido Cadeira de rodas: limitado + Bomba + diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 370b74c912..c281f99577 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -1469,6 +1469,7 @@ Полный комплекс услуг Бесконтактная Контактная + Без автомойки Заправочная станция для воздушного транспорта Общественная баня @@ -1491,4 +1492,57 @@ Пеленальный столик отсутствует Пеленальная комната + Максимальное время стоянки + + Парковочные талоны + Сигареты + Пакеты для экскрементов животных + Билеты на общественный транспорт + Продажа напитков + Сладости + Получение и отправление посылок + Презервативы + Марки + Велосипедные камеры + Питание + Напитки и закуски + Топливо + Получение посылок + Отправление посылок + Молоко + Удлинённые монеты (сувениры) + Хлеб + Жевательная резинка + Парковочные талоны; билеты на общественный транспорт + Кофе + Оплата за проезд + Билеты + Продажа воды + Телефонные карты + Еда для животных + Карты общественного транспорта + Напитки и сладости + Ваучеры + DVD + Свечи + Продажа игрушек + Продажа мороженого + SIM-карты + + Филиал + + Военный + Доска + Статуя + Камень + Стелла + Бюст + Синяя табличка + Дзидзо + Крест + Средство передвижения + Обелиск + + Надпись + \ No newline at end of file diff --git a/OsmAnd/res/values-sc/phrases.xml b/OsmAnd/res/values-sc/phrases.xml index 6fc7228205..4d49c4738d 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -1048,7 +1048,7 @@ Facebook Twitter Skype - Youtube + YouTube Instagram VKontakte Google+ @@ -1087,4 +1087,104 @@ Informatziones istòricas Sinnu Audioghia + Atzessu a ìnternet: eja + Atzessu a ìnternet: nono + + Edifìtziu nàutico + Ponte nàuticu + Coladòrgiu pedonale + + Àndala retza tziclàbile internatzionale + Àndala retza tziclàbile natzionale + Àndala retza tziclàbile regionale + Àndala retza tziclàbile locale + Àndala retza internatzionale pro s’escursionismu + Àndala retza natzionale pro s’escursionismu + Àndala retza regionale pro s’escursionismu + Àndala retza locale pro s’escursionismu + + Àndala internatzionale pro s’escursionismu + Àndala natzionale pro s’escursionismu + Àndala regionale pro s’escursionismu + Àndala locale pro s’escursionismu + Legenda pro sas àndalas pro s’escursionismu + + Fax + Abba potàbile: eja + Abba potàbile:nono + Tentadu + Non tentadu + Istajonale + Non istajonale + Istajone sica + Istajone ùmida + Cun semàforos + Non controlladu + Non sinnaladu + Data de cumintzu + Cadira a rodas + Cadira a rodas: non permitidas + Cadira a rodas: limitadas + Atzessu privadu + Sena atzessu + Atzessu pro clientes + Atzessu pro cunsinnas + Atzessu agrìcolu + + Cuntenutu: insilatu + Cuntenutu: abba + Cuntenutu: licuames + Cuntenutu: ògiu + Cuntenutu: combustìbile + Cuntenutu: ledàmene + Cuntenutu: binu + Cuntenutu: abbas nieddas + Cuntenutu: gas + Cuntenutu: biomassa + Cuntenutu: abbas de iscàrrigu + Cuntenutu: regorta + Cuntenutu: proenda + Cuntenutu: birra + Cuntenutu: sale + Cuntenutu: trigu + + Nudismu: permìtidu + Nudismu: proibidu + Nudismu: obligatòriu + Nudismu: abituale + Nudismu: permissivu + + Populatzione + Suta-terra + Medas pianos + + Edifìtziu ispetziale + Informale + + Fògia larga (latifògia) + Fògia a agu (aghifògia) + Mistu + Sena fògias + Genia + Gènere + Tàxon + + Olia + Mela + Ògiu de palma + Arantzu + Mèndula + Bananu + Nutzola + Nughe de coco + Cachi + Cariasa + Nughe + Pruna + Pèssighe + Te + Coca + Kiwi + Pradu cun fruttedu + Pèssighe-nughe diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index fa26a46e7c..15727fdad4 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -2098,4 +2098,22 @@ Registratzione biàgiu Nàvigu Funtzionamentu in isfondu - + Annanghe noa + Ischerta sa categoria + Issèbera s’unidade de medida de sa lestresa + Medida de sa lestresa + nm + Mìglios nàuticos + Chilòmetros pro ora + Mìglios pro ora + Metros pro segundu + Minutos pro chilòmetru + Minutos pro mìgliu + Mìglios nàuticos pro ora (knot) + nmh + min/m + min/km + m/s + + Iscarrigande - %1$d documentu + diff --git a/OsmAnd/res/values-tr/phrases.xml b/OsmAnd/res/values-tr/phrases.xml index f6bfd9e2d1..3784ea4f83 100644 --- a/OsmAnd/res/values-tr/phrases.xml +++ b/OsmAnd/res/values-tr/phrases.xml @@ -1035,4 +1035,5 @@ Bina - +Kapılar + diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index db903fcbe0..733c08044a 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -1461,4 +1461,12 @@ "Bu eklenti OsMo adlı gelişmiş canlı izlemeyi etkinleştirir, bkz http://osmo.mobi.\n\nBir grup içindeki bütün aygıtları gerçek zamanlı olarak izleyebilir ve birbiriyle iletişim kurabilir. Oturum izleme veya daimi izleme için çeşitli seçenekleri vardır.\n\nAnonim gruplar belirli günlerde, ve belirli özelliklerde kendiliğinden oluşturulabilir, örn. uzaktan herhangi kontrol ve yönetici olmadan. Diğer yandan, tam özellikli gruplar websitesinde oluşturulabilir ve sadece kayıtlı kullanıcılar erişebilir. " Harita gezinti görünümü Newar / Nepal Bhasa + Yeni Ekle + Kategori Seç + Hız ölçüm sistemini tanımlar + Hız Ölçümü + Deniz Mili + Saniyede Metre + Kilometre Başına Dakika + Saatte Mil diff --git a/OsmAnd/res/values-zh-rTW/phrases.xml b/OsmAnd/res/values-zh-rTW/phrases.xml index a39905458d..c6951082a8 100644 --- a/OsmAnd/res/values-zh-rTW/phrases.xml +++ b/OsmAnd/res/values-zh-rTW/phrases.xml @@ -1484,4 +1484,6 @@ 不接受 Routex 燃料卡 接受 Bancomat 不接受 Bancomat + 接受 IC 儲值卡 + 不接受 IC 儲值卡 diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 420c0e0e66..c1b17dfad8 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -1101,8 +1101,8 @@ Brand Fee is charged No fee - Drinking water - No drinking water + Drinking water: yes + Drinking water: no Supervised Without supervision Seasonal @@ -1618,6 +1618,7 @@ Full service Brushless Brushless: no + Car wash: no Aircraft fuel station Public bath @@ -1641,4 +1642,58 @@ No diaper changing table Diaper changing room + Parking time limit + + Parking tickets + Cigarettes + Excrement bags + Public transport tickets + Drinks + Sweets + Parcel pickup and mail in + Condoms + Stamps + Bicycle tubes + Food + Drinks and food + Fuel vending + Parcel pickup + Parcel mail-in + Milk + Elongated coin + Bread + Chewing gums + Parking tickets; public transport tickets + Coffee + Toll vending + Tickets vending + Water vending + Telephone vouchers + Animal food + Public transport plans + Drinks and sweets + Vouchers + DVD + Candles + Toys + Ice cream + SIM-cards + + Branch + + War memorial + Plaque + Statue + Stone + Stele + Bust + Koshinto + Blue plaque + Jizo + Cross + Vehicle + Obelisk + + Inscription + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 295ad10e00..0aa23929ff 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1996,4 +1996,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Any unsaved changes will be lost. Continue? %1$s downloads left Roads + Downloding - %1$d file diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 8dd9aa20e8..887d721155 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -78,6 +78,8 @@ public class DownloadActivity extends BaseDownloadActivity { private List downloadTypes = new ArrayList(); private List cats; + private OnProgressUpdateListener onProgressUpdateListener; + @Override protected void onCreate(Bundle savedInstanceState) { getMyApplication().applyTheme(this); @@ -255,6 +257,17 @@ public class DownloadActivity extends BaseDownloadActivity { @Override public void updateProgress(boolean updateOnlyProgress) { BasicProgressAsyncTask basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask(); + final boolean isFinished = basicProgressAsyncTask == null + || basicProgressAsyncTask.getStatus() == AsyncTask.Status.FINISHED; + if (onProgressUpdateListener != null) { + if (isFinished) { + onProgressUpdateListener.onFinished(); + } else { + onProgressUpdateListener.onProgressUpdate( + basicProgressAsyncTask.getProgressPercentage(), + downloadListIndexThread.getDownloads()); + } + } //needed when rotation is performed and progress can be null if (progressView == null) { return; @@ -265,9 +278,8 @@ public class DownloadActivity extends BaseDownloadActivity { determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage()); } } else { - boolean visible = basicProgressAsyncTask != null && basicProgressAsyncTask.getStatus() != AsyncTask.Status.FINISHED; - progressView.setVisibility(visible ? View.VISIBLE : View.GONE); - if (visible) { + progressView.setVisibility(!isFinished ? View.VISIBLE : View.GONE); + if (!isFinished) { boolean indeterminate = basicProgressAsyncTask.isIndeterminate(); indeterminateProgressBar.setVisibility(!indeterminate ? View.GONE : View.VISIBLE); determinateProgressBar.setVisibility(indeterminate ? View.GONE : View.VISIBLE); @@ -613,5 +625,18 @@ public class DownloadActivity extends BaseDownloadActivity { } } + public void setOnProgressUpdateListener(OnProgressUpdateListener onProgressUpdateListener) { + this.onProgressUpdateListener = onProgressUpdateListener; + BasicProgressAsyncTask basicProgressAsyncTask = DownloadActivity.downloadListIndexThread.getCurrentRunningTask(); + final boolean isFinished = basicProgressAsyncTask == null + || basicProgressAsyncTask.getStatus() == AsyncTask.Status.FINISHED; + if (isFinished) { + this.onProgressUpdateListener.onFinished(); + } + } + public interface OnProgressUpdateListener { + void onProgressUpdate(int progressPercentage, int activeTasks); + void onFinished(); + } } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java index 0802692936..dec73d6306 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexFragment.java @@ -214,8 +214,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment { } } - - @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { final IndexItem e = listAdapter.getChild(groupPosition, childPosition); diff --git a/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java b/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java index db6cc0d5f4..164365776a 100644 --- a/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java @@ -23,7 +23,11 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.WorldRegion; import net.osmand.plus.download.DownloadActivity; +<<<<<<< HEAD:OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java import net.osmand.plus.download.newimplementation.MapsInCategoryFragment; +======= +import net.osmand.plus.download.newimplementation.DownloadsUiInitHelper; +>>>>>>> 380dcbe6d79e0f54421d0b67ce3688dfe910e78e:OsmAnd/src/net/osmand/plus/download/items/DownloadItemsFragment.java import org.apache.commons.logging.Log; @@ -92,6 +96,9 @@ public class WorldItemsFragment extends Fragment { onCategorizationFinished(); + DownloadsUiInitHelper.initFreeVersionBanner(view, + getMyApplication().getSettings(), getResources()); + return view; } diff --git a/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java.orig b/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java.orig new file mode 100644 index 0000000000..164365776a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java.orig @@ -0,0 +1,284 @@ +package net.osmand.plus.download.items; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.view.MenuItemCompat; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.TextView; + +import net.osmand.PlatformUtil; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.WorldRegion; +import net.osmand.plus.download.DownloadActivity; +<<<<<<< HEAD:OsmAnd/src/net/osmand/plus/download/items/WorldItemsFragment.java +import net.osmand.plus.download.newimplementation.MapsInCategoryFragment; +======= +import net.osmand.plus.download.newimplementation.DownloadsUiInitHelper; +>>>>>>> 380dcbe6d79e0f54421d0b67ce3688dfe910e78e:OsmAnd/src/net/osmand/plus/download/items/DownloadItemsFragment.java + +import org.apache.commons.logging.Log; + +import java.text.MessageFormat; +import java.util.Locale; + +public class WorldItemsFragment extends Fragment { + public static final String TAG = "WorldItemsFragment"; + private static final Log LOG = PlatformUtil.getLog(WorldItemsFragment.class); + private static final MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US); + + public static final int RELOAD_ID = 0; + + private ItemsListBuilder builder; + private WorldRegionsAdapter worldRegionsAdapter; + private WorldMapsAdapter worldMapsAdapter; + private VoicePromtsAdapter voicePromtsAdapter; + + private TextView worldRegionsTextView; + private ListView worldRegionsListView; + private TextView worldMapsTextView; + private ListView worldMapsListView; + private TextView voicePromtsTextView; + private ListView voicePromtsListView; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.download_index_fragment, container, false); + + builder = new ItemsListBuilder(getMyApplication(), getMyApplication().getWorldRegion()); + + worldRegionsTextView = (TextView) view.findViewById(R.id.list_world_regions_title); + worldRegionsTextView.setText("World regions".toUpperCase()); + worldRegionsListView = (ListView) view.findViewById(R.id.list_world_regions); + worldRegionsAdapter = new WorldRegionsAdapter(getActivity(), getMyApplication()); + worldRegionsListView.setAdapter(worldRegionsAdapter); + worldRegionsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + WorldRegion region = worldRegionsAdapter.getItem(position); + + FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction(); + fragmentTransaction.addToBackStack(null); + LocalDialogFragment.createInstance(region) + .show(fragmentTransaction, MapsInCategoryFragment.TAG); + } + }); + + worldMapsTextView = (TextView) view.findViewById(R.id.list_world_maps_title); + worldMapsTextView.setText("World maps".toUpperCase()); + worldMapsListView = (ListView) view.findViewById(R.id.list_world_maps); + worldMapsAdapter = new WorldMapsAdapter(getActivity()); + worldMapsListView.setAdapter(worldMapsAdapter); + + voicePromtsTextView = (TextView) view.findViewById(R.id.list_voice_promts_title); + voicePromtsTextView.setText("Voice promts".toUpperCase()); + voicePromtsListView = (ListView) view.findViewById(R.id.list_voice_promts); + voicePromtsAdapter = new VoicePromtsAdapter(getActivity(), getMyApplication()); + voicePromtsListView.setAdapter(voicePromtsAdapter); + + onCategorizationFinished(); + + DownloadsUiInitHelper.initFreeVersionBanner(view, + getMyApplication().getSettings(), getResources()); + + return view; + } + + public static void setListViewHeightBasedOnChildren(ListView listView) { + ListAdapter listAdapter = listView.getAdapter(); + if (listAdapter == null) { + // pre-condition + return; + } + + int totalHeight = 0; + for (int i = 0; i < listAdapter.getCount(); i++) { + View listItem = listAdapter.getView(i, null, listView); + listItem.measure(0, 0); + totalHeight += listItem.getMeasuredHeight(); + } + + ViewGroup.LayoutParams params = listView.getLayoutParams(); + params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); + listView.setLayoutParams(params); + listView.requestLayout(); + } + + public OsmandApplication getMyApplication() { + return (OsmandApplication)getActivity().getApplication(); + } + + private void fillWorldRegionsAdapter() { + if (worldRegionsAdapter != null) { + worldRegionsAdapter.clear(); + worldRegionsAdapter.addAll(builder.getRegionsFromAllItems()); + updateVisibility(worldRegionsAdapter, worldRegionsTextView, worldRegionsListView); + } + } + + private void fillWorldMapsAdapter() { + if (worldMapsAdapter != null) { + worldMapsAdapter.clear(); + worldMapsAdapter.addAll(builder.getRegionMapItems()); + updateVisibility(worldMapsAdapter, worldMapsTextView, worldMapsListView); + } + } + + private void fillVoicePromtsAdapter() { + if (voicePromtsAdapter != null) { + voicePromtsAdapter.clear(); + //voicePromtsAdapter.addAll(cats); + updateVisibility(voicePromtsAdapter, voicePromtsTextView, voicePromtsListView); + } + } + + private void updateVisibility(ArrayAdapter adapter, TextView textView, ListView listView) { + if (adapter.isEmpty()) { + textView.setVisibility(View.GONE); + listView.setVisibility(View.GONE); + } else { + textView.setVisibility(View.VISIBLE); + listView.setVisibility(View.VISIBLE); + setListViewHeightBasedOnChildren(listView); + } + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + MenuItem item = menu.add(0, RELOAD_ID, 0, R.string.shared_string_refresh); + item.setIcon(R.drawable.ic_action_refresh_dark); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == RELOAD_ID) { + // re-create the thread + DownloadActivity.downloadListIndexThread.runReloadIndexFiles(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private DownloadActivity getDownloadActivity() { + return (DownloadActivity) getActivity(); + } + + public void onCategorizationFinished() { + if (builder.build()) { + fillWorldRegionsAdapter(); + fillWorldMapsAdapter(); + fillVoicePromtsAdapter(); + } + } + + private static class WorldRegionsAdapter extends ArrayAdapter { + private final OsmandApplication osmandApplication; + + public WorldRegionsAdapter(Context context, OsmandApplication osmandApplication) { + super(context, R.layout.simple_list_menu_item); + this.osmandApplication = osmandApplication; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + if (convertView == null) { + convertView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.simple_list_menu_item, parent, false); + viewHolder = new ViewHolder(); + viewHolder.textView = (TextView) convertView.findViewById(R.id.title); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + Drawable iconLeft = osmandApplication.getIconsCache() + .getContentIcon(R.drawable.ic_world_globe_dark); + viewHolder.textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null); + viewHolder.textView.setText(getItem(position).getName()); + return convertView; + } + + private static class ViewHolder { + TextView textView; + } + } + + private static class WorldMapsAdapter extends ArrayAdapter { + + public WorldMapsAdapter(Context context) { + super(context, R.layout.simple_list_menu_item); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ItemViewHolder viewHolder; + if (convertView == null) { + convertView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.two_line_with_images_list_item, parent, false); + viewHolder = new ItemViewHolder(convertView); + convertView.setTag(viewHolder); + } else { + viewHolder = (ItemViewHolder) convertView.getTag(); + } + ItemsListBuilder.ResourceItem item = getItem(position); + viewHolder.bindIndexItem(item.getIndexItem(), (DownloadActivity) getContext(), false, false); + return convertView; + } + + private static class ViewHolder { + TextView textView; + } + } + + private static class VoicePromtsAdapter extends ArrayAdapter { + private final OsmandApplication osmandApplication; + + public VoicePromtsAdapter(Context context, OsmandApplication osmandApplication) { + super(context, R.layout.simple_list_menu_item); + this.osmandApplication = osmandApplication; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + if (convertView == null) { + convertView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.simple_list_menu_item, parent, false); + viewHolder = new ViewHolder(); + viewHolder.textView = (TextView) convertView.findViewById(R.id.title); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + Drawable iconLeft = osmandApplication.getIconsCache() + .getContentIcon(R.drawable.ic_world_globe_dark); + viewHolder.textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null); + viewHolder.textView.setText(getItem(position).toString()); + return convertView; + } + + private static class ViewHolder { + TextView textView; + } + } + +} diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java index 4640b42505..2b193eaf2d 100644 --- a/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/MapsInCategoryFragment.java @@ -1,5 +1,6 @@ package net.osmand.plus.download.newimplementation; +import android.content.res.Resources; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; @@ -7,12 +8,14 @@ import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ProgressBar; +import android.widget.TextView; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; -import net.osmand.plus.helpers.HasName; +import net.osmand.plus.download.DownloadActivity; import org.apache.commons.logging.Log; @@ -20,6 +23,7 @@ public class MapsInCategoryFragment extends DialogFragment { private static final Log LOG = PlatformUtil.getLog(IndexItemCategoryWithSubcat.class); public static final String TAG = "MapsInCategoryFragment"; private static final String CATEGORY = "category"; + private MapDownloadListener mProgressListener; @Override public void onCreate(Bundle savedInstanceState) { @@ -33,7 +37,7 @@ public class MapsInCategoryFragment extends DialogFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.maps_in_category_fragment, container, false); + final View view = inflater.inflate(R.layout.maps_in_category_fragment, container, false); IndexItemCategoryWithSubcat category = getArguments().getParcelable(CATEGORY); assert category != null; @@ -51,9 +55,41 @@ public class MapsInCategoryFragment extends DialogFragment { } }); + DownloadsUiInitHelper.initFreeVersionBanner(view, + getMyActivity().getMyApplication().getSettings(), getResources()); + mProgressListener = new MapDownloadListener(view, getResources()){ + @Override + public void onFinished() { + super.onFinished(); + DownloadsUiInitHelper.initFreeVersionBanner(view, + getMyActivity().getMyApplication().getSettings(), getResources()); + } + }; + view.findViewById(R.id.downloadProgressLayout).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + } + }); return view; } + @Override + public void onResume() { + super.onResume(); + getMyActivity().setOnProgressUpdateListener(mProgressListener); + } + + @Override + public void onPause() { + super.onPause(); + getMyActivity().setOnProgressUpdateListener(null); + } + + private DownloadActivity getMyActivity() { + return (DownloadActivity) getActivity(); + } + public void onCategorySelected(@NonNull IndexItemCategoryWithSubcat category) { LOG.debug("onCategorySelected()"); createInstance(category).show(getChildFragmentManager(), TAG); @@ -68,16 +104,39 @@ public class MapsInCategoryFragment extends DialogFragment { return fragment; } - public static class Divider implements HasName { - private final String text; + private static class MapDownloadListener implements DownloadActivity.OnProgressUpdateListener { + private final View freeVersionBanner; + private final View downloadProgressLayout; + private final ProgressBar progressBar; + private final TextView leftTextView; + private final TextView rightTextView; + private final Resources resources; - public Divider(String text) { - this.text = text; + MapDownloadListener(View view, Resources resources) { + this.resources = resources; + freeVersionBanner = view.findViewById(R.id.freeVersionBanner); + downloadProgressLayout = view.findViewById(R.id.downloadProgressLayout); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + leftTextView = (TextView) view.findViewById(R.id.leftTextView); + rightTextView = (TextView) view.findViewById(R.id.rightTextView); + } + @Override + public void onProgressUpdate(int progressPercentage, int activeTasks) { + if (freeVersionBanner.getVisibility() == View.VISIBLE) { + freeVersionBanner.setVisibility(View.GONE); + downloadProgressLayout.setVisibility(View.VISIBLE); + } + progressBar.setProgress(progressPercentage); + final String format = resources.getString(R.string.downloading_number_of_fiels); + String numberOfTasks = String.format(format, activeTasks); + leftTextView.setText(numberOfTasks); + rightTextView.setText(progressPercentage + "%"); } @Override - public String getName() { - return text; + public void onFinished() { + freeVersionBanner.setVisibility(View.VISIBLE); + downloadProgressLayout.setVisibility(View.GONE); } } } diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/NewLocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/NewLocalIndexesFragment.java index 3ffdf5ae58..40f099481c 100644 --- a/OsmAnd/src/net/osmand/plus/download/newimplementation/NewLocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/NewLocalIndexesFragment.java @@ -78,7 +78,7 @@ public class NewLocalIndexesFragment extends OsmAndListFragment { } private void initMemoryConsumedCard(View header) { - ProgressBar sizeProgress = (ProgressBar) header.findViewById(R.id.memory_progress); + ProgressBar sizeProgress = (ProgressBar) header.findViewById(R.id.progressBar); File dir = getMyApplication().getAppPath("").getParentFile(); String size = formatGb.format(new Object[]{0}); int percent = 0; @@ -92,9 +92,11 @@ public class NewLocalIndexesFragment extends OsmAndListFragment { sizeProgress.setProgress(percent); String text = getString(R.string.free, size); - TextView descriptionText = (TextView) header.findViewById(R.id.memory_size); + TextView descriptionText = (TextView) header.findViewById(R.id.rightTextView); descriptionText.setText(Html.fromHtml(text)); descriptionText.setMovementMethod(LinkMovementMethod.getInstance()); + + ((TextView) header.findViewById(R.id.leftTextView)).setText(R.string.device_memory); } @Override diff --git a/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java b/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java index cb36323689..fcdd1ca970 100644 --- a/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/newimplementation/SubcategoriesFragment.java @@ -18,7 +18,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.download.BaseDownloadActivity; import net.osmand.plus.download.DownloadActivity; @@ -43,14 +42,10 @@ public class SubcategoriesFragment extends Fragment { mAdapter.addAll(category.items); mAdapter.addAll(category.subcats); - View freeVersionBanner = inflater.inflate(R.layout.free_version_banner, listView, false); - final OsmandSettings settings = application.getSettings(); - DownloadsUiInitHelper.initFreeVersionBanner(freeVersionBanner, settings, getResources()); - listView.addHeaderView(freeVersionBanner); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - final HasName item = mAdapter.getItem(position - 1); + final HasName item = mAdapter.getItem(position); if (item instanceof IndexItemCategoryWithSubcat) { ((MapsInCategoryFragment) getParentFragment()) .onCategorySelected((IndexItemCategoryWithSubcat) item); @@ -139,9 +134,6 @@ public class SubcategoriesFragment extends Fragment { public void onClick(View v) { ((BaseDownloadActivity) v.getContext()) .startDownload((IndexItem) v.getTag(R.id.index_item)); - progressBar.setVisibility(View.VISIBLE); - rightImageButton.setImageDrawable(getContextIcon(context, - R.drawable.ic_action_remove_dark)); } }); progressBar.setVisibility(View.GONE); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java index 14f33d89d6..a83f40831d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java @@ -151,7 +151,6 @@ public class AdvancedDataFragment extends Fragment public class TagAdapterLinearLayoutHack { private final LinearLayout linearLayout; private final EditPoiData editPoiData; - private final MapPoiTypes mapPoiTypes; private final Map allTypes; private final HashSet tagKeys; private final HashSet valueKeys; @@ -162,7 +161,6 @@ public class AdvancedDataFragment extends Fragment MapPoiTypes mapPoiTypes) { this.linearLayout = linearLayout; this.editPoiData = editPoiData; - this.mapPoiTypes = mapPoiTypes; this.allTypes = mapPoiTypes.getAllTypesTranslatedNames(new StringMatcher() { @Override public boolean matches(String name) { @@ -183,6 +181,9 @@ public class AdvancedDataFragment extends Fragment linearLayout.removeAllViews(); editPoiData.setIsInEdit(true); for (Entry tag : editPoiData.getTagValues().entrySet()) { + if(tag.getKey().equals(EditPoiData.POI_TYPE_TAG) + || tag.getKey().equals(OSMSettings.OSMTagKey.NAME.getValue())) + continue; addTagView(tag.getKey(), tag.getValue()); } editPoiData.setIsInEdit(false); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java index a14238a627..affa4f162c 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java @@ -36,7 +36,7 @@ import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule; import org.apache.commons.logging.Log; public class BasicDataFragment extends Fragment - implements EditPoiFragment.OnFragmentActivatedListener{ + implements EditPoiFragment.OnFragmentActivatedListener { private static final String TAG = "BasicDataFragment"; private static final Log LOG = PlatformUtil.getLog(BasicDataFragment.class); private static final String OPENING_HOURS = "opening_hours"; @@ -126,29 +126,6 @@ public class BasicDataFragment extends Fragment return (OsmandApplication) getActivity().getApplication(); } - @Override - public void onResume() { - super.onResume(); - - // FIXME opening hours -// @Override -// public void process( String openingHoursString ) { -// parseOpenedHoursHandleErrors(openingHoursString); -// if (openingHours == null) { -// openingHours = new OpeningHoursParser.OpeningHours(); -// } -// LOG.debug("openingHours=" + openingHours); -// adapter.replaceOpeningHours(openingHours); -// adapter.updateViews(); -// } -// -// @Override -// public void onUntriggered() { -// adapter.replaceOpeningHours(new OpeningHoursParser.OpeningHours()); -// adapter.updateViews(); -// } - } - protected void addTextWatcher(final String tag, final EditText e) { e.addTextChangedListener(new TextWatcher() { @@ -186,7 +163,6 @@ public class BasicDataFragment extends Fragment } - private EditPoiFragment getEditPoiFragment() { return (EditPoiFragment) getParentFragment(); } @@ -195,19 +171,6 @@ public class BasicDataFragment extends Fragment return getEditPoiFragment().getEditPoiData(); } - private static String formatTime(int h, int t) { - StringBuilder b = new StringBuilder(); - if (h < 10) { - b.append("0"); //$NON-NLS-1$ - } - b.append(h).append(":"); //$NON-NLS-1$ - if (t < 10) { - b.append("0"); //$NON-NLS-1$ - } - b.append(t); - return b.toString(); - } - @Override public void onFragmentActivated() { streetEditText.setText(getData().getTagValues() @@ -220,6 +183,16 @@ public class BasicDataFragment extends Fragment .get(OSMSettings.OSMTagKey.WEBSITE.getValue())); descriptionEditText.setText(getData().getTagValues() .get(OSMSettings.OSMTagKey.DESCRIPTION.getValue())); + + OpeningHoursParser.OpeningHours openingHours = + OpeningHoursParser.parseOpenedHoursHandleErrors(getData().getTagValues() + .get(OSMSettings.OSMTagKey.OPENING_HOURS.getValue())); + if (openingHours == null) { + openingHours = new OpeningHoursParser.OpeningHours(); + } + LOG.debug("openingHours=" + openingHours); + mOpeningHoursAdapter.replaceOpeningHours(openingHours); + mOpeningHoursAdapter.updateViews(); } private class OpeningHoursAdapter { @@ -282,10 +255,10 @@ public class BasicDataFragment extends Fragment daysTextView.setText(stringBuilder.toString()); TextView openingTextView = (TextView) view.findViewById(R.id.openingTextView); - openingTextView.setText(Algorithms.formatDuration(rule.getStartTime() * 60)); + openingTextView.setText(Algorithms.formatMinutesDuration(rule.getStartTime())); TextView closingTextView = (TextView) view.findViewById(R.id.closingTextView); - closingTextView.setText(Algorithms.formatDuration(rule.getStartTime() * 60)); + closingTextView.setText(Algorithms.formatMinutesDuration(rule.getEndTime())); timeContainer.setVisibility(View.VISIBLE); daysTextView.setOnClickListener(new View.OnClickListener() {