merge
|
@ -422,9 +422,10 @@ public class OsmandRegions {
|
||||||
}
|
}
|
||||||
fullNamesToLocaleNames.put(fullName, locPrefix + " " + locName);
|
fullNamesToLocaleNames.put(fullName, locPrefix + " " + locName);
|
||||||
fullNamesNoParentToLocaleNames.put(fullName, locName);
|
fullNamesNoParentToLocaleNames.put(fullName, locName);
|
||||||
String index = fullNamesToLowercaseIndex.get(fullName);
|
// don't add parent to index
|
||||||
String prindex = fullNamesToLowercaseIndex.get(parentFullName);
|
// String index = fullNamesToLowercaseIndex.get(fullName);
|
||||||
fullNamesToLowercaseIndex.put(fullName, index + " " + prindex);
|
// String prindex = fullNamesToLowercaseIndex.get(parentFullName);
|
||||||
|
// fullNamesToLowercaseIndex.put(fullName, index + " " + prindex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
OsmAnd/res/drawable-hdpi/map_favorite.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-hdpi/map_white_favorite_shield.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
OsmAnd/res/drawable-mdpi/map_favorite.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/map_white_favorite_shield.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
OsmAnd/res/drawable-xhdpi/map_favorite.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/map_white_favorite_shield.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/map_favorite.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/map_white_favorite_shield.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
22
OsmAnd/res/drawable/fab_background_normal.xml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<bitmap
|
||||||
|
android:gravity="fill"
|
||||||
|
android:src="@drawable/map_bt_round_1_shadow" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
|
||||||
|
<inset
|
||||||
|
android:insetBottom="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetLeft="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetRight="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetTop="@dimen/map_button_inset_shadow" >
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
<solid android:color="@color/fab_color" />
|
||||||
|
</shape>
|
||||||
|
</inset>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
21
OsmAnd/res/drawable/fab_background_pressed.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<bitmap
|
||||||
|
android:gravity="fill"
|
||||||
|
android:src="@drawable/map_bt_round_1_shadow" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
|
||||||
|
<inset
|
||||||
|
android:insetBottom="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetLeft="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetRight="@dimen/map_button_inset_shadow"
|
||||||
|
android:insetTop="@dimen/map_button_inset_shadow" >
|
||||||
|
<shape android:shape="oval" >
|
||||||
|
<solid android:color="@color/fab_color_pressed" />
|
||||||
|
</shape>
|
||||||
|
</inset>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
5
OsmAnd/res/drawable/fab_background_style.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/fab_background_pressed" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@drawable/fab_background_normal"></item>
|
||||||
|
</selector>
|
|
@ -190,11 +190,11 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/context_menu_fab_view"
|
android:id="@+id/context_menu_fab_view"
|
||||||
android:layout_width="@dimen/map_button_size"
|
android:layout_width="@dimen/fab_size_with_shadow"
|
||||||
android:layout_height="@dimen/map_button_size"
|
android:layout_height="@dimen/fab_size_with_shadow"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:layout_marginRight="12dp"
|
android:layout_marginRight="12dp"
|
||||||
android:background="@drawable/btn_circle_blue"
|
android:background="@drawable/fab_background_style"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/map_directions"/>
|
android:src="@drawable/map_directions"/>
|
||||||
|
|
||||||
|
|
|
@ -608,10 +608,10 @@
|
||||||
<string name="index_name_europe">Эўропа</string>
|
<string name="index_name_europe">Эўропа</string>
|
||||||
<string name="index_name_france">Эўропа - Францыя</string>
|
<string name="index_name_france">Эўропа - Францыя</string>
|
||||||
<string name="index_name_germany">Эўропа - Германія</string>
|
<string name="index_name_germany">Эўропа - Германія</string>
|
||||||
<string name="index_name_russia">Эўразія - РФ</string>
|
<string name="index_name_russia">РФ</string>
|
||||||
<string name="index_name_africa">Афрыка</string>
|
<string name="index_name_africa">Афрыка</string>
|
||||||
<string name="index_name_asia">Азія</string>
|
<string name="index_name_asia">Азія</string>
|
||||||
<string name="index_name_oceania">Акеанія</string>
|
<string name="index_name_oceania">Аўстралія і Акеанія</string>
|
||||||
<string name="index_name_other">Сусьветныя і тэматычныя мапы</string>
|
<string name="index_name_other">Сусьветныя і тэматычныя мапы</string>
|
||||||
<string name="index_name_wiki">Сусьветная Вікіпэдыя</string>
|
<string name="index_name_wiki">Сусьветная Вікіпэдыя</string>
|
||||||
<string name="index_name_voice">Галасавыя падказкі (запісаныя, абмежаваныя магчымасьці)</string>
|
<string name="index_name_voice">Галасавыя падказкі (запісаныя, абмежаваныя магчымасьці)</string>
|
||||||
|
@ -2145,5 +2145,7 @@
|
||||||
<string name="confirm_download_roadmaps">Вы ўпэўненыя, што хочаце сьцягнуць мапу аўтадарог, нават калі ў вас ёсць поўная мапа?</string>
|
<string name="confirm_download_roadmaps">Вы ўпэўненыя, што хочаце сьцягнуць мапу аўтадарог, нават калі ў вас ёсць поўная мапа?</string>
|
||||||
<string name="value_downloaded_from_max">%1$.1f з %2$.1f Мб</string>
|
<string name="value_downloaded_from_max">%1$.1f з %2$.1f Мб</string>
|
||||||
<string name="file_size_in_mb">%.1f Мб</string>
|
<string name="file_size_in_mb">%.1f Мб</string>
|
||||||
<string name="update_all">Абнавіць усе (%1$s Мб)</string>
|
<string name="update_all">Абнавіць усе (%1$s МБ)</string>
|
||||||
</resources>
|
<string name="free_downloads_used">Выкарыстана бясплатных загрузак</string>
|
||||||
|
<string name="free_downloads_used_description">Вы можаце паглядзець колькі бясплатных загрузак вы выкарысталі</string>
|
||||||
|
</resources>
|
||||||
|
|
|
@ -341,7 +341,7 @@
|
||||||
<string name="poi_fuel_e10">E10 (10% Bioetanol)</string>
|
<string name="poi_fuel_e10">E10 (10% Bioetanol)</string>
|
||||||
<string name="poi_fuel_e20">E20 (20% Etanol)</string>
|
<string name="poi_fuel_e20">E20 (20% Etanol)</string>
|
||||||
<string name="poi_fuel_e85">E85 - (85% Etanol)</string>
|
<string name="poi_fuel_e85">E85 - (85% Etanol)</string>
|
||||||
<string name="poi_fuel_biogas">E85 - (85% Etanol)</string>
|
<string name="poi_fuel_biogas">Etanol</string>
|
||||||
<string name="poi_fuel_lh2">Kapalný vodík</string>
|
<string name="poi_fuel_lh2">Kapalný vodík</string>
|
||||||
<string name="poi_fuel_electricity">Nabíjení</string>
|
<string name="poi_fuel_electricity">Nabíjení</string>
|
||||||
<string name="poi_vehicle_ramp">Servisní rampa</string>
|
<string name="poi_vehicle_ramp">Servisní rampa</string>
|
||||||
|
@ -487,7 +487,7 @@
|
||||||
<string name="poi_research">Výzkumný ústav</string>
|
<string name="poi_research">Výzkumný ústav</string>
|
||||||
<string name="poi_it">Informační technologie</string>
|
<string name="poi_it">Informační technologie</string>
|
||||||
<string name="poi_newspaper">Redakce novin</string>
|
<string name="poi_newspaper">Redakce novin</string>
|
||||||
<string name="poi_architect">Architekt</string>
|
<string name="poi_architect">Architektonická kancelář</string>
|
||||||
<string name="poi_advertising_agency">Reklamní kancelář</string>
|
<string name="poi_advertising_agency">Reklamní kancelář</string>
|
||||||
<string name="poi_educational_institution">Vzdělávací instituce</string>
|
<string name="poi_educational_institution">Vzdělávací instituce</string>
|
||||||
<string name="poi_studio">Studio</string>
|
<string name="poi_studio">Studio</string>
|
||||||
|
|
|
@ -2249,4 +2249,6 @@
|
||||||
<string name="poi_step_condition_uneven">Trintilstand: ujævn</string>
|
<string name="poi_step_condition_uneven">Trintilstand: ujævn</string>
|
||||||
<string name="poi_step_condition_rough">Trintilstand: ru</string>
|
<string name="poi_step_condition_rough">Trintilstand: ru</string>
|
||||||
|
|
||||||
|
<string name="poi_cairn">Varde</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1307,10 +1307,10 @@
|
||||||
<string name="index_name_europe">Europa</string>
|
<string name="index_name_europe">Europa</string>
|
||||||
<string name="index_name_france">Europa - Francia</string>
|
<string name="index_name_france">Europa - Francia</string>
|
||||||
<string name="index_name_germany">Europa - Alemania</string>
|
<string name="index_name_germany">Europa - Alemania</string>
|
||||||
<string name="index_name_russia">Europa/Asia - Rusia</string>
|
<string name="index_name_russia">Rusia</string>
|
||||||
<string name="index_name_africa">África</string>
|
<string name="index_name_africa">África</string>
|
||||||
<string name="index_name_asia">Asia</string>
|
<string name="index_name_asia">Asia</string>
|
||||||
<string name="index_name_oceania">Oceanía</string>
|
<string name="index_name_oceania">Australia y Oceanía</string>
|
||||||
<string name="index_name_other">Mapas mundiales y temáticos</string>
|
<string name="index_name_other">Mapas mundiales y temáticos</string>
|
||||||
<string name="index_name_wiki">Wikipedia mundial</string>
|
<string name="index_name_wiki">Wikipedia mundial</string>
|
||||||
<string name="index_name_voice">Avisos de voz (grabado, funciones limitadas)</string>
|
<string name="index_name_voice">Avisos de voz (grabado, funciones limitadas)</string>
|
||||||
|
|
|
@ -852,7 +852,7 @@
|
||||||
<string name="index_name_europe">Europa</string>
|
<string name="index_name_europe">Europa</string>
|
||||||
<string name="index_name_france">Europa - Francia</string>
|
<string name="index_name_france">Europa - Francia</string>
|
||||||
<string name="index_name_germany">Europa - Germania</string>
|
<string name="index_name_germany">Europa - Germania</string>
|
||||||
<string name="index_name_russia">Europa/Asia - Russia</string>
|
<string name="index_name_russia">Russia</string>
|
||||||
<string name="index_name_africa">Africa</string>
|
<string name="index_name_africa">Africa</string>
|
||||||
<string name="index_name_asia">Asia</string>
|
<string name="index_name_asia">Asia</string>
|
||||||
<string name="index_name_oceania">Oceania</string>
|
<string name="index_name_oceania">Oceania</string>
|
||||||
|
|
|
@ -1576,13 +1576,13 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
||||||
<string name="routing_attr_prefer_motorway_description">Gebruik bij voorkeur autowegen</string>
|
<string name="routing_attr_prefer_motorway_description">Gebruik bij voorkeur autowegen</string>
|
||||||
<string name="routing_attr_short_way_name">Kortste route</string>
|
<string name="routing_attr_short_way_name">Kortste route</string>
|
||||||
<string name="routing_attr_short_way_description">Kortste route gebruiken</string>
|
<string name="routing_attr_short_way_description">Kortste route gebruiken</string>
|
||||||
<string name="routing_attr_avoid_toll_name">Geen tolwegen</string>
|
<string name="routing_attr_avoid_toll_name">Vermijd tolwegen</string>
|
||||||
<string name="routing_attr_avoid_toll_description">Vermijd tolwegen</string>
|
<string name="routing_attr_avoid_toll_description">Vermijd tolwegen</string>
|
||||||
<string name="routing_attr_avoid_unpaved_name">Geen onverharde wegen</string>
|
<string name="routing_attr_avoid_unpaved_name">Vermijd onverharde wegen</string>
|
||||||
<string name="routing_attr_avoid_unpaved_description">Vermijd onverharde wegen</string>
|
<string name="routing_attr_avoid_unpaved_description">Vermijd onverharde wegen</string>
|
||||||
<string name="routing_attr_avoid_ferries_name">Geen veerboten</string>
|
<string name="routing_attr_avoid_ferries_name">Vermijd veerboten</string>
|
||||||
<string name="routing_attr_avoid_ferries_description">Vermijd veerboten</string>
|
<string name="routing_attr_avoid_ferries_description">Vermijd veerboten</string>
|
||||||
<string name="routing_attr_avoid_motorway_name">Geen autowegen</string>
|
<string name="routing_attr_avoid_motorway_name">Vermijd autowegen</string>
|
||||||
<string name="routing_attr_avoid_motorway_description">Vermijd autowegen</string>
|
<string name="routing_attr_avoid_motorway_description">Vermijd autowegen</string>
|
||||||
<string name="routing_attr_weight_description">Geef het gewicht van het voertuig voor de routeplanning</string>
|
<string name="routing_attr_weight_description">Geef het gewicht van het voertuig voor de routeplanning</string>
|
||||||
<string name="routing_attr_weight_name">Gewicht voertuig</string>
|
<string name="routing_attr_weight_name">Gewicht voertuig</string>
|
||||||
|
@ -1838,7 +1838,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
||||||
<string name="lang_sw">Swahili</string>
|
<string name="lang_sw">Swahili</string>
|
||||||
<string name="lang_he">Hebreeuws</string>
|
<string name="lang_he">Hebreeuws</string>
|
||||||
<string name="forward">Vooruit</string>
|
<string name="forward">Vooruit</string>
|
||||||
<string name="home">Thuis</string>
|
<string name="home">Overzicht</string>
|
||||||
<string name="live_monitoring_m_descr">Stuur tracking-data naar een webservice als een GPX-track wordt gemaakt.</string>
|
<string name="live_monitoring_m_descr">Stuur tracking-data naar een webservice als een GPX-track wordt gemaakt.</string>
|
||||||
<string name="live_monitoring_m">Online tracking (GPX vereist)</string>
|
<string name="live_monitoring_m">Online tracking (GPX vereist)</string>
|
||||||
<string name="live_monitoring_start">Start online tracking</string>
|
<string name="live_monitoring_start">Start online tracking</string>
|
||||||
|
@ -1848,7 +1848,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
||||||
<string name="gpx_start_new_segment">Start nieuw segment</string>
|
<string name="gpx_start_new_segment">Start nieuw segment</string>
|
||||||
<string name="keep_navigation_service">Houden</string>
|
<string name="keep_navigation_service">Houden</string>
|
||||||
<string name="stop_navigation_service">Onderbreek</string>
|
<string name="stop_navigation_service">Onderbreek</string>
|
||||||
<string name="enable_sleep_mode">GPS Slaapstand inschakelen</string>
|
<string name="enable_sleep_mode">GPS slaapstand inschakelen</string>
|
||||||
<string name="gps_wake_up_timer">GPS ontwaak-interval</string>
|
<string name="gps_wake_up_timer">GPS ontwaak-interval</string>
|
||||||
<string name="sleep_mode_stop_dialog">Onderbreek GPS slaapstand?</string>
|
<string name="sleep_mode_stop_dialog">Onderbreek GPS slaapstand?</string>
|
||||||
<string name="lang_fa">Perzisch</string>
|
<string name="lang_fa">Perzisch</string>
|
||||||
|
@ -2269,4 +2269,41 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
||||||
<string name="try_again">Probeer het opnieuw</string>
|
<string name="try_again">Probeer het opnieuw</string>
|
||||||
<string name="error_message_pattern">Fout: {0}</string>
|
<string name="error_message_pattern">Fout: {0}</string>
|
||||||
<string name="rate_this_app_long">Wilt u OsmAnd beoordelen op Google Play? Alvast heel erg bedankt.</string>
|
<string name="rate_this_app_long">Wilt u OsmAnd beoordelen op Google Play? Alvast heel erg bedankt.</string>
|
||||||
</resources>
|
<string name="favorite_category_dublicate_message">Deze categorienaam bestaat al. Kies een andere.</string>
|
||||||
|
<string name="favorite_category_name">Categorienaam</string>
|
||||||
|
<string name="favorite_category_add_new_title">Voeg categorie toe</string>
|
||||||
|
<string name="regions">Regio\'s</string>
|
||||||
|
<string name="region_maps">Kaarten van regio\'s</string>
|
||||||
|
<string name="world_maps">Wereldkaarten</string>
|
||||||
|
<string name="hillshade_layer_disabled">Reliëfschaduw uitgeschakeld</string>
|
||||||
|
<string name="srtm_plugin_disabled">Hoogtelijnen uitgeschakeld</string>
|
||||||
|
<string name="favorite_category_add_new">Categorie toevoegen</string>
|
||||||
|
<string name="favorite_category_select">Kies categorie</string>
|
||||||
|
<string name="default_speed_system_descr">Systeem om snelheid te meten</string>
|
||||||
|
<string name="default_speed_system">Snelheidsmeting</string>
|
||||||
|
<string name="nm">nm</string>
|
||||||
|
<string name="si_nm">Zeemijlen</string>
|
||||||
|
<string name="si_kmh">Kilometer per uur</string>
|
||||||
|
<string name="si_mph">Mijl per uur</string>
|
||||||
|
<string name="si_m_s">Meter per seconde</string>
|
||||||
|
<string name="si_min_km">Minuten per kilometer</string>
|
||||||
|
<string name="si_min_m">Minuten per mijl</string>
|
||||||
|
<string name="si_nm_h">Zeemijlen per uur (knopen)</string>
|
||||||
|
<string name="nm_h">Knopen</string>
|
||||||
|
<string name="min_mile">min/m</string>
|
||||||
|
<string name="min_km">min/km</string>
|
||||||
|
<string name="m_s">m/s</string>
|
||||||
|
|
||||||
|
<string name="shared_string_trip_recording">Spoor registreren</string>
|
||||||
|
<string name="shared_string_navigation">Navigatie</string>
|
||||||
|
<string name="favourites_edit_dialog_title">Eigenschappen van favoriet</string>
|
||||||
|
<string name="simulate_your_location_stop_descr">Stop simuleren van positie</string>
|
||||||
|
<string name="simulate_your_location_descr">Simuleer met een GPX-spoor of een berekende route</string>
|
||||||
|
<string name="address_unknown">Adres nog niet bekend</string>
|
||||||
|
<string name="av_locations_descr">GPX-bestand met aantekeningen</string>
|
||||||
|
<string name="av_locations">Locaties</string>
|
||||||
|
<string name="plugin_settings">Plugins</string>
|
||||||
|
<string name="routing_attr_avoid_shuttle_train_name">Vermijd shuttle-trein</string>
|
||||||
|
<string name="routing_attr_avoid_shuttle_train_description">Vermijd shuttle-trein</string>
|
||||||
|
<string name="shared_string_wikipedia">Wikipedia</string>
|
||||||
|
</resources>
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
<string name="poi_service_tyres">Шиномонтаж</string>
|
<string name="poi_service_tyres">Шиномонтаж</string>
|
||||||
<string name="poi_vehicle_inspection">Пункт техосмотра</string>
|
<string name="poi_vehicle_inspection">Пункт техосмотра</string>
|
||||||
<string name="poi_car_wash">Автомойка</string>
|
<string name="poi_car_wash">Автомойка</string>
|
||||||
<string name="poi_fuel">Заправка</string>
|
<string name="poi_fuel">Автомобильная заправка</string>
|
||||||
<string name="poi_charging_station">Зарядная станция</string>
|
<string name="poi_charging_station">Зарядная станция</string>
|
||||||
<string name="poi_vehicle_ramp">Ремонтная эстакада/яма</string>
|
<string name="poi_vehicle_ramp">Ремонтная эстакада/яма</string>
|
||||||
<string name="poi_compressed_air">Компрессор для подкачки шин</string>
|
<string name="poi_compressed_air">Компрессор для подкачки шин</string>
|
||||||
|
@ -2199,5 +2199,21 @@
|
||||||
<string name="poi_step_condition_uneven">Состояние ступеней: среднее</string>
|
<string name="poi_step_condition_uneven">Состояние ступеней: среднее</string>
|
||||||
<string name="poi_step_condition_rough">Состояние ступеней: плохое</string>
|
<string name="poi_step_condition_rough">Состояние ступеней: плохое</string>
|
||||||
|
|
||||||
|
<string name="poi_cairn">Пирамида из камней</string>
|
||||||
|
|
||||||
|
<string name="poi_memorial_fassade_decoration">Фасадная декорация</string>
|
||||||
|
<string name="poi_defibrillator">Дефибриллятор</string>
|
||||||
|
<string name="poi_defibrillator_yes">Дефибриллятор: есть</string>
|
||||||
|
|
||||||
|
<string name="poi_tomb_war_grave">Тип: братская могила</string>
|
||||||
|
<string name="poi_tomb_tumulus">Тип: тумулус</string>
|
||||||
|
<string name="poi_tomb_rock_cut">Тип: вырезанная в камне</string>
|
||||||
|
<string name="poi_tomb_hypogeum">Тип: гипогей</string>
|
||||||
|
<string name="poi_tomb_vault">Тип: усыпальница</string>
|
||||||
|
<string name="poi_tomb_columbarium">Тип: колумбарий</string>
|
||||||
|
<string name="poi_tomb_mausoleum">Тип: мавзолей</string>
|
||||||
|
<string name="poi_tomb_sarcophagus">Тип: саркофаг</string>
|
||||||
|
<string name="poi_tomb_crypt">Тип: крипта</string>
|
||||||
|
<string name="poi_tomb_pyramid">Тип: пирамида</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -2146,4 +2146,6 @@
|
||||||
<string name="value_downloaded_from_max">%1$.1f из %2$.1f Мб</string>
|
<string name="value_downloaded_from_max">%1$.1f из %2$.1f Мб</string>
|
||||||
<string name="file_size_in_mb">%.1f Мб</string>
|
<string name="file_size_in_mb">%.1f Мб</string>
|
||||||
<string name="update_all">Обновить все (%1$s Мб)</string>
|
<string name="update_all">Обновить все (%1$s Мб)</string>
|
||||||
|
<string name="free_downloads_used">Использовано бесплатных загрузок</string>
|
||||||
|
<string name="free_downloads_used_description">Вы можете посмотреть сколько бесплатных загрузок вы использовали</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1064,12 +1064,12 @@
|
||||||
|
|
||||||
<string name="poi_sand">Arena</string>
|
<string name="poi_sand">Arena</string>
|
||||||
|
|
||||||
<string name="poi_smoking_isolated">Si podet pipare in un’aposentu indipendente e iscrobadu de su totu</string>
|
<string name="poi_smoking_isolated">Si podet pipare in un’aposentu isoladu</string>
|
||||||
<string name="poi_smoking_dedicated">Pipadores ebbia</string>
|
<string name="poi_smoking_dedicated">Pipadores ebbia</string>
|
||||||
|
|
||||||
<string name="poi_toll_yes">B’est de pagare unu pedàgiu</string>
|
<string name="poi_toll_yes">Pedàgiu</string>
|
||||||
<string name="poi_toll_no">Non b’est perunu pedàgiu</string>
|
<string name="poi_toll_no">Perunu pedàgiu</string>
|
||||||
<string name="poi_toll_hgv_yes">B’est de pagare unu pedàgiu pro veìculos pesantes</string>
|
<string name="poi_toll_hgv_yes">Pedàgiu pro veìculos pesantes</string>
|
||||||
<string name="poi_information_bicyclemap">Mapa tziclìstica</string>
|
<string name="poi_information_bicyclemap">Mapa tziclìstica</string>
|
||||||
<string name="poi_water_characteristic_mineral">Caraterìstica de s’abba: minerale</string>
|
<string name="poi_water_characteristic_mineral">Caraterìstica de s’abba: minerale</string>
|
||||||
<string name="poi_water_characteristic_mud">Caraterìsica de s’abba: ludu</string>
|
<string name="poi_water_characteristic_mud">Caraterìsica de s’abba: ludu</string>
|
||||||
|
@ -1084,7 +1084,7 @@
|
||||||
<string name="poi_information_office">Ufìtziu de informatziones</string>
|
<string name="poi_information_office">Ufìtziu de informatziones</string>
|
||||||
<string name="poi_information_terminal">Tèrminal de informatziones</string>
|
<string name="poi_information_terminal">Tèrminal de informatziones</string>
|
||||||
<string name="poi_information_hikingmap">Mapa pro escursionismu</string>
|
<string name="poi_information_hikingmap">Mapa pro escursionismu</string>
|
||||||
<string name="poi_information_history">Informatziones istòricas</string>
|
<string name="poi_information_history">Sinnale de informatziones: istòria</string>
|
||||||
<string name="poi_information_sign">Sinnu</string>
|
<string name="poi_information_sign">Sinnu</string>
|
||||||
<string name="poi_information_audioguide">Audioghia</string>
|
<string name="poi_information_audioguide">Audioghia</string>
|
||||||
<string name="poi_internet_access_yes">Atzessu a ìnternet: eja</string>
|
<string name="poi_internet_access_yes">Atzessu a ìnternet: eja</string>
|
||||||
|
@ -1299,4 +1299,32 @@
|
||||||
<string name="poi_pump">Pompa</string>
|
<string name="poi_pump">Pompa</string>
|
||||||
|
|
||||||
<string name="poi_building">Edifìtziu</string>
|
<string name="poi_building">Edifìtziu</string>
|
||||||
|
<string name="poi_information_guidepost">Indicadore istradale</string>
|
||||||
|
<string name="poi_information_nature">Sinnale de informatziones: natura</string>
|
||||||
|
<string name="poi_information_wildlife">Sinnale de informatziones: fàuna agreste</string>
|
||||||
|
<string name="poi_information_tactile_model">Modellu tàtile</string>
|
||||||
|
<string name="poi_information_tactile_map">Mapa tàtile</string>
|
||||||
|
<string name="poi_board_type_plants">Sinnale de informatziones: fundos/prantas</string>
|
||||||
|
<string name="poi_board_type_geology">Sinnale de informatziones: geologia</string>
|
||||||
|
<string name="poi_board_type_public_transport">Sinnale de informatziones: trasportu pùblicu</string>
|
||||||
|
<string name="poi_board_type_technology">Sinnale de informatziones: tecnologia</string>
|
||||||
|
<string name="poi_board_type_astronomy">Sinnale de informatziones: astronomia</string>
|
||||||
|
|
||||||
|
<string name="poi_fireplace_yes">Tziminera</string>
|
||||||
|
<string name="poi_fireplace_no">Chene tziminera</string>
|
||||||
|
|
||||||
|
<string name="poi_covered_yes">Cobertu</string>
|
||||||
|
<string name="poi_covered_no">Chene cobertura</string>
|
||||||
|
|
||||||
|
<string name="poi_smoking_no">Non si podet pipare</string>
|
||||||
|
<string name="poi_smoking_outside">Si podet pipare in foras ebbia</string>
|
||||||
|
<string name="poi_smoking_yes">Si podet pipare</string>
|
||||||
|
<string name="poi_smoking_separated">Si podet pipare in un’aposentu a un’ala</string>
|
||||||
|
<string name="poi_tactile_paving_yes">Cun pamentu tàtile</string>
|
||||||
|
<string name="poi_tactile_paving_no">Chene pamentu tàtile</string>
|
||||||
|
<string name="poi_traffic_signals_sound_yes">Cun sonu</string>
|
||||||
|
<string name="poi_traffic_signals_sound_no">Chene sonu</string>
|
||||||
|
<string name="poi_traffic_signals_sound_walk">Cun sonu petzi cando est possìbile colare</string>
|
||||||
|
|
||||||
|
<string name="poi_services">Àrea de servìtziu</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -894,10 +894,10 @@
|
||||||
<string name="index_name_europe">Europa</string>
|
<string name="index_name_europe">Europa</string>
|
||||||
<string name="index_name_france">Europa - Frantza</string>
|
<string name="index_name_france">Europa - Frantza</string>
|
||||||
<string name="index_name_germany">Europa - Germània</string>
|
<string name="index_name_germany">Europa - Germània</string>
|
||||||
<string name="index_name_russia">Europa/Àsia - Rùssia</string>
|
<string name="index_name_russia">Rùssia</string>
|
||||||
<string name="index_name_africa">Àfrica</string>
|
<string name="index_name_africa">Àfrica</string>
|
||||||
<string name="index_name_asia">Àsia</string>
|
<string name="index_name_asia">Àsia</string>
|
||||||
<string name="index_name_oceania">Oceània</string>
|
<string name="index_name_oceania">Austràlia e Otzeània</string>
|
||||||
<string name="index_name_other">Mapas mundiales e de base</string>
|
<string name="index_name_other">Mapas mundiales e de base</string>
|
||||||
<string name="amenity_type_osmwiki">Wikipedia (non in lìnia)</string>
|
<string name="amenity_type_osmwiki">Wikipedia (non in lìnia)</string>
|
||||||
<string name="profile_settings">Impostaduras dislindadas de su profilu</string>
|
<string name="profile_settings">Impostaduras dislindadas de su profilu</string>
|
||||||
|
@ -2138,7 +2138,7 @@
|
||||||
<string name="confirm_download_roadmaps">Seguru ses de bòlere iscarrigare mapas petzi istadales, fintzas si tenes giai cussas cumpridas?</string>
|
<string name="confirm_download_roadmaps">Seguru ses de bòlere iscarrigare mapas petzi istadales, fintzas si tenes giai cussas cumpridas?</string>
|
||||||
<string name="value_downloaded_from_max">%1$.1f dae %2$.1f MB</string>
|
<string name="value_downloaded_from_max">%1$.1f dae %2$.1f MB</string>
|
||||||
<string name="file_size_in_mb">%.1f MB</string>
|
<string name="file_size_in_mb">%.1f MB</string>
|
||||||
<string name="update_all">Agiorna totu (%1$s Mb)</string>
|
<string name="update_all">Agiorna totu (%1$s MB)</string>
|
||||||
<string name="free_downloads_used">Iscarrigamentos gratùitos impreados</string>
|
<string name="free_downloads_used">Iscarrigamentos gratùitos impreados</string>
|
||||||
<string name="free_downloads_used_description">Podes impostare cantos iscarrigamentos gratùitos as impreadu</string>
|
<string name="free_downloads_used_description">Podes impostare cantos iscarrigamentos gratùitos as impreadu</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -242,10 +242,10 @@
|
||||||
<string name="index_name_france">Európa - Francúzsko</string>
|
<string name="index_name_france">Európa - Francúzsko</string>
|
||||||
<string name="index_name_germany">Európa - Nemecko</string>
|
<string name="index_name_germany">Európa - Nemecko</string>
|
||||||
<string name="index_name_europe">Európa</string>
|
<string name="index_name_europe">Európa</string>
|
||||||
<string name="index_name_russia">Európa/Ázia - Rusko</string>
|
<string name="index_name_russia">Rusko</string>
|
||||||
<string name="index_name_africa">Afrika</string>
|
<string name="index_name_africa">Afrika</string>
|
||||||
<string name="index_name_asia">Ázia</string>
|
<string name="index_name_asia">Ázia</string>
|
||||||
<string name="index_name_oceania">Oceánia</string>
|
<string name="index_name_oceania">Austrália a Oceánia</string>
|
||||||
<string name="index_name_other">Celosvetové a tematické mapy</string>
|
<string name="index_name_other">Celosvetové a tematické mapy</string>
|
||||||
<string name="index_name_wiki">Celosvetové body z Wikipedie</string>
|
<string name="index_name_wiki">Celosvetové body z Wikipedie</string>
|
||||||
<string name="index_name_voice">Hlasové povely (nahrávky, obmedzená funkcionalita)</string>
|
<string name="index_name_voice">Hlasové povely (nahrávky, obmedzená funkcionalita)</string>
|
||||||
|
|
|
@ -2048,4 +2048,5 @@
|
||||||
<string name="update_all">Uppdatera alla (%1$s MB)</string>
|
<string name="update_all">Uppdatera alla (%1$s MB)</string>
|
||||||
<string name="free_downloads_used">Gratis nedladdningar hämtade</string>
|
<string name="free_downloads_used">Gratis nedladdningar hämtade</string>
|
||||||
<string name="free_downloads_used_description">Du kan ange hur många gratis nedladdningar som du har gjort</string>
|
<string name="free_downloads_used_description">Du kan ange hur många gratis nedladdningar som du har gjort</string>
|
||||||
</resources>
|
<string name="downloading_number_of_files">Hämtar - %1$d fil(er)</string>
|
||||||
|
</resources>
|
||||||
|
|
|
@ -1977,4 +1977,13 @@
|
||||||
<string name="poi_training_aviation">培訓:航空</string>
|
<string name="poi_training_aviation">培訓:航空</string>
|
||||||
<string name="poi_training_hairdressing">培訓:美容美髮</string>
|
<string name="poi_training_hairdressing">培訓:美容美髮</string>
|
||||||
|
|
||||||
|
<string name="poi_monument_yes">紀念性物件</string>
|
||||||
|
|
||||||
|
<string name="poi_industrial_oil">類型:石油工業</string>
|
||||||
|
<string name="poi_industrial_wellsite">類型:井址</string>
|
||||||
|
<string name="poi_industrial_factory">類型:工廠</string>
|
||||||
|
<string name="poi_industrial_gas">類型:瓦斯工業</string>
|
||||||
|
<string name="poi_industrial_timber">類型:木材</string>
|
||||||
|
<string name="poi_industrial_refinery">類型:煉油廠</string>
|
||||||
|
<string name="poi_industrial_warehouse">類型:倉庫</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2124,7 +2124,7 @@
|
||||||
<string name="osmand_running_in_background">在背景執行</string>
|
<string name="osmand_running_in_background">在背景執行</string>
|
||||||
<string name="default_speed_system_descr">定義速度測定系統</string>
|
<string name="default_speed_system_descr">定義速度測定系統</string>
|
||||||
<string name="default_speed_system">測定速度</string>
|
<string name="default_speed_system">測定速度</string>
|
||||||
<string name="si_nm">海浬</string>
|
<string name="si_nm">海里</string>
|
||||||
<string name="nm">浬</string>
|
<string name="nm">浬</string>
|
||||||
<string name="si_kmh">公里每小時</string>
|
<string name="si_kmh">公里每小時</string>
|
||||||
<string name="si_mph">英里每小時</string>
|
<string name="si_mph">英里每小時</string>
|
||||||
|
|
|
@ -31,8 +31,10 @@
|
||||||
<color name="list_item_dark_pressed">#be39464d</color>
|
<color name="list_item_dark_pressed">#be39464d</color>
|
||||||
<color name="bg_color_light">#fff</color>
|
<color name="bg_color_light">#fff</color>
|
||||||
<color name="bg_color_dark">#333b40</color>
|
<color name="bg_color_dark">#333b40</color>
|
||||||
|
|
||||||
|
<color name="fab_color">#ff8f00</color>
|
||||||
|
<color name="fab_color_pressed">#e58200</color>
|
||||||
|
|
||||||
<color name="map_widget_icon_color">#ff8f00</color>
|
<color name="map_widget_icon_color">#ff8f00</color>
|
||||||
<color name="map_widget_stroke">#4C000000</color>
|
<color name="map_widget_stroke">#4C000000</color>
|
||||||
<color name="map_widget_light">#fff</color>
|
<color name="map_widget_light">#fff</color>
|
||||||
|
|
|
@ -2203,4 +2203,21 @@
|
||||||
<string name="poi_step_condition_uneven">Step condition: uneven</string>
|
<string name="poi_step_condition_uneven">Step condition: uneven</string>
|
||||||
<string name="poi_step_condition_rough">Step condition: rough</string>
|
<string name="poi_step_condition_rough">Step condition: rough</string>
|
||||||
|
|
||||||
|
<string name="poi_cairn">Cairn</string>
|
||||||
|
|
||||||
|
<string name="poi_memorial_fassade_decoration">Fassade decoration</string>
|
||||||
|
<string name="poi_defibrillator">Defibrillator</string>
|
||||||
|
<string name="poi_defibrillator_yes">Defibrillator: yes</string>
|
||||||
|
|
||||||
|
<string name="poi_tomb_war_grave">Type: war grave</string>
|
||||||
|
<string name="poi_tomb_tumulus">Type: tumulus</string>
|
||||||
|
<string name="poi_tomb_rock_cut">Type: rock-cut</string>
|
||||||
|
<string name="poi_tomb_hypogeum">Type: hypogeum</string>
|
||||||
|
<string name="poi_tomb_vault">Type: vault</string>
|
||||||
|
<string name="poi_tomb_columbarium">Type: columbarium</string>
|
||||||
|
<string name="poi_tomb_mausoleum">Type: mausoleum</string>
|
||||||
|
<string name="poi_tomb_sarcophagus">Type: sarcophagus</string>
|
||||||
|
<string name="poi_tomb_crypt">Type: crypt</string>
|
||||||
|
<string name="poi_tomb_pyramid">Type: pyramid</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
|
||||||
import net.osmand.data.FavouritePoint;
|
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
import org.apache.tools.bzip2.CBZip2OutputStream;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -25,6 +12,19 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
|
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.tools.bzip2.CBZip2OutputStream;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
public class FavouritesDbHelper {
|
public class FavouritesDbHelper {
|
||||||
|
|
||||||
public interface FavoritesUpdatedListener {
|
public interface FavoritesUpdatedListener {
|
||||||
|
@ -575,10 +575,21 @@ public class FavouritesDbHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!group.name.equals(newName)) {
|
if (!group.name.equals(newName)) {
|
||||||
FavoriteGroup gr = flatGroups.get(group.name);
|
FavoriteGroup gr = flatGroups.remove(group.name);
|
||||||
group.name = newName;
|
gr.name = newName;
|
||||||
|
FavoriteGroup renamedGroup = flatGroups.get(gr.name);
|
||||||
|
boolean existing = renamedGroup != null;
|
||||||
|
if(renamedGroup == null) {
|
||||||
|
renamedGroup = gr;
|
||||||
|
flatGroups.put(gr.name, gr);
|
||||||
|
} else {
|
||||||
|
favoriteGroups.remove(gr);
|
||||||
|
}
|
||||||
for(FavouritePoint p : gr.points) {
|
for(FavouritePoint p : gr.points) {
|
||||||
p.setCategory(newName);
|
p.setCategory(newName);
|
||||||
|
if(existing) {
|
||||||
|
renamedGroup.points.add(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||||
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
|
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.TargetPointsHelper;
|
||||||
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.helpers.ColorDialogs;
|
||||||
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
|
@ -36,38 +68,6 @@ import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.access.AccessibleToast;
|
|
||||||
import net.osmand.data.FavouritePoint;
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
|
||||||
import net.osmand.plus.GPXUtilities;
|
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
|
||||||
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.TargetPointsHelper;
|
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
|
||||||
import net.osmand.plus.helpers.ColorDialogs;
|
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
|
||||||
import net.osmand.util.MapUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
|
||||||
|
|
||||||
|
|
||||||
public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
|
@ -514,16 +514,19 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
int clr = list.get(colorSpinner.getSelectedItemPosition());
|
int clr = list.get(colorSpinner.getSelectedItemPosition());
|
||||||
String name = nameEditText.getText().toString();
|
String name = nameEditText.getText().toString();
|
||||||
if (clr != intColor || group.visible != checkBox.isChecked()) {
|
boolean nameChanged = !Algorithms.objectEquals(group.name, name);
|
||||||
|
if (clr != intColor || group.visible != checkBox.isChecked() || nameChanged) {
|
||||||
getMyApplication().getFavorites().editFavouriteGroup(group, name, clr,
|
getMyApplication().getFavorites().editFavouriteGroup(group, name, clr,
|
||||||
checkBox.isChecked());
|
checkBox.isChecked());
|
||||||
|
if(nameChanged) {
|
||||||
|
favouritesAdapter.synchronizeGroups();
|
||||||
|
}
|
||||||
favouritesAdapter.notifyDataSetInvalidated();
|
favouritesAdapter.notifyDataSetInvalidated();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteFavoritesAction() {
|
private void deleteFavoritesAction() {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.activities;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -19,7 +18,6 @@ import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.download.ui.LocalIndexesFragment.LoadLocalIndexTask;
|
import net.osmand.plus.download.ui.LocalIndexesFragment.LoadLocalIndexTask;
|
||||||
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,11 @@ import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmandListActivity;
|
import net.osmand.plus.activities.OsmandListActivity;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
|
||||||
import net.osmand.plus.poi.NominatimPoiFilter;
|
import net.osmand.plus.poi.NominatimPoiFilter;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.poi.PoiUIFilter.AmenityNameFilter;
|
import net.osmand.plus.poi.PoiUIFilter.AmenityNameFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
import net.osmand.plus.views.POIMapLayer;
|
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
import net.osmand.util.OpeningHoursParser;
|
import net.osmand.util.OpeningHoursParser;
|
||||||
|
@ -58,10 +56,7 @@ import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.util.Linkify;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
|
@ -1,61 +1,50 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.view.WindowManager;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class FavoriteImageDrawable extends Drawable {
|
public class FavoriteImageDrawable extends Drawable {
|
||||||
|
|
||||||
private int color;
|
private int color;
|
||||||
Paint paintInnerCircle;
|
private Paint paintIcon;
|
||||||
|
private Paint paintBackground;
|
||||||
|
private Bitmap favIcon;
|
||||||
|
private Bitmap favBackground;
|
||||||
private Resources resources;
|
private Resources resources;
|
||||||
private Paint paintOuter;
|
|
||||||
private Drawable drawable;
|
|
||||||
private float density;
|
|
||||||
|
|
||||||
public FavoriteImageDrawable(Context ctx, int color, float d) {
|
public FavoriteImageDrawable(Context ctx, int color) {
|
||||||
this.resources = ctx.getResources();
|
this.resources = ctx.getResources();
|
||||||
this.color = color;
|
this.color = color;
|
||||||
WindowManager mgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
paintIcon = new Paint();
|
||||||
this.density = d;
|
int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
|
||||||
if (this.density == 0) {
|
paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
paintBackground = new Paint();
|
||||||
mgr.getDefaultDisplay().getMetrics(dm);
|
favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_favorite);
|
||||||
density = dm.density;
|
favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_favorite_shield);
|
||||||
}
|
|
||||||
drawable = getResources().getDrawable(R.drawable.ic_action_fav_dark);
|
|
||||||
paintOuter = new Paint();
|
|
||||||
paintOuter.setAntiAlias(true);
|
|
||||||
paintOuter.setStyle(Style.FILL_AND_STROKE);
|
|
||||||
paintInnerCircle = new Paint();
|
|
||||||
paintInnerCircle.setStyle(Style.FILL_AND_STROKE);
|
|
||||||
paintOuter.setColor(color == 0 || color == Color.BLACK ? 0x88555555 : color);
|
|
||||||
paintInnerCircle.setColor(color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite)
|
|
||||||
: color);
|
|
||||||
paintInnerCircle.setAntiAlias(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicHeight() {
|
public int getIntrinsicHeight() {
|
||||||
return (int) (24 * density);
|
return favBackground.getHeight();
|
||||||
// return (int) (drawable.getIntrinsicHeight() + 8 * density);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicWidth() {
|
public int getIntrinsicWidth() {
|
||||||
return (int) (24 * density);
|
return favBackground.getWidth();
|
||||||
// return (int) (drawable.getIntrinsicWidth() + 8 * density);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
|
@ -66,27 +55,11 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBoundsChange(Rect bounds) {
|
|
||||||
super.onBoundsChange(bounds);
|
|
||||||
Rect bs = new Rect(bounds);
|
|
||||||
bs.inset((int) (4 * density), (int) (4 * density));
|
|
||||||
// int min = Math.min(bounds.width(), bounds.height());
|
|
||||||
// bs.inset((int)(bs.width() - min + 3 * density) / 2,
|
|
||||||
// (int) (bs.height() - min + 3 * density) / 2);
|
|
||||||
drawable.setBounds(bs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
// int max = Math.max(drawable.getMinimumHeight(), drawable.getMinimumWidth());
|
|
||||||
Rect bs = getBounds();
|
Rect bs = getBounds();
|
||||||
int min = Math.min(bs.width(), bs.height());
|
canvas.drawBitmap(favBackground, bs.exactCenterX() - favBackground.getWidth() / 2f, bs.exactCenterY() - favBackground.getHeight() / 2f, paintBackground);
|
||||||
int r = (int) (min / 2);
|
canvas.drawBitmap(favIcon, bs.exactCenterX() - favIcon.getWidth() / 2f, bs.exactCenterY() - favIcon.getHeight() / 2f, paintIcon);
|
||||||
int rs = (int) (min / 2 - 1);
|
|
||||||
canvas.drawCircle(min / 2, min / 2, r, paintOuter);
|
|
||||||
canvas.drawCircle(min / 2, min / 2, rs, paintInnerCircle);
|
|
||||||
drawable.draw(canvas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBitmapInCenter(Canvas canvas, int x, int y) {
|
public void drawBitmapInCenter(Canvas canvas, int x, int y) {
|
||||||
|
@ -104,27 +77,25 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAlpha(int alpha) {
|
public void setAlpha(int alpha) {
|
||||||
paintInnerCircle.setAlpha(alpha);
|
paintBackground.setAlpha(alpha);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setColorFilter(ColorFilter cf) {
|
public void setColorFilter(ColorFilter cf) {
|
||||||
paintInnerCircle.setColorFilter(cf);
|
paintIcon.setColorFilter(cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TreeMap<Integer, FavoriteImageDrawable> cache = new TreeMap<Integer, FavoriteImageDrawable>();
|
private static TreeMap<Integer, FavoriteImageDrawable> cache = new TreeMap<>();
|
||||||
|
|
||||||
public static FavoriteImageDrawable getOrCreate(Context a, int color, float density) {
|
public static FavoriteImageDrawable getOrCreate(Context a, int color, float density) {
|
||||||
color = color | 0xff000000;
|
color = color | 0xff000000;
|
||||||
int hash = (color << 2) + (int) (density * 6);
|
int hash = (color << 2) + (int) (density * 6);
|
||||||
FavoriteImageDrawable drawable = cache.get(hash);
|
FavoriteImageDrawable drawable = cache.get(hash);
|
||||||
if (drawable == null) {
|
if (drawable == null) {
|
||||||
drawable = new FavoriteImageDrawable(a, color, density);
|
drawable = new FavoriteImageDrawable(a, color);
|
||||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||||
cache.put(hash, drawable);
|
cache.put(hash, drawable);
|
||||||
}
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
private DashFragmentAdapter mAdapter;
|
private DashFragmentAdapter mAdapter;
|
||||||
private int textColorPrimary;
|
private int textColorPrimary;
|
||||||
private int textColorSecondary;
|
private int textColorSecondary;
|
||||||
|
private static final int MAXIMUM_NUMBER_OF_ROWS = 10;
|
||||||
|
private static final int DEFAULT_NUMBER_OF_ROWS = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
|
@ -104,7 +106,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
DashboardOnMap.SHOULD_SHOW + fragmentData.tag, true)
|
DashboardOnMap.SHOULD_SHOW + fragmentData.tag, true)
|
||||||
.makeGlobal().set(shouldShow[i]);
|
.makeGlobal().set(shouldShow[i]);
|
||||||
if (fragmentData.rowNumberTag != null) {
|
if (fragmentData.rowNumberTag != null) {
|
||||||
settings.registerIntPreference(fragmentData.rowNumberTag, 5)
|
settings.registerIntPreference(fragmentData.rowNumberTag, DEFAULT_NUMBER_OF_ROWS)
|
||||||
.makeGlobal().set(numberOfRows[i]);
|
.makeGlobal().set(numberOfRows[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,42 +138,38 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
private class DashFragmentAdapter extends ArrayAdapter<DashFragmentData> {
|
private class DashFragmentAdapter extends ArrayAdapter<DashFragmentData> {
|
||||||
private final boolean[] checkedItems;
|
private final boolean[] checkedItems;
|
||||||
private final int[] numbersOfRows;
|
private final int[] numbersOfRows;
|
||||||
private final int colorBlue;
|
|
||||||
|
|
||||||
public DashFragmentAdapter(@NonNull Context context,
|
public DashFragmentAdapter(@NonNull Context context, @NonNull List<DashFragmentData> objects,
|
||||||
@NonNull List<DashFragmentData> objects,
|
@NonNull boolean[] checkedItems, @NonNull int[] numbersOfRows) {
|
||||||
@NonNull boolean[] checkedItems,
|
|
||||||
@NonNull int[] numbersOfRows) {
|
|
||||||
super(context, 0, objects);
|
super(context, 0, objects);
|
||||||
this.checkedItems = checkedItems;
|
this.checkedItems = checkedItems;
|
||||||
this.numbersOfRows = numbersOfRows;
|
this.numbersOfRows = numbersOfRows;
|
||||||
colorBlue = getContext().getResources().getColor(R.color.dashboard_blue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DashFragmentAdapter(@NonNull Context context,
|
public DashFragmentAdapter(@NonNull Context context, @NonNull List<DashFragmentData> objects,
|
||||||
@NonNull List<DashFragmentData> objects,
|
@NonNull OsmandSettings settings) {
|
||||||
@NonNull OsmandSettings settings) {
|
|
||||||
super(context, 0, objects);
|
super(context, 0, objects);
|
||||||
numbersOfRows = new int[objects.size()];
|
numbersOfRows = new int[objects.size()];
|
||||||
checkedItems = new boolean[objects.size()];
|
checkedItems = new boolean[objects.size()];
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
checkedItems[i] = settings.registerBooleanPreference(
|
checkedItems[i] = settings
|
||||||
DashboardOnMap.SHOULD_SHOW + objects.get(i).tag, true).makeGlobal().get();
|
.registerBooleanPreference(DashboardOnMap.SHOULD_SHOW + objects.get(i).tag, true).makeGlobal()
|
||||||
|
.get();
|
||||||
if (objects.get(i).tag != null) {
|
if (objects.get(i).tag != null) {
|
||||||
numbersOfRows[i] = settings.registerIntPreference(objects.get(i).rowNumberTag, 5)
|
numbersOfRows[i] = settings.registerIntPreference(objects.get(i).rowNumberTag, 5).makeGlobal()
|
||||||
.makeGlobal().get();
|
.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
colorBlue = getContext().getResources().getColor(R.color.dashboard_blue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
final DashViewHolder viewHolder;
|
final DashViewHolder viewHolder;
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.dashboard_settings_dialog_item,
|
||||||
R.layout.dashboard_settings_dialog_item, parent, false);
|
parent, false);
|
||||||
viewHolder = new DashViewHolder(convertView);
|
viewHolder = new DashViewHolder(this, convertView, getContext());
|
||||||
} else {
|
} else {
|
||||||
viewHolder = (DashViewHolder) convertView.getTag();
|
viewHolder = (DashViewHolder) convertView.getTag();
|
||||||
}
|
}
|
||||||
|
@ -188,56 +186,26 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
return numbersOfRows;
|
return numbersOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DashViewHolder {
|
public boolean isChecked(int position) {
|
||||||
final TextView textView;
|
return checkedItems[position];
|
||||||
final CompoundButton compoundButton;
|
|
||||||
final TextView numberOfRowsTextView;
|
|
||||||
private int position;
|
|
||||||
|
|
||||||
public DashViewHolder(View view) {
|
|
||||||
this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView);
|
|
||||||
this.textView = (TextView) view.findViewById(R.id.text);
|
|
||||||
this.compoundButton = (CompoundButton) view.findViewById(R.id.check_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bindDashView(DashFragmentData fragmentData, int position) {
|
|
||||||
if (fragmentData.hasRows()) {
|
|
||||||
numberOfRowsTextView.setVisibility(View.VISIBLE);
|
|
||||||
numberOfRowsTextView.setText(String.valueOf(numbersOfRows[position]));
|
|
||||||
numberOfRowsTextView.setTextColor(checkedItems[position] ? colorBlue :
|
|
||||||
textColorSecondary);
|
|
||||||
} else {
|
|
||||||
numberOfRowsTextView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
textView.setText(fragmentData.titleStringId);
|
|
||||||
textView.setTextColor(checkedItems[position] ? textColorPrimary :
|
|
||||||
textColorSecondary);
|
|
||||||
this.position = position;
|
|
||||||
|
|
||||||
compoundButton.setChecked(checkedItems[position]);
|
|
||||||
compoundButton.setTag(this);
|
|
||||||
compoundButton.setOnCheckedChangeListener(onTurnedOnOffListener);
|
|
||||||
|
|
||||||
numberOfRowsTextView.setTag(this);
|
|
||||||
numberOfRowsTextView.setOnClickListener(onNumberClickListener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final CompoundButton.OnCheckedChangeListener onTurnedOnOffListener =
|
public int getNumberOfRows(int position) {
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
return numbersOfRows[position];
|
||||||
@Override
|
}
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
|
||||||
DashViewHolder localViewHolder = (DashViewHolder) compoundButton.getTag();
|
final CompoundButton.OnCheckedChangeListener onTurnedOnOffListener = new CompoundButton.OnCheckedChangeListener() {
|
||||||
if (localViewHolder == null) return;
|
@Override
|
||||||
checkedItems[localViewHolder.position] = b;
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
localViewHolder.textView.setTextColor(
|
DashViewHolder localViewHolder = (DashViewHolder) compoundButton.getTag();
|
||||||
checkedItems[localViewHolder.position] ? textColorPrimary
|
if (localViewHolder == null) {
|
||||||
: textColorSecondary);
|
return;
|
||||||
localViewHolder.numberOfRowsTextView.setTextColor(
|
}
|
||||||
checkedItems[localViewHolder.position] ? colorBlue
|
int position = localViewHolder.position;
|
||||||
: textColorSecondary);
|
checkedItems[position] = b;
|
||||||
}
|
localViewHolder.bindDashView(getItem(position), position);
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
final View.OnClickListener onNumberClickListener = new View.OnClickListener() {
|
final View.OnClickListener onNumberClickListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -246,10 +214,51 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
String header = getContext().getString(getItem(localViewHolder.position).titleStringId);
|
String header = getContext().getString(getItem(localViewHolder.position).titleStringId);
|
||||||
String subheader = getContext().getResources().getString(R.string.count_of_lines);
|
String subheader = getContext().getResources().getString(R.string.count_of_lines);
|
||||||
final String stringPosition = String.valueOf(localViewHolder.position);
|
final String stringPosition = String.valueOf(localViewHolder.position);
|
||||||
NumberPickerDialogFragment
|
NumberPickerDialogFragment.createInstance(header, subheader, stringPosition, getNumberOfRows(localViewHolder.position), MAXIMUM_NUMBER_OF_ROWS)
|
||||||
.createInstance(header, subheader, stringPosition, 5)
|
|
||||||
.show(getChildFragmentManager(), NumberPickerDialogFragment.TAG);
|
.show(getChildFragmentManager(), NumberPickerDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DashViewHolder {
|
||||||
|
final TextView textView;
|
||||||
|
final CompoundButton compoundButton;
|
||||||
|
final TextView numberOfRowsTextView;
|
||||||
|
private int position;
|
||||||
|
private int colorBlue;
|
||||||
|
private DashFragmentAdapter dashFragmentAdapter;
|
||||||
|
|
||||||
|
public DashViewHolder(DashFragmentAdapter dashFragmentAdapter, View view, Context ctx) {
|
||||||
|
this.dashFragmentAdapter = dashFragmentAdapter;
|
||||||
|
this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView);
|
||||||
|
this.textView = (TextView) view.findViewById(R.id.text);
|
||||||
|
this.compoundButton = (CompoundButton) view.findViewById(R.id.check_item);
|
||||||
|
colorBlue = ctx.getResources().getColor(R.color.dashboard_blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindDashView(DashFragmentData fragmentData, int position) {
|
||||||
|
if (fragmentData.hasRows()) {
|
||||||
|
numberOfRowsTextView.setVisibility(View.VISIBLE);
|
||||||
|
numberOfRowsTextView.setText(String.valueOf(dashFragmentAdapter.getNumberOfRows(position)));
|
||||||
|
numberOfRowsTextView.setTextColor(dashFragmentAdapter.isChecked(position) ? colorBlue :
|
||||||
|
textColorSecondary);
|
||||||
|
} else {
|
||||||
|
numberOfRowsTextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
textView.setText(fragmentData.titleStringId);
|
||||||
|
textView.setTextColor(dashFragmentAdapter.isChecked(position)? textColorPrimary :
|
||||||
|
textColorSecondary);
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
compoundButton.setChecked(dashFragmentAdapter.isChecked(position));
|
||||||
|
compoundButton.setTag(this);
|
||||||
|
compoundButton.setOnCheckedChangeListener(dashFragmentAdapter.onTurnedOnOffListener);
|
||||||
|
|
||||||
|
numberOfRowsTextView.setTag(this);
|
||||||
|
numberOfRowsTextView.setOnClickListener(dashFragmentAdapter.onNumberClickListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class NumberPickerDialogFragment extends DialogFragment {
|
||||||
private static final String HEADER_TEXT = "header_text";
|
private static final String HEADER_TEXT = "header_text";
|
||||||
private static final String SUBHEADER_TEXT = "subheader_text";
|
private static final String SUBHEADER_TEXT = "subheader_text";
|
||||||
private static final String NUMBER_OF_ITEMS = "number_of_items";
|
private static final String NUMBER_OF_ITEMS = "number_of_items";
|
||||||
|
private static final String CURRENT_NUMBER = "current_number";
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,13 +35,14 @@ public class NumberPickerDialogFragment extends DialogFragment {
|
||||||
String headerText = args.getString(HEADER_TEXT);
|
String headerText = args.getString(HEADER_TEXT);
|
||||||
String subHeaderText = args.getString(SUBHEADER_TEXT);
|
String subHeaderText = args.getString(SUBHEADER_TEXT);
|
||||||
int numberOfItems = args.getInt(NUMBER_OF_ITEMS);
|
int numberOfItems = args.getInt(NUMBER_OF_ITEMS);
|
||||||
|
int currentNumber = args.getInt(CURRENT_NUMBER);
|
||||||
|
|
||||||
String[] items = new String[numberOfItems];
|
String[] items = new String[numberOfItems];
|
||||||
for (int i = 0; i < numberOfItems; i++) {
|
for (int i = 0; i < numberOfItems; i++) {
|
||||||
items[i] = String.valueOf(i + 1);
|
items[i] = String.valueOf(i + 1);
|
||||||
}
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setSingleChoiceItems(items, 0, null)
|
builder.setSingleChoiceItems(items, Math.max(0, currentNumber - 1), null)
|
||||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -65,12 +67,13 @@ public class NumberPickerDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NumberPickerDialogFragment createInstance(String header, String subheader,
|
public static NumberPickerDialogFragment createInstance(String header, String subheader,
|
||||||
String tag, int number) {
|
String tag, int currentRow, int maxNumber) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(HEADER_TEXT, header);
|
args.putString(HEADER_TEXT, header);
|
||||||
args.putString(SUBHEADER_TEXT, subheader);
|
args.putString(SUBHEADER_TEXT, subheader);
|
||||||
args.putString(NUMBER_TAG, tag);
|
args.putString(NUMBER_TAG, tag);
|
||||||
args.putInt(NUMBER_OF_ITEMS, number);
|
args.putInt(CURRENT_NUMBER, currentRow);
|
||||||
|
args.putInt(NUMBER_OF_ITEMS, maxNumber);
|
||||||
NumberPickerDialogFragment fragment = new NumberPickerDialogFragment();
|
NumberPickerDialogFragment fragment = new NumberPickerDialogFragment();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
|
|
|
@ -16,7 +16,10 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import net.osmand.IProgress;
|
||||||
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -73,13 +76,18 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
updateDescriptionTextWithSize(this, downloadProgressLayout);
|
||||||
int currentTab = 0;
|
int currentTab = 0;
|
||||||
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
|
||||||
if (tab != null) {
|
switch (tab) {
|
||||||
if (tab.equals(DOWNLOAD_TAB)) {
|
case DOWNLOAD_TAB:
|
||||||
currentTab = DOWNLOAD_TAB_NUMBER;
|
currentTab = DOWNLOAD_TAB_NUMBER;
|
||||||
} else if (tab.equals(UPDATES_TAB)) {
|
break;
|
||||||
|
case LOCAL_TAB:
|
||||||
|
currentTab = LOCAL_TAB_NUMBER;
|
||||||
|
break;
|
||||||
|
case UPDATES_TAB:
|
||||||
currentTab = UPDATES_TAB_NUMBER;
|
currentTab = UPDATES_TAB_NUMBER;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewPager = (ViewPager) findViewById(R.id.pager);
|
viewPager = (ViewPager) findViewById(R.id.pager);
|
||||||
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
|
||||||
|
|
||||||
|
@ -399,6 +407,44 @@ public class DownloadActivity extends BaseDownloadActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reloadLocalIndexes() {
|
||||||
|
AsyncTask<Void, String, List<String>> task = new AsyncTask<Void, String, List<String>>() {
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
setSupportProgressBarIndeterminateVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> doInBackground(Void... params) {
|
||||||
|
return getMyApplication().getResourceManager().reloadIndexes(IProgress.EMPTY_PROGRESS,
|
||||||
|
new ArrayList<String>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(List<String> warnings) {
|
||||||
|
setSupportProgressBarIndeterminateVisibility(false);
|
||||||
|
if (!warnings.isEmpty()) {
|
||||||
|
final StringBuilder b = new StringBuilder();
|
||||||
|
boolean f = true;
|
||||||
|
for (String w : warnings) {
|
||||||
|
if (f) {
|
||||||
|
f = false;
|
||||||
|
} else {
|
||||||
|
b.append('\n');
|
||||||
|
}
|
||||||
|
b.append(w);
|
||||||
|
}
|
||||||
|
AccessibleToast.makeText(DownloadActivity.this, b.toString(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
newDownloadIndexes();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
task.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void updateDescriptionTextWithSize(DownloadActivity activity, View view) {
|
public static void updateDescriptionTextWithSize(DownloadActivity activity, View view) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class IndexItem implements Comparable<IndexItem> {
|
||||||
return type.getBasename(this);
|
return type.getBasename(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getTargetFile(OsmandApplication ctx) {
|
public File getTargetFile(OsmandApplication ctx) {
|
||||||
String basename;
|
String basename;
|
||||||
if (type == DownloadActivityType.HILLSHADE_FILE) {
|
if (type == DownloadActivityType.HILLSHADE_FILE) {
|
||||||
basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " ");
|
basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " ");
|
||||||
|
@ -171,7 +171,7 @@ public class IndexItem implements Comparable<IndexItem> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOutdated() {
|
public boolean isOutdated() {
|
||||||
return outdated;
|
return outdated && getType() != DownloadActivityType.HILLSHADE_FILE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOutdated(boolean outdated) {
|
public void setOutdated(boolean outdated) {
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package net.osmand.plus.download.ui;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.IconsCache;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
|
import net.osmand.plus.download.DownloadResourceGroup;
|
||||||
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
|
||||||
|
public class DownloadGroupViewHolder {
|
||||||
|
TextView textView;
|
||||||
|
private DownloadActivity ctx;
|
||||||
|
|
||||||
|
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
|
||||||
|
this.ctx = ctx;
|
||||||
|
textView = (TextView) v.findViewById(R.id.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isParentWorld(DownloadResourceGroup group) {
|
||||||
|
return group.getParentGroup() == null
|
||||||
|
|| group.getParentGroup().getType() == DownloadResourceGroup.DownloadResourceGroupType.WORLD;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getIconForGroup(DownloadResourceGroup group) {
|
||||||
|
Drawable iconLeft;
|
||||||
|
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|
||||||
|
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
|
||||||
|
iconLeft = ctx.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_volume_up);
|
||||||
|
} else {
|
||||||
|
IconsCache cache = ctx.getMyApplication().getIconsCache();
|
||||||
|
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||||
|
iconLeft = cache.getContentIcon(R.drawable.ic_world_globe_dark);
|
||||||
|
} else {
|
||||||
|
DownloadResourceGroup ggr = group
|
||||||
|
.getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId());
|
||||||
|
iconLeft = cache.getContentIcon(R.drawable.ic_map);
|
||||||
|
if (ggr != null && ggr.getIndividualResources() != null) {
|
||||||
|
IndexItem item = null;
|
||||||
|
for (IndexItem ii : ggr.getIndividualResources()) {
|
||||||
|
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|
||||||
|
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
|
||||||
|
if (ii.isDownloaded() || ii.isOutdated()) {
|
||||||
|
item = ii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item != null) {
|
||||||
|
if (item.isOutdated()) {
|
||||||
|
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
|
||||||
|
} else {
|
||||||
|
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iconLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindItem(DownloadResourceGroup group) {
|
||||||
|
Drawable iconLeft = getIconForGroup(group);
|
||||||
|
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
|
||||||
|
String name = group.getName(ctx);
|
||||||
|
textView.setText(name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,6 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -106,10 +105,15 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
||||||
listAdapter = new DownloadResourceGroupAdapter(activity);
|
listAdapter = new DownloadResourceGroupAdapter(activity);
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
reloadData();
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
reloadData();
|
||||||
|
}
|
||||||
|
|
||||||
private void reloadData() {
|
private void reloadData() {
|
||||||
DownloadResources indexes = activity.getDownloadThread().getIndexes();
|
DownloadResources indexes = activity.getDownloadThread().getIndexes();
|
||||||
group = indexes.getGroupById(groupId);
|
group = indexes.getGroupById(groupId);
|
||||||
|
|
|
@ -1,26 +1,34 @@
|
||||||
package net.osmand.plus.download.ui;
|
package net.osmand.plus.download.ui;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||||
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.download.DownloadResourceGroup;
|
import net.osmand.plus.download.DownloadResourceGroup;
|
||||||
import net.osmand.plus.download.DownloadResources;
|
import net.osmand.plus.download.DownloadResources;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
import net.osmand.plus.download.ui.LocalIndexesFragment.LocalIndexOperationTask;
|
||||||
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -137,8 +145,7 @@ public class ItemViewHolder {
|
||||||
}
|
}
|
||||||
int color = textColorSecondary;
|
int color = textColorSecondary;
|
||||||
if(indexItem.isDownloaded() && !isDownloading) {
|
if(indexItem.isDownloaded() && !isDownloading) {
|
||||||
int colorId = indexItem.getType() != DownloadActivityType.HILLSHADE_FILE &&
|
int colorId = indexItem.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
||||||
indexItem.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
|
||||||
color = context.getResources().getColor(colorId);
|
color = context.getResources().getColor(colorId);
|
||||||
}
|
}
|
||||||
if (indexItem.isDownloaded()) {
|
if (indexItem.isDownloaded()) {
|
||||||
|
@ -170,14 +177,7 @@ public class ItemViewHolder {
|
||||||
descrTextView.setText(indexItem.getSizeDescription(context) + " • " +
|
descrTextView.setText(indexItem.getSizeDescription(context) + " • " +
|
||||||
(showRemoteDate ? indexItem.getRemoteDate(dateFormat) : indexItem.getLocalDate(dateFormat)));
|
(showRemoteDate ? indexItem.getRemoteDate(dateFormat) : indexItem.getLocalDate(dateFormat)));
|
||||||
}
|
}
|
||||||
|
|
||||||
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_action_import));
|
|
||||||
rightImageButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
download(indexItem, parentOptional);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
progressBar.setIndeterminate(progress == -1);
|
progressBar.setIndeterminate(progress == -1);
|
||||||
|
@ -201,17 +201,6 @@ public class ItemViewHolder {
|
||||||
descrTextView.setVisibility(View.GONE);
|
descrTextView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_action_remove_dark));
|
|
||||||
rightImageButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (silentCancelDownload) {
|
|
||||||
context.getDownloadThread().cancelDownload(indexItem);
|
|
||||||
} else {
|
|
||||||
context.makeSureUserCancelDownload(indexItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,17 +238,27 @@ public class ItemViewHolder {
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkDisabledAndClickAction(final IndexItem indexItem) {
|
private boolean checkDisabledAndClickAction(final IndexItem item) {
|
||||||
RightButtonAction clickAction = getClickAction(indexItem);
|
RightButtonAction clickAction = getClickAction(item);
|
||||||
boolean disabled = clickAction != RightButtonAction.DOWNLOAD;
|
boolean disabled = clickAction != RightButtonAction.DOWNLOAD;
|
||||||
|
OnClickListener action = getRightButtonAction(item, clickAction, null);
|
||||||
if (clickAction != RightButtonAction.DOWNLOAD) {
|
if (clickAction != RightButtonAction.DOWNLOAD) {
|
||||||
rightButton.setText(R.string.get_plugin);
|
rightButton.setText(R.string.get_plugin);
|
||||||
rightButton.setVisibility(View.VISIBLE);
|
rightButton.setVisibility(View.VISIBLE);
|
||||||
rightImageButton.setVisibility(View.GONE);
|
rightImageButton.setVisibility(View.GONE);
|
||||||
rightButton.setOnClickListener(getRightButtonAction(indexItem, clickAction, null));
|
rightButton.setOnClickListener(action);
|
||||||
} else {
|
} else {
|
||||||
rightButton.setVisibility(View.GONE);
|
rightButton.setVisibility(View.GONE);
|
||||||
rightImageButton.setVisibility(View.VISIBLE);
|
rightImageButton.setVisibility(View.VISIBLE);
|
||||||
|
final boolean isDownloading = context.getDownloadThread().isDownloading(item);
|
||||||
|
if (isDownloading) {
|
||||||
|
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_action_remove_dark));
|
||||||
|
} else if(item.isDownloaded() && !item.isOutdated()) {
|
||||||
|
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_overflow_menu_white));
|
||||||
|
} else {
|
||||||
|
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_action_import));
|
||||||
|
}
|
||||||
|
rightImageButton.setOnClickListener(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return disabled;
|
return disabled;
|
||||||
|
@ -328,6 +327,8 @@ public class ItemViewHolder {
|
||||||
} else {
|
} else {
|
||||||
context.makeSureUserCancelDownload(item);
|
context.makeSureUserCancelDownload(item);
|
||||||
}
|
}
|
||||||
|
} else if(item.isDownloaded() && !item.isOutdated()){
|
||||||
|
contextMenu(v, item, parentOptional);
|
||||||
} else {
|
} else {
|
||||||
download(item, parentOptional);
|
download(item, parentOptional);
|
||||||
}
|
}
|
||||||
|
@ -336,6 +337,61 @@ public class ItemViewHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void contextMenu(View v, final IndexItem indexItem, final DownloadResourceGroup parentOptional) {
|
||||||
|
final PopupMenu optionsMenu = new PopupMenu(context, v);
|
||||||
|
MenuItem item;
|
||||||
|
|
||||||
|
final File fl = indexItem.getTargetFile(context.getMyApplication());
|
||||||
|
if (fl.exists()) {
|
||||||
|
item = optionsMenu.getMenu().add(R.string.shared_string_delete).setIcon(
|
||||||
|
context.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_remove_dark));
|
||||||
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
LocalIndexType tp = LocalIndexType.MAP_DATA;
|
||||||
|
if (indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) {
|
||||||
|
tp = LocalIndexType.TILES_DATA;
|
||||||
|
} else if (indexItem.getType() == DownloadActivityType.ROADS_FILE) {
|
||||||
|
tp = LocalIndexType.MAP_DATA;
|
||||||
|
} else if (indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
||||||
|
tp = LocalIndexType.SRTM_DATA;
|
||||||
|
} else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE) {
|
||||||
|
tp = LocalIndexType.MAP_DATA;
|
||||||
|
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
||||||
|
tp = indexItem.getBasename().contains("tts") ? LocalIndexType.TTS_VOICE_DATA
|
||||||
|
: LocalIndexType.VOICE_DATA;
|
||||||
|
}
|
||||||
|
final LocalIndexInfo info = new LocalIndexInfo(tp, fl, false);
|
||||||
|
Builder confirm = new Builder(context);
|
||||||
|
confirm.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
new LocalIndexOperationTask(context, null, LocalIndexOperationTask.DELETE_OPERATION)
|
||||||
|
.execute(info);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
confirm.setNegativeButton(R.string.shared_string_no, null);
|
||||||
|
String fn = FileNameTranslationHelper.getFileName(context, context.getMyApplication().getRegions(),
|
||||||
|
indexItem.getVisibleName(context, context.getMyApplication().getRegions()));
|
||||||
|
confirm.setMessage(context.getString(R.string.delete_confirmation_msg, fn));
|
||||||
|
confirm.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
item = optionsMenu.getMenu().add(R.string.shared_string_download)
|
||||||
|
.setIcon(context.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_import));
|
||||||
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
download(indexItem, parentOptional);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
optionsMenu.show();
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getContentIcon(DownloadActivity context, int resourceId) {
|
private Drawable getContentIcon(DownloadActivity context, int resourceId) {
|
||||||
return context.getMyApplication().getIconsCache().getContentIcon(resourceId);
|
return context.getMyApplication().getIconsCache().getContentIcon(resourceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
// getLastNonConfigurationInstance method should be in onCreate() method
|
// getLastNonConfigurationInstance method should be in onCreate() method
|
||||||
// (onResume() doesn't work)
|
// (onResume() doesn't work)
|
||||||
Object indexes = getActivity().getLastNonConfigurationInstance();
|
Object indexes = getActivity().getLastNonConfigurationInstance();
|
||||||
asyncLoader = new LoadLocalIndexTask();
|
|
||||||
if (indexes instanceof List<?>) {
|
if (indexes instanceof List<?>) {
|
||||||
|
asyncLoader = new LoadLocalIndexTask();
|
||||||
asyncLoader.setResult((List<LocalIndexInfo>) indexes);
|
asyncLoader.setResult((List<LocalIndexInfo>) indexes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,8 +161,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadData() {
|
public void reloadData() {
|
||||||
asyncLoader = new LoadLocalIndexTask();
|
LoadLocalIndexTask current = asyncLoader;
|
||||||
asyncLoader.execute(getActivity());
|
if(current == null || current.getStatus() == AsyncTask.Status.FINISHED ||
|
||||||
|
current.isCancelled() || current.getResult() != null) {
|
||||||
|
asyncLoader = new LoadLocalIndexTask();
|
||||||
|
asyncLoader.execute(getActivity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showContextMenu(final LocalIndexInfo info) {
|
private void showContextMenu(final LocalIndexInfo info) {
|
||||||
|
@ -214,17 +218,17 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
reloadIndexes();
|
getDownloadActivity().reloadLocalIndexes();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (resId == R.string.local_index_mi_restore) {
|
} else if (resId == R.string.local_index_mi_restore) {
|
||||||
new LocalIndexOperationTask(RESTORE_OPERATION).execute(info);
|
new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.RESTORE_OPERATION).execute(info);
|
||||||
} else if (resId == R.string.shared_string_delete) {
|
} else if (resId == R.string.shared_string_delete) {
|
||||||
Builder confirm = new Builder(getActivity());
|
Builder confirm = new Builder(getActivity());
|
||||||
confirm.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
confirm.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
new LocalIndexOperationTask(DELETE_OPERATION).execute(info);
|
new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.DELETE_OPERATION).execute(info);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
confirm.setNegativeButton(R.string.shared_string_no, null);
|
confirm.setNegativeButton(R.string.shared_string_no, null);
|
||||||
|
@ -234,7 +238,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
confirm.setMessage(getString(R.string.delete_confirmation_msg, fn));
|
confirm.setMessage(getString(R.string.delete_confirmation_msg, fn));
|
||||||
confirm.show();
|
confirm.show();
|
||||||
} else if (resId == R.string.local_index_mi_backup) {
|
} else if (resId == R.string.local_index_mi_backup) {
|
||||||
new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
|
new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.BACKUP_OPERATION).execute(info);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -308,9 +312,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
public void setResult(List<LocalIndexInfo> result) {
|
public void setResult(List<LocalIndexInfo> result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
if (result == null) {
|
listAdapter.clear();
|
||||||
listAdapter.clear();
|
if (result != null) {
|
||||||
} else {
|
|
||||||
for (LocalIndexInfo v : result) {
|
for (LocalIndexInfo v : result) {
|
||||||
listAdapter.addLocalIndexInfo(v);
|
listAdapter.addLocalIndexInfo(v);
|
||||||
}
|
}
|
||||||
|
@ -336,52 +339,67 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getFileToRestore(LocalIndexInfo i) {
|
|
||||||
if (i.isBackupedData()) {
|
|
||||||
File parent = new File(i.getPathToData()).getParentFile();
|
|
||||||
if (i.getType() == LocalIndexType.SRTM_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
|
||||||
} else if (i.getFileName().endsWith(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT)) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
|
||||||
} else if (i.getType() == LocalIndexType.WIKI_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.WIKI_INDEX_DIR);
|
|
||||||
} else if (i.getType() == LocalIndexType.MAP_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.MAPS_PATH);
|
|
||||||
} else if (i.getType() == LocalIndexType.TILES_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.TILES_INDEX_DIR);
|
|
||||||
} else if (i.getType() == LocalIndexType.VOICE_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
|
||||||
} else if (i.getType() == LocalIndexType.TTS_VOICE_DATA) {
|
|
||||||
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
|
||||||
}
|
|
||||||
return new File(parent, i.getFileName());
|
|
||||||
}
|
|
||||||
return new File(i.getPathToData());
|
|
||||||
}
|
|
||||||
|
|
||||||
private File getFileToBackup(LocalIndexInfo i) {
|
|
||||||
if (!i.isBackupedData()) {
|
|
||||||
return new File(getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR), i.getFileName());
|
|
||||||
}
|
|
||||||
return new File(i.getPathToData());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean move(File from, File to) {
|
|
||||||
if (!to.getParentFile().exists()) {
|
|
||||||
to.getParentFile().mkdirs();
|
|
||||||
}
|
|
||||||
return from.renameTo(to);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LocalIndexOperationTask extends AsyncTask<LocalIndexInfo, LocalIndexInfo, String> {
|
|
||||||
|
|
||||||
|
|
||||||
|
public static class LocalIndexOperationTask extends AsyncTask<LocalIndexInfo, LocalIndexInfo, String> {
|
||||||
|
protected static int DELETE_OPERATION = 1;
|
||||||
|
protected static int BACKUP_OPERATION = 2;
|
||||||
|
protected static int RESTORE_OPERATION = 3;
|
||||||
|
|
||||||
private final int operation;
|
private final int operation;
|
||||||
|
private DownloadActivity a;
|
||||||
|
private LocalIndexesAdapter listAdapter;
|
||||||
|
|
||||||
public LocalIndexOperationTask(int operation) {
|
public LocalIndexOperationTask(DownloadActivity a, LocalIndexesAdapter listAdapter, int operation) {
|
||||||
|
this.a = a;
|
||||||
|
this.listAdapter = listAdapter;
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean move(File from, File to) {
|
||||||
|
if (!to.getParentFile().exists()) {
|
||||||
|
to.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
return from.renameTo(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getFileToBackup(LocalIndexInfo i) {
|
||||||
|
if (!i.isBackupedData()) {
|
||||||
|
return new File(getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR), i.getFileName());
|
||||||
|
}
|
||||||
|
return new File(i.getPathToData());
|
||||||
|
}
|
||||||
|
private OsmandApplication getMyApplication() {
|
||||||
|
return (OsmandApplication) a.getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private File getFileToRestore(LocalIndexInfo i) {
|
||||||
|
if (i.isBackupedData()) {
|
||||||
|
File parent = new File(i.getPathToData()).getParentFile();
|
||||||
|
if (i.getType() == LocalIndexType.SRTM_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
||||||
|
} else if (i.getFileName().endsWith(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT)) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
||||||
|
} else if (i.getType() == LocalIndexType.WIKI_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.WIKI_INDEX_DIR);
|
||||||
|
} else if (i.getType() == LocalIndexType.MAP_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.MAPS_PATH);
|
||||||
|
} else if (i.getType() == LocalIndexType.TILES_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.TILES_INDEX_DIR);
|
||||||
|
} else if (i.getType() == LocalIndexType.VOICE_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||||
|
} else if (i.getType() == LocalIndexType.TTS_VOICE_DATA) {
|
||||||
|
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||||
|
}
|
||||||
|
return new File(parent, i.getFileName());
|
||||||
|
}
|
||||||
|
return new File(i.getPathToData());
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(LocalIndexInfo... params) {
|
protected String doInBackground(LocalIndexInfo... params) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -392,6 +410,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
if (operation == DELETE_OPERATION) {
|
if (operation == DELETE_OPERATION) {
|
||||||
File f = new File(info.getPathToData());
|
File f = new File(info.getPathToData());
|
||||||
successfull = Algorithms.removeAllFiles(f);
|
successfull = Algorithms.removeAllFiles(f);
|
||||||
|
if (successfull) {
|
||||||
|
getMyApplication().getResourceManager().closeFile(info.getFileName());
|
||||||
|
}
|
||||||
} else if (operation == RESTORE_OPERATION) {
|
} else if (operation == RESTORE_OPERATION) {
|
||||||
successfull = move(new File(info.getPathToData()), getFileToRestore(info));
|
successfull = move(new File(info.getPathToData()), getFileToRestore(info));
|
||||||
if (successfull) {
|
if (successfull) {
|
||||||
|
@ -412,11 +433,14 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (operation == DELETE_OPERATION) {
|
if (operation == DELETE_OPERATION) {
|
||||||
return getString(R.string.local_index_items_deleted, count, total);
|
a.getDownloadThread().updateLoadedFiles();
|
||||||
|
}
|
||||||
|
if (operation == DELETE_OPERATION) {
|
||||||
|
return a.getString(R.string.local_index_items_deleted, count, total);
|
||||||
} else if (operation == BACKUP_OPERATION) {
|
} else if (operation == BACKUP_OPERATION) {
|
||||||
return getString(R.string.local_index_items_backuped, count, total);
|
return a.getString(R.string.local_index_items_backuped, count, total);
|
||||||
} else if (operation == RESTORE_OPERATION) {
|
} else if (operation == RESTORE_OPERATION) {
|
||||||
return getString(R.string.local_index_items_restored, count, total);
|
return a.getString(R.string.local_index_items_restored, count, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -425,34 +449,38 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(LocalIndexInfo... values) {
|
protected void onProgressUpdate(LocalIndexInfo... values) {
|
||||||
if (operation == DELETE_OPERATION) {
|
if (listAdapter != null) {
|
||||||
listAdapter.delete(values);
|
if (operation == DELETE_OPERATION) {
|
||||||
} else if (operation == BACKUP_OPERATION) {
|
listAdapter.delete(values);
|
||||||
listAdapter.move(values, false);
|
} else if (operation == BACKUP_OPERATION) {
|
||||||
} else if (operation == RESTORE_OPERATION) {
|
listAdapter.move(values, false);
|
||||||
listAdapter.move(values, true);
|
} else if (operation == RESTORE_OPERATION) {
|
||||||
|
listAdapter.move(values, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
getDownloadActivity().setProgressBarIndeterminateVisibility(true);
|
a.setProgressBarIndeterminateVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String result) {
|
protected void onPostExecute(String result) {
|
||||||
getDownloadActivity().setProgressBarIndeterminateVisibility(false);
|
a.setProgressBarIndeterminateVisibility(false);
|
||||||
AccessibleToast.makeText(getDownloadActivity(), result, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(a, result, Toast.LENGTH_LONG).show();
|
||||||
if (operation == RESTORE_OPERATION || operation == BACKUP_OPERATION) {
|
if (operation == RESTORE_OPERATION || operation == BACKUP_OPERATION) {
|
||||||
listAdapter.clear();
|
a.reloadLocalIndexes();
|
||||||
reloadIndexes();
|
} else {
|
||||||
|
a.newDownloadIndexes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newDownloadIndexes() {
|
public void newDownloadIndexes() {
|
||||||
|
reloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -466,7 +494,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
LOG.debug("onChildClick()");
|
|
||||||
LocalIndexInfo child = listAdapter.getChild(groupPosition, childPosition);
|
LocalIndexInfo child = listAdapter.getChild(groupPosition, childPosition);
|
||||||
if (!selectionMode) {
|
if (!selectionMode) {
|
||||||
openPopUpMenu(v, child);
|
openPopUpMenu(v, child);
|
||||||
|
@ -582,11 +609,11 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
public void doAction(int actionResId) {
|
public void doAction(int actionResId) {
|
||||||
if (actionResId == R.string.local_index_mi_backup) {
|
if (actionResId == R.string.local_index_mi_backup) {
|
||||||
operationTask = new LocalIndexOperationTask(BACKUP_OPERATION);
|
operationTask = new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.BACKUP_OPERATION);
|
||||||
} else if (actionResId == R.string.shared_string_delete) {
|
} else if (actionResId == R.string.shared_string_delete) {
|
||||||
operationTask = new LocalIndexOperationTask(DELETE_OPERATION);
|
operationTask = new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.DELETE_OPERATION);
|
||||||
} else if (actionResId == R.string.local_index_mi_restore) {
|
} else if (actionResId == R.string.local_index_mi_restore) {
|
||||||
operationTask = new LocalIndexOperationTask(RESTORE_OPERATION);
|
operationTask = new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.RESTORE_OPERATION);
|
||||||
} else {
|
} else {
|
||||||
operationTask = null;
|
operationTask = null;
|
||||||
}
|
}
|
||||||
|
@ -673,7 +700,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
public void localOptionsMenu(final int itemId) {
|
public void localOptionsMenu(final int itemId) {
|
||||||
if (itemId == R.string.local_index_mi_reload) {
|
if (itemId == R.string.local_index_mi_reload) {
|
||||||
reloadIndexes();
|
getDownloadActivity().reloadLocalIndexes();
|
||||||
} else if (itemId == R.string.shared_string_delete) {
|
} else if (itemId == R.string.shared_string_delete) {
|
||||||
openSelectionMode(itemId, R.drawable.ic_action_delete_dark,
|
openSelectionMode(itemId, R.drawable.ic_action_delete_dark,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
@ -717,50 +744,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void reloadIndexes() {
|
|
||||||
listAdapter.clear();
|
|
||||||
asyncLoader = new LoadLocalIndexTask();
|
|
||||||
AsyncTask<Void, String, List<String>> task = new AsyncTask<Void, String, List<String>>() {
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
super.onPreExecute();
|
|
||||||
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<String> doInBackground(Void... params) {
|
|
||||||
return getMyApplication().getResourceManager().reloadIndexes(IProgress.EMPTY_PROGRESS,
|
|
||||||
new ArrayList<String>()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(List<String> warnings) {
|
|
||||||
if (getDownloadActivity() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
|
|
||||||
if (!warnings.isEmpty()) {
|
|
||||||
final StringBuilder b = new StringBuilder();
|
|
||||||
boolean f = true;
|
|
||||||
for (String w : warnings) {
|
|
||||||
if (f) {
|
|
||||||
f = false;
|
|
||||||
} else {
|
|
||||||
b.append('\n');
|
|
||||||
}
|
|
||||||
b.append(w);
|
|
||||||
}
|
|
||||||
AccessibleToast.makeText(getDownloadActivity(), b.toString(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
if (asyncLoader.getStatus() == Status.PENDING) {
|
|
||||||
asyncLoader.execute(getDownloadActivity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
task.execute();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class LocalIndexesAdapter extends OsmandBaseExpandableListAdapter {
|
protected class LocalIndexesAdapter extends OsmandBaseExpandableListAdapter {
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,52 @@
|
||||||
package net.osmand.plus.download.ui;
|
package net.osmand.plus.download.ui;
|
||||||
|
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ExpandableListView;
|
||||||
|
import android.widget.Filter;
|
||||||
|
import android.widget.Filterable;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.RelativeLayout.LayoutParams;
|
import android.widget.RelativeLayout.LayoutParams;
|
||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
|
|
||||||
|
import net.osmand.Collator;
|
||||||
|
import net.osmand.OsmAndCollator;
|
||||||
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
|
||||||
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
|
import net.osmand.plus.download.DownloadResourceGroup;
|
||||||
|
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
|
||||||
|
import net.osmand.plus.download.DownloadResources;
|
||||||
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
|
||||||
// FIXME
|
import java.util.ArrayList;
|
||||||
public class SearchDialogFragment extends DialogFragment {
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public static DialogFragment createInstance(String tg) {
|
public class SearchDialogFragment extends DialogFragment implements DownloadEvents, OnItemClickListener {
|
||||||
return new SearchDialogFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*extends DialogFragment implements DownloadEvents {
|
|
||||||
|
|
||||||
public static final String TAG = "SearchDialogFragment";
|
public static final String TAG = "SearchDialogFragment";
|
||||||
private static final String SEARCH_TEXT_DLG_KEY = "search_text_dlg_key";
|
private static final String SEARCH_TEXT_DLG_KEY = "search_text_dlg_key";
|
||||||
|
private ListView listView;
|
||||||
|
private SearchListAdapter listAdapter;
|
||||||
|
private BannerAndDownloadFreeVersion banner;
|
||||||
private String searchText;
|
private String searchText;
|
||||||
private SearchView search;
|
private SearchView search;
|
||||||
|
|
||||||
|
@ -63,6 +81,24 @@ public class SearchDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity());
|
||||||
|
|
||||||
|
LinearLayout ll = (LinearLayout) view;
|
||||||
|
ExpandableListView expandablelistView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||||
|
ll.removeView(expandablelistView);
|
||||||
|
|
||||||
|
listView = new ListView(getActivity());
|
||||||
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
|
||||||
|
layoutParams.weight = 1;
|
||||||
|
layoutParams.setMargins(0, 0, 0, 0);
|
||||||
|
listView.setLayoutParams(layoutParams);
|
||||||
|
ll.addView(listView);
|
||||||
|
|
||||||
|
listView.setOnItemClickListener(this);
|
||||||
|
listAdapter = new SearchListAdapter(getDownloadActivity());
|
||||||
|
listView.setOnItemClickListener(this);
|
||||||
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
search = new SearchView(getActivity());
|
search = new SearchView(getActivity());
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
||||||
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||||
|
@ -95,25 +131,46 @@ public class SearchDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
Fragment f = getChildFragmentManager().findFragmentByTag(SearchItemsFragment.TAG);
|
updateSearchText(newText);
|
||||||
if (f != null) {
|
return true;
|
||||||
((SearchItemsFragment) f).updateSearchText(newText);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Fragment fragment = getChildFragmentManager().findFragmentById(R.id.fragmentContainer);
|
|
||||||
if (fragment == null) {
|
|
||||||
getChildFragmentManager().beginTransaction().add(R.id.fragmentContainer,
|
|
||||||
SearchItemsFragment.createInstance(searchText), SearchItemsFragment.TAG).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
getDownloadActivity().registerFreeVersionBanner(view);
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
setShowsDialog(true);
|
||||||
|
listView.setBackgroundColor(getResources().getColor(
|
||||||
|
getMyApplication().getSettings().isLightContent() ? R.color.bg_color_light : R.color.bg_color_dark));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newDownloadIndexes() {
|
||||||
|
if(banner != null) {
|
||||||
|
banner.updateBannerInProgress();
|
||||||
|
}
|
||||||
|
updateSearchText(searchText);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadHasFinished() {
|
||||||
|
if(banner != null) {
|
||||||
|
banner.updateBannerInProgress();
|
||||||
|
}
|
||||||
|
listAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadInProgress() {
|
||||||
|
if(banner != null) {
|
||||||
|
banner.updateBannerInProgress();
|
||||||
|
}
|
||||||
|
listAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
outState.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
||||||
|
@ -126,6 +183,11 @@ public class SearchDialogFragment extends DialogFragment {
|
||||||
search.setIconified(false);
|
search.setIconified(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateSearchText(String searchText) {
|
||||||
|
this.searchText = searchText;
|
||||||
|
listAdapter.getFilter().filter(searchText);
|
||||||
|
}
|
||||||
|
|
||||||
private OsmandApplication getMyApplication() {
|
private OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
@ -134,13 +196,6 @@ public class SearchDialogFragment extends DialogFragment {
|
||||||
return (DownloadActivity) getActivity();
|
return (DownloadActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void newDownloadIndexes() {
|
|
||||||
Fragment f = getChildFragmentManager().findFragmentByTag(SearchItemsFragment.TAG);
|
|
||||||
if (f != null) {
|
|
||||||
((SearchItemsFragment) f).onCategorizationFinished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SearchDialogFragment createInstance(String searchText) {
|
public static SearchDialogFragment createInstance(String searchText) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
bundle.putString(SEARCH_TEXT_DLG_KEY, searchText);
|
||||||
|
@ -148,5 +203,262 @@ public class SearchDialogFragment extends DialogFragment {
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
|
||||||
|
Object obj = listAdapter.getItem(position);
|
||||||
|
if (obj instanceof DownloadResourceGroup) {
|
||||||
|
String uniqueId = ((DownloadResourceGroup) obj).getUniqueId();
|
||||||
|
final DownloadResourceGroupFragment regionDialogFragment = DownloadResourceGroupFragment
|
||||||
|
.createInstance(uniqueId);
|
||||||
|
((DownloadActivity) getActivity()).showDialog(getActivity(), regionDialogFragment);
|
||||||
|
} else if (obj instanceof IndexItem) {
|
||||||
|
IndexItem indexItem = (IndexItem) obj;
|
||||||
|
ItemViewHolder vh = (ItemViewHolder) v.getTag();
|
||||||
|
View.OnClickListener ls = vh.getRightButtonAction(indexItem, vh.getClickAction(indexItem), null);
|
||||||
|
ls.onClick(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SearchListAdapter extends BaseAdapter implements Filterable {
|
||||||
|
|
||||||
|
private SearchIndexFilter mFilter;
|
||||||
|
|
||||||
|
private List<Object> items = new LinkedList<>();
|
||||||
|
private DownloadActivity ctx;
|
||||||
|
|
||||||
|
public SearchListAdapter(DownloadActivity ctx) {
|
||||||
|
this.ctx = ctx;
|
||||||
|
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||||
|
ta.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
items.clear();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return items.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
Object obj = items.get(position);
|
||||||
|
if (obj instanceof IndexItem) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getViewTypeCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
|
final Object obj = items.get(position);
|
||||||
|
if (obj instanceof IndexItem) {
|
||||||
|
|
||||||
|
IndexItem item = (IndexItem) obj;
|
||||||
|
ItemViewHolder viewHolder;
|
||||||
|
if (convertView != null && convertView.getTag() instanceof ItemViewHolder) {
|
||||||
|
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||||
|
} else {
|
||||||
|
convertView = LayoutInflater.from(parent.getContext()).inflate(
|
||||||
|
R.layout.two_line_with_images_list_item, parent, false);
|
||||||
|
viewHolder = new ItemViewHolder(convertView, getDownloadActivity());
|
||||||
|
viewHolder.setShowRemoteDate(true);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
}
|
||||||
|
viewHolder.setShowTypeInDesc(true);
|
||||||
|
viewHolder.bindIndexItem(item, null);
|
||||||
|
} else {
|
||||||
|
DownloadResourceGroup group = (DownloadResourceGroup) obj;
|
||||||
|
DownloadGroupViewHolder viewHolder;
|
||||||
|
if (convertView != null && convertView.getTag() instanceof DownloadGroupViewHolder) {
|
||||||
|
viewHolder = (DownloadGroupViewHolder) convertView.getTag();
|
||||||
|
} else {
|
||||||
|
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_list_menu_item,
|
||||||
|
parent, false);
|
||||||
|
viewHolder = new DownloadGroupViewHolder(getDownloadActivity(), convertView);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
}
|
||||||
|
viewHolder.bindItem(group);
|
||||||
|
}
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasStableIds() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Filter getFilter() {
|
||||||
|
if (mFilter == null) {
|
||||||
|
mFilter = new SearchIndexFilter();
|
||||||
|
}
|
||||||
|
return mFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class SearchIndexFilter extends Filter {
|
||||||
|
|
||||||
|
private OsmandRegions osmandRegions;
|
||||||
|
|
||||||
|
public SearchIndexFilter() {
|
||||||
|
this.osmandRegions = ctx.getMyApplication().getRegions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processGroup(DownloadResourceGroup group, List<Object> filter, List<List<String>> conds) {
|
||||||
|
String name = null;
|
||||||
|
if (group.getRegion() != null && group.getRegion().getSearchText() != null) {
|
||||||
|
name = group.getRegion().getSearchText().toLowerCase();
|
||||||
|
}
|
||||||
|
if (name == null) {
|
||||||
|
name = group.getName(ctx).toLowerCase();
|
||||||
|
}
|
||||||
|
if (group.getType().isScreen() && group.getParentGroup() != null
|
||||||
|
&& group.getParentGroup().getParentGroup() != null
|
||||||
|
&& group.getParentGroup().getParentGroup().getType() != DownloadResourceGroupType.WORLD
|
||||||
|
&& isMatch(conds, false, name)) {
|
||||||
|
|
||||||
|
filter.add(group);
|
||||||
|
|
||||||
|
for (DownloadResourceGroup g : group.getGroups()) {
|
||||||
|
if (g.getType() == DownloadResourceGroupType.REGION_MAPS) {
|
||||||
|
if (g.getIndividualResources() != null) {
|
||||||
|
for (IndexItem item : g.getIndividualResources()) {
|
||||||
|
if (item.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||||
|
filter.add(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// process other maps & voice prompts
|
||||||
|
if (group.getType() == DownloadResourceGroupType.OTHER_MAPS_HEADER
|
||||||
|
|| group.getType() == DownloadResourceGroupType.VOICE_HEADER_REC
|
||||||
|
|| group.getType() == DownloadResourceGroupType.VOICE_HEADER_TTS) {
|
||||||
|
if (group.getIndividualResources() != null) {
|
||||||
|
for (IndexItem item : group.getIndividualResources()) {
|
||||||
|
name = item.getVisibleName(ctx, osmandRegions, false).toLowerCase();
|
||||||
|
if (isMatch(conds, false, name)) {
|
||||||
|
filter.add(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.getGroups() != null) {
|
||||||
|
for (DownloadResourceGroup g : group.getGroups()) {
|
||||||
|
processGroup(g, filter, conds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected FilterResults performFiltering(CharSequence constraint) {
|
||||||
|
DownloadResources root = ctx.getDownloadThread().getIndexes();
|
||||||
|
|
||||||
|
FilterResults results = new FilterResults();
|
||||||
|
if (constraint == null || constraint.length() < 2) {
|
||||||
|
results.values = new ArrayList<>();
|
||||||
|
results.count = 0;
|
||||||
|
} else {
|
||||||
|
String[] ors = constraint.toString().split(",");
|
||||||
|
List<List<String>> conds = new ArrayList<>();
|
||||||
|
for (String or : ors) {
|
||||||
|
final ArrayList<String> cond = new ArrayList<>();
|
||||||
|
for (String term : or.split("\\s")) {
|
||||||
|
final String t = term.trim().toLowerCase();
|
||||||
|
if (t.length() > 0) {
|
||||||
|
cond.add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cond.size() > 0) {
|
||||||
|
conds.add(cond);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Object> filter = new ArrayList<>();
|
||||||
|
processGroup(root, filter, conds);
|
||||||
|
|
||||||
|
final Collator collator = OsmAndCollator.primaryCollator();
|
||||||
|
Collections.sort(filter, new Comparator<Object>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Object obj1, Object obj2) {
|
||||||
|
String str1;
|
||||||
|
String str2;
|
||||||
|
if (obj1 instanceof DownloadResourceGroup) {
|
||||||
|
str1 = ((DownloadResourceGroup) obj1).getName(ctx);
|
||||||
|
} else {
|
||||||
|
str1 = ((IndexItem) obj1).getVisibleName(getMyApplication(), osmandRegions, false);
|
||||||
|
}
|
||||||
|
if (obj2 instanceof DownloadResourceGroup) {
|
||||||
|
str2 = ((DownloadResourceGroup) obj2).getName(ctx);
|
||||||
|
} else {
|
||||||
|
str2 = ((IndexItem) obj2).getVisibleName(getMyApplication(), osmandRegions, false);
|
||||||
|
}
|
||||||
|
return collator.compare(str1, str2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
results.values = filter;
|
||||||
|
results.count = filter.size();
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMatch(List<List<String>> conditions, boolean matchByDefault, String text) {
|
||||||
|
boolean res = matchByDefault;
|
||||||
|
for (List<String> or : conditions) {
|
||||||
|
boolean tadd = true;
|
||||||
|
for (String var : or) {
|
||||||
|
if (!text.contains(var)) {
|
||||||
|
tadd = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!tadd) {
|
||||||
|
res = false;
|
||||||
|
} else {
|
||||||
|
res = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||||
|
items.clear();
|
||||||
|
List<Object> values = (List<Object>) results.values;
|
||||||
|
if (values != null && !values.isEmpty()) {
|
||||||
|
items.addAll(values);
|
||||||
|
}
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,337 +0,0 @@
|
||||||
package net.osmand.plus.download.ui;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.osmand.Collator;
|
|
||||||
import net.osmand.OsmAndCollator;
|
|
||||||
import net.osmand.map.OsmandRegions;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.WorldRegion;
|
|
||||||
import net.osmand.plus.download.BaseDownloadActivity;
|
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
|
||||||
import net.osmand.plus.download.IndexItem;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.Filter;
|
|
||||||
import android.widget.Filterable;
|
|
||||||
import android.widget.ListView;
|
|
||||||
|
|
||||||
//FIXME merge into search dialog fragment
|
|
||||||
public class SearchItemsFragment { /*extends Fragment implements DownloadEvents {
|
|
||||||
public static final String TAG = "SearchItemsFragment";
|
|
||||||
|
|
||||||
private SearchItemsAdapter listAdapter;
|
|
||||||
|
|
||||||
private static final String SEARCH_TEXT_KEY = "world_region_id_key";
|
|
||||||
private String searchText;
|
|
||||||
|
|
||||||
@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_search_items_fragment, container, false);
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
searchText = savedInstanceState.getString(SEARCH_TEXT_KEY);
|
|
||||||
}
|
|
||||||
if (searchText == null) {
|
|
||||||
searchText = getArguments().getString(SEARCH_TEXT_KEY);
|
|
||||||
}
|
|
||||||
if (searchText == null)
|
|
||||||
searchText = "";
|
|
||||||
|
|
||||||
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
|
||||||
listAdapter = new SearchItemsAdapter(getActivity());
|
|
||||||
listView.setAdapter(listAdapter);
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
doItemClick(view, position);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fillSearchItemsAdapter();
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
|
||||||
outState.putString(SEARCH_TEXT_KEY, searchText);
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean doItemClick(View view, int position) {
|
|
||||||
Object obj = listAdapter.getItem(position);
|
|
||||||
if (obj instanceof WorldRegion) {
|
|
||||||
WorldRegion region = (WorldRegion) obj;
|
|
||||||
getDownloadActivity().showDialog(getActivity(), RegionDialogFragment.createInstance(region.getRegionId()));
|
|
||||||
return true;
|
|
||||||
} else if (obj instanceof ItemsListBuilder.ResourceItem) {
|
|
||||||
if (((ItemViewHolder) view.getTag()).isItemAvailable()) {
|
|
||||||
IndexItem indexItem = ((ItemsListBuilder.ResourceItem) obj).getIndexItem();
|
|
||||||
((BaseDownloadActivity) getActivity()).startDownload(indexItem);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (obj instanceof IndexItem) {
|
|
||||||
if (((ItemViewHolder) view.getTag()).isItemAvailable()) {
|
|
||||||
IndexItem indexItem = (IndexItem) obj;
|
|
||||||
((BaseDownloadActivity) getActivity()).startDownload(indexItem);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DownloadActivity getMyActivity() {
|
|
||||||
return (DownloadActivity) getActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillSearchItemsAdapter() {
|
|
||||||
if (listAdapter != null) {
|
|
||||||
listAdapter.clear();
|
|
||||||
List<WorldRegion> flattenedList = getMyApplication().getWorldRegion().getFlattenedSubregions();
|
|
||||||
List<IndexItem> indexItems = getDownloadActivity().getIndexFiles();
|
|
||||||
if (flattenedList != null && flattenedList.size() > 0 &&
|
|
||||||
indexItems != null && indexItems.size() > 0) {
|
|
||||||
listAdapter.addWorldRegions(flattenedList);
|
|
||||||
listAdapter.addIndexItems(indexItems);
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCategorizationFinished() {
|
|
||||||
fillSearchItemsAdapter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateSearchText(String searchText) {
|
|
||||||
this.searchText = searchText;
|
|
||||||
if(listAdapter != null){
|
|
||||||
listAdapter.getFilter().filter(searchText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DownloadActivity getDownloadActivity() {
|
|
||||||
return (DownloadActivity) getActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SearchItemsFragment createInstance(String regionId) {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putString(SEARCH_TEXT_KEY, regionId);
|
|
||||||
SearchItemsFragment fragment = new SearchItemsFragment();
|
|
||||||
fragment.setArguments(bundle);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SearchItemsAdapter extends BaseAdapter implements Filterable {
|
|
||||||
|
|
||||||
private SearchIndexFilter mFilter;
|
|
||||||
|
|
||||||
private List<WorldRegion> worldRegions = new LinkedList<>();
|
|
||||||
private List<IndexItem> indexItems = new LinkedList<>();
|
|
||||||
private List<Object> items = new LinkedList<>();
|
|
||||||
|
|
||||||
private OsmandRegions osmandRegions;
|
|
||||||
|
|
||||||
public SearchItemsAdapter(Context ctx) {
|
|
||||||
osmandRegions = getMyApplication().getResourceManager().getOsmandRegions();
|
|
||||||
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
|
||||||
ta.recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
worldRegions.clear();
|
|
||||||
indexItems.clear();
|
|
||||||
items.clear();
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addWorldRegions(List<WorldRegion> worldRegions) {
|
|
||||||
this.worldRegions.addAll(worldRegions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addIndexItems(List<IndexItem> indexItems) {
|
|
||||||
this.indexItems.addAll(indexItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return items.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCount() {
|
|
||||||
return items.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
final Object item = getItem(position);
|
|
||||||
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,
|
|
||||||
getMyActivity(),
|
|
||||||
getMyApplication().getResourceManager().getDateFormat());
|
|
||||||
convertView.setTag(viewHolder);
|
|
||||||
} else {
|
|
||||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
|
||||||
}
|
|
||||||
if (item instanceof WorldRegion) {
|
|
||||||
viewHolder.bindRegion((WorldRegion) item);
|
|
||||||
} else if (item instanceof IndexItem) {
|
|
||||||
viewHolder.bindIndexItem((IndexItem) item, false, true);
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Item must be of type WorldRegion or " +
|
|
||||||
"IndexItem but is of type:" + item.getClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
return convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasStableIds() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Filter getFilter() {
|
|
||||||
if (mFilter == null) {
|
|
||||||
mFilter = new SearchIndexFilter();
|
|
||||||
}
|
|
||||||
return mFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final class SearchIndexFilter extends Filter {
|
|
||||||
@Override
|
|
||||||
protected FilterResults performFiltering(CharSequence constraint) {
|
|
||||||
FilterResults results = new FilterResults();
|
|
||||||
if (constraint == null || constraint.length() < 2) {
|
|
||||||
results.values = new ArrayList<>();
|
|
||||||
results.count = 0;
|
|
||||||
} else {
|
|
||||||
String[] ors = constraint.toString().split(",");
|
|
||||||
List<List<String>> conds = new ArrayList<>();
|
|
||||||
for (String or : ors) {
|
|
||||||
final ArrayList<String> cond = new ArrayList<>();
|
|
||||||
for (String term : or.split("\\s")) {
|
|
||||||
final String t = term.trim().toLowerCase();
|
|
||||||
if (t.length() > 0) {
|
|
||||||
cond.add(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cond.size() > 0) {
|
|
||||||
conds.add(cond);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Object> filter = new ArrayList<>();
|
|
||||||
List<WorldRegion> regions = new ArrayList<>();
|
|
||||||
for (WorldRegion region : worldRegions) {
|
|
||||||
String indexLC = region.getName().toLowerCase();
|
|
||||||
if (isMatch(conds, false, indexLC)) {
|
|
||||||
regions.add(region);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (WorldRegion region : regions) {
|
|
||||||
if (region.getSubregions().size() > 0) {
|
|
||||||
filter.add(region);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<IndexItem> items = getDownloadActivity().getIndexItemsByRegion(region);
|
|
||||||
if (items.size() > 1) {
|
|
||||||
if (!filter.contains(region)) {
|
|
||||||
filter.add(region);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
filter.addAll(items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final Collator collator = OsmAndCollator.primaryCollator();
|
|
||||||
Collections.sort(filter, new Comparator<Object>() {
|
|
||||||
@Override
|
|
||||||
public int compare(Object obj1, Object obj2) {
|
|
||||||
String str1;
|
|
||||||
String str2;
|
|
||||||
if (obj1 instanceof WorldRegion) {
|
|
||||||
str1 = ((WorldRegion) obj1).getName();
|
|
||||||
} else {
|
|
||||||
str1 = ((IndexItem) obj1).getVisibleName(getMyApplication(), osmandRegions, false);
|
|
||||||
}
|
|
||||||
if (obj2 instanceof WorldRegion) {
|
|
||||||
str2 = ((WorldRegion) obj2).getName();
|
|
||||||
} else {
|
|
||||||
str2 = ((IndexItem) obj2).getVisibleName(getMyApplication(), osmandRegions, false);
|
|
||||||
}
|
|
||||||
return collator.compare(str1, str2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
results.values = filter;
|
|
||||||
results.count = filter.size();
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isMatch(List<List<String>> conditions, boolean matchByDefault, String text) {
|
|
||||||
boolean res = matchByDefault;
|
|
||||||
for (List<String> or : conditions) {
|
|
||||||
boolean tadd = true;
|
|
||||||
for (String var : or) {
|
|
||||||
if (!text.contains(var)) {
|
|
||||||
tadd = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!tadd) {
|
|
||||||
res = false;
|
|
||||||
} else {
|
|
||||||
res = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
|
||||||
items.clear();
|
|
||||||
List<Object> values = (List<Object>) results.values;
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
items.addAll(values);
|
|
||||||
}
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
|
@ -52,7 +52,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
public static final String TAG = "MapContextMenuFragment";
|
public static final String TAG = "MapContextMenuFragment";
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapContextMenuFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(MapContextMenuFragment.class);
|
||||||
|
|
||||||
public static final float FAB_PADDING_TOP = 10f;
|
public static final float FAB_PADDING_TOP_DP = 4f;
|
||||||
public static final float MARKER_PADDING_DP = 20f;
|
public static final float MARKER_PADDING_DP = 20f;
|
||||||
public static final float MARKER_PADDING_X_DP = 50f;
|
public static final float MARKER_PADDING_X_DP = 50f;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class MapContextMenuFragment extends Fragment {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
fabPaddingTopPx = dpToPx(FAB_PADDING_TOP);
|
fabPaddingTopPx = dpToPx(FAB_PADDING_TOP_DP);
|
||||||
markerPaddingPx = dpToPx(MARKER_PADDING_DP);
|
markerPaddingPx = dpToPx(MARKER_PADDING_DP);
|
||||||
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,10 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
@ -963,6 +961,7 @@ public class ResourceManager {
|
||||||
log.error(e, e);
|
log.error(e, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
indexFileNames.remove(fileName);
|
||||||
renderer.closeConnection(fileName);
|
renderer.closeConnection(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<dimen name="fab_size_normal">56dp</dimen>
|
<dimen name="fab_size_normal">56dp</dimen>
|
||||||
<dimen name="fab_size_mini">40dp</dimen>
|
<dimen name="fab_size_mini">40dp</dimen>
|
||||||
<dimen name="fab_border_width">0.5dp</dimen>
|
<dimen name="fab_border_width">0.5dp</dimen>
|
||||||
|
<dimen name="fab_size_with_shadow">62dp</dimen>
|
||||||
|
|
||||||
<dimen name="navigation_max_width">320dp</dimen>
|
<dimen name="navigation_max_width">320dp</dimen>
|
||||||
<dimen name="navigation_elevation">12dp</dimen>
|
<dimen name="navigation_elevation">12dp</dimen>
|
||||||
|
|