Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-04-26 01:38:09 +02:00
commit 082617d259
18 changed files with 387 additions and 204 deletions

View file

@ -2,7 +2,7 @@
OsmAnd OSM Automated Navigation Directions navigation software based on OpenStreetMap. OsmAnd OSM Automated Navigation Directions navigation software based on OpenStreetMap.
Copyright © 20102017 OsmAnd BV (Amstelveen, Netherlands - KvK 62066714, BTW 854627704B01). Copyright © 20102017 OsmAnd BV (Amstelveen, Netherlands - KvK 62066714, BTW 854627704B01).
The code in that repository is mainly covered by *GPLv3* (for code) and *CC-BY-ND-NC* (for artwork with restriction), except some 3rd party libs and resources. The code in that repository is mainly covered by *GPLv3* (for code) and [ CC-BY-NC-ND 4.0 ](https://creativecommons.org/licenses/by-nc-nd/4.0/) (for artwork with restriction), except some 3rd party libs and resources.
ATTENTION: please be aware that some artwork has proprietary license. ATTENTION: please be aware that some artwork has proprietary license.
Main AUTHORS (more detailed list in AUTHORS): Main AUTHORS (more detailed list in AUTHORS):
@ -36,9 +36,9 @@
- https://github.com/osmandapp/OsmAnd-tools - https://github.com/osmandapp/OsmAnd-tools
- https://github.com/osmandapp/OsmAnd-resources - https://github.com/osmandapp/OsmAnd-resources
* UI Design and UX work, such as layout, icons is covered by CC-BY-ND-NC * UI Design and UX work, such as layout, icons is covered by CC-BY-NC-ND
- https://github.com/osmandapp/Osmand/tree/master/OsmAnd/res and others - https://github.com/osmandapp/Osmand/tree/master/OsmAnd/res and others
Restriction to UI/UX CC-BY-ND-NC: Restriction to UI/UX CC-BY-NC-ND:
* Publishing applications using the OsmAnd UI/UX code to Google Play, Amazon Market or Apple Store must be done with written permission* * Publishing applications using the OsmAnd UI/UX code to Google Play, Amazon Market or Apple Store must be done with written permission*
@ -167,4 +167,4 @@
- Mobile_DEM_1255: Amante, C.J., M.R. Love, L.A. Taylor, and B.W. Eakins, 2011. Digital Elevation Models of Mobile, Alabama: Procedures, Data Sources and Analysis, NOAA Technical Memorandum NESDIS NGDC-44, Dept. of Commerce, Boulder, CO, 43 pp. - Mobile_DEM_1255: Amante, C.J., M.R. Love, L.A. Taylor, and B.W. Eakins, 2011. Digital Elevation Models of Mobile, Alabama: Procedures, Data Sources and Analysis, NOAA Technical Memorandum NESDIS NGDC-44, Dept. of Commerce, Boulder, CO, 43 pp.
- Panama_City_DEM_1276: Amante, C.J., M.R. Love, L.A. Taylor, and B.W. Eakins, 2011. Digital Elevation Models of Panama City, Florida: Procedures, Data Sources and Analysis, NOAA Technical Memorandum NESDIS NGDC-50, U.S. Dept. of Commerce, Boulder, CO, 46 pp. - Panama_City_DEM_1276: Amante, C.J., M.R. Love, L.A. Taylor, and B.W. Eakins, 2011. Digital Elevation Models of Panama City, Florida: Procedures, Data Sources and Analysis, NOAA Technical Memorandum NESDIS NGDC-50, U.S. Dept. of Commerce, Boulder, CO, 46 pp.
- Great Lakes: National Centers for Environmental Information (NCEI) - Great Lakes: National Centers for Environmental Information (NCEI)

View file

@ -38,11 +38,11 @@ public class OpeningHoursParser {
static { static {
DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US); DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US);
monthsStr = dateFormatSymbols.getShortMonths(); monthsStr = dateFormatSymbols.getShortMonths();
daysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays()); daysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 2);
dateFormatSymbols = DateFormatSymbols.getInstance(); dateFormatSymbols = DateFormatSymbols.getInstance();
localMothsStr = dateFormatSymbols.getShortMonths(); localMothsStr = dateFormatSymbols.getShortMonths();
localDaysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays()); localDaysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 3);
additionalStrings.put("off", "off"); additionalStrings.put("off", "off");
additionalStrings.put("is_open", "Open"); additionalStrings.put("is_open", "Open");
@ -75,12 +75,12 @@ public class OpeningHoursParser {
*/ */
private static String endOfDay = "24:00"; private static String endOfDay = "24:00";
private static String[] getTwoLettersStringArray(String[] strings) { private static String[] getLettersStringArray(String[] strings, int letters) {
String[] newStrings = new String[strings.length]; String[] newStrings = new String[strings.length];
for (int i = 0; i < strings.length; i++) { for (int i = 0; i < strings.length; i++) {
if (strings[i] != null) { if (strings[i] != null) {
if (strings[i].length() > 3) { if (strings[i].length() > letters) {
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, 3)); newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, letters));
} else { } else {
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i]); newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i]);
} }

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<inset>
<shape android:shape="oval" >
<solid android:color="@color/feature_purchased_bg" />
</shape>
</inset>
</item>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/ic_action_marker_passed" />
</item>
</layer-list>

View file

@ -6,6 +6,13 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -23,6 +23,16 @@
android:src="@drawable/ic_action_plus" android:src="@drawable/ic_action_plus"
android:tint="?attr/wikivoyage_active_color"/> android:tint="?attr/wikivoyage_active_color"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/img_purchased"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/dialog_content_margin"
android:layout_gravity="center"
android:src="@drawable/img_feature_purchased"
android:visibility="gone"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -23,6 +23,16 @@
android:src="@drawable/ic_action_plus" android:src="@drawable/ic_action_plus"
android:tint="?attr/wikivoyage_active_color"/> android:tint="?attr/wikivoyage_active_color"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/img_purchased"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/dialog_content_margin"
android:layout_gravity="center"
android:src="@drawable/img_feature_purchased"
android:visibility="gone"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -3783,4 +3783,21 @@
<string name="poi_cable_number">Количество тросов</string> <string name="poi_cable_number">Количество тросов</string>
<string name="poi_via_ferrata_scale">Сложность</string> <string name="poi_via_ferrata_scale">Сложность</string>
<string name="poi_glacier_type">Тип ледника</string>
<string name="poi_glacier_type_icecap">Ледниковый покров</string>
<string name="poi_glacier_type_icefield">Ледниковое поле</string>
<string name="poi_glacier_type_plateau">Плато</string>
<string name="poi_glacier_type_valley">Долинный ледник</string>
<string name="poi_glacier_type_mountain">Горный</string>
<string name="poi_glacier_type_hanging">Висячий</string>
<string name="poi_glacier_type_rock">Rock</string>
<string name="poi_glacier_type_shelf">Шельфовый</string>
<string name="poi_glacier_type_remnant">Останец</string>
<string name="poi_glacier_type_ice_tongue">Ледяной язык</string>
<string name="poi_glacier_ele_top">Высшая точка</string>
<string name="poi_glacier_ele_bottom">Низшая точка</string>
<string name="poi_glacier_slope">Средний уклон</string>
</resources> </resources>

View file

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="feature_purchased_bg">#78cc5c</color>
<color name="dialog_title_color_light">#212121</color> <color name="dialog_title_color_light">#212121</color>
<color name="dialog_title_color_dark">#cccccc</color> <color name="dialog_title_color_dark">#cccccc</color>
<color name="dialog_description_color_light">#212121</color> <color name="dialog_description_color_light">#212121</color>
@ -11,7 +13,6 @@
<color name="card_description_text_color_light">#b3b3b3</color> <color name="card_description_text_color_light">#b3b3b3</color>
<color name="card_description_text_color_dark">#4d4d4d</color> <color name="card_description_text_color_dark">#4d4d4d</color>
<color name="ctx_menu_nearby_routes_text_color_dark">#bfbfbf</color> <color name="ctx_menu_nearby_routes_text_color_dark">#bfbfbf</color>
<color name="map_toolbar_switch_track_color">#c5d2e6</color> <color name="map_toolbar_switch_track_color">#c5d2e6</color>
<color name="mapillary_color">#3db878</color> <color name="mapillary_color">#3db878</color>

View file

@ -105,6 +105,7 @@
<string name="poi_socket_cee_blue_output_filter">CEE blue output</string> <string name="poi_socket_cee_blue_output_filter">CEE blue output</string>
<string name="poi_socket_schuko_output_filter">Schuko output</string> <string name="poi_socket_schuko_output_filter">Schuko output</string>
<string name="poi_service_car">Car service</string> <string name="poi_service_car">Car service</string>
<string name="poi_glacier_type">Glacier type</string>
<!-- categories --> <!-- categories -->
<string name="poi_shop">Store</string> <string name="poi_shop">Store</string>
@ -3803,4 +3804,22 @@
<string name="poi_cable_number">Cable number</string> <string name="poi_cable_number">Cable number</string>
<string name="poi_via_ferrata_scale">Difficulty</string> <string name="poi_via_ferrata_scale">Difficulty</string>
<string name="poi_glacier_type_icecap">Icecap</string>
<string name="poi_glacier_type_icefield">Icefield</string>
<string name="poi_glacier_type_plateau">Plateau</string>
<string name="poi_glacier_type_valley">Valley</string>
<string name="poi_glacier_type_outlet">Outlet</string>
<string name="poi_glacier_type_tidewater">Tidewater</string>
<string name="poi_glacier_type_mountain">Mountain</string>
<string name="poi_glacier_type_hanging">Hanging</string>
<string name="poi_glacier_type_icefall">Icefall</string>
<string name="poi_glacier_type_rock">Rock</string>
<string name="poi_glacier_type_shelf">Shelf</string>
<string name="poi_glacier_type_remnant">Remnant</string>
<string name="poi_glacier_type_ice_tongue">Ice tongue</string>
<string name="poi_glacier_ele_top">Highest point</string>
<string name="poi_glacier_ele_bottom">Lowest point</string>
<string name="poi_glacier_slope">Average slope</string>
</resources> </resources>

View file

@ -1721,196 +1721,196 @@
<string name="osmand_play_title_30_chars">OsmAnd Maps &amp; Navigation</string> <string name="osmand_play_title_30_chars">OsmAnd Maps &amp; Navigation</string>
<string name="osmand_short_description_80_chars">Global Mobile Map Viewing &amp; Navigation for Offline and Online OSM Maps</string> <string name="osmand_short_description_80_chars">Global Mobile Map Viewing &amp; Navigation for Offline and Online OSM Maps</string>
<string name="osmand_long_description_1000_chars"> <string name="osmand_long_description_1000_chars">
OsmAnd (OSM Automated Navigation Directions) OsmAnd (OSM Automated Navigation Directions)\n\n
OsmAnd is an open source software navigation app with access to a wide variety of global OpenStreetMap (OSM) data. All map data (vector or tile maps) can be stored on the phone memory card for offline usage. Offline and online routing functionality is also offered, including turn-by-turn voice guidance. OsmAnd is an open source software navigation app with access to a wide variety of global OpenStreetMap (OSM) data. All map data (vector or tile maps) can be stored on the phone memory card for offline usage. Offline and online routing functionality is also offered, including turn-by-turn voice guidance.\n\n
Some of the core features: Some of the core features:\n
- Complete offline functionality (store downloaded vector or tile maps in the device storage) - Complete offline functionality (store downloaded vector or tile maps in the device storage)\n
- Compact offline vector maps for the whole world available - Compact offline vector maps for the whole world available\n
- Download of country or region maps directly from the app - Download of country or region maps directly from the app\n
- Overlay of several map layers possible, like GPX or navigation tracks, Points of Interest, favorites, contour lines, public transport stops, additional maps with customizable transparency - Overlay of several map layers possible, like GPX or navigation tracks, Points of Interest, favorites, contour lines, public transport stops, additional maps with customizable transparency\n
- Offline search for addresses and places (POIs) - Offline search for addresses and places (POIs)\n
- Offline routing for medium-range distances - Offline routing for medium-range distances\n
- Car, bicycle, and pedestrian modes with optional: - Car, bicycle, and pedestrian modes with optional:\n
- Automated day/night view switching - Automated day/night view switching\n
- Speed-dependent map zooming - Speed-dependent map zooming\n
- Map alignment according to compass or direction of motion - Map alignment according to compass or direction of motion\n
- Lane guidance, speed limit display, recorded and TTS voices - Lane guidance, speed limit display, recorded and TTS voices\n\n
Limitations of this free version of OsmAnd: Limitations of this free version of OsmAnd:\n
- Number of map downloads limited - Number of map downloads limited\n
- No offline access to Wikipedia POIs - No offline access to Wikipedia POIs\n\n
OsmAnd is actively being developed and our project and its continued progress relies on financial contributions for development and testing of new functionality. Please consider buying OsmAnd+, or funding specific new features or making a general donation on https://osmand.net. OsmAnd is actively being developed and our project and its continued progress relies on financial contributions for development and testing of new functionality. Please consider buying OsmAnd+, or funding specific new features or making a general donation on https://osmand.net.
</string> </string>
<string name="osmand_extended_description_part1"> <string name="osmand_extended_description_part1">
OsmAnd (OSM Automated Navigation Directions) is a map and navigation app with access to the free, worldwide, and high-quality OpenStreetMap (OSM) data. OsmAnd (OSM Automated Navigation Directions) is a map and navigation app with access to the free, worldwide, and high-quality OpenStreetMap (OSM) data.\n\n
Enjoy voice and optical navigator, viewing POIs (points of interest), creating and managing GPX tracks, using contour lines visualization and altitude info (through plugin), a choice between driving, cycling, pedestrian modes, OSM editing and much more. Enjoy voice and optical navigator, viewing POIs (points of interest), creating and managing GPX tracks, using contour lines visualization and altitude info (through plugin), a choice between driving, cycling, pedestrian modes, OSM editing and much more.
</string> </string>
<string name="osmand_extended_description_part2"> <string name="osmand_extended_description_part2">
GPS navigation GPS navigation\n
• You can choose between offline (no roaming charges when you are abroad) or online (faster) mode • You can choose between offline (no roaming charges when you are abroad) or online (faster) mode\n
• Turn-by-turn voice guidance leads you along the way (recorded and synthesized voices) • Turn-by-turn voice guidance leads you along the way (recorded and synthesized voices)\n
• The route gets rebuilt whenever you deviate from it • The route gets rebuilt whenever you deviate from it\n
• Lane guidance, street names, and estimated time of arrival will help along the way • Lane guidance, street names, and estimated time of arrival will help along the way\n
• To make your trip safer, day/night mode switches automatically • To make your trip safer, day/night mode switches automatically\n
• You can choose to show speed limits, and get reminders if you exceed it • You can choose to show speed limits, and get reminders if you exceed it\n
• Map zoom adjusts to your speed • Map zoom adjusts to your speed\n
• You can searches destinations by address, by type (e.g: parking, restaurant, hotel, gas station, museum), or by geographical coordinates • You can search for destinations by address, type (e.g: parking, restaurant, hotel, gas station, museum), or geographical coordinates\n
• Supports intermediate points on your itinerary • Supports intermediate points on your itinerary\n
• You can record your own or upload a GPX track and follow it • You can record your own or upload a GPX track and follow it\n
</string> </string>
<string name="osmand_extended_description_part3"> <string name="osmand_extended_description_part3">
Map Map\n
• Displays POIs (point of interests) around you • Displays POIs (point of interests) around you\n
• Adjusts the map to your direction of motion (or compass) • Adjusts the map to your direction of motion (or compass)\n
• Shows where you are and where you are looking at • Shows where you are and where you are looking at\n
• Share your location so that your friends can find you • Share your location so that your friends can find you\n
• Keeps your most important places in \'Favorites\' • Keeps your most important places in \'Favorites\'\n
• Allows you to choose how to display names on the map: In English, local, or phonetic spelling • Allows you to choose how to display names on the map: In English, local, or phonetic spelling\n
• Displays specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency • Displays specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency\n
</string> </string>
<string name="osmand_extended_description_part4"> <string name="osmand_extended_description_part4">
Skiing Skiing\n
OsmAnd ski maps plugin enables you to see ski tracks with level of complexity and some additional information, like location of lifts and other facilities. OsmAnd ski maps plugin enables you to see ski tracks with level of complexity and some additional information, like location of lifts and other facilities.
</string> </string>
<string name="osmand_extended_description_part5"> <string name="osmand_extended_description_part5">
Cycling Cycling\n
• You can find cycling paths on the map • You can find cycling paths on the map\n
• GPS navigation in cycling mode builds your route using cycling paths • GPS navigation in cycling mode builds your route using cycling paths\n
• You can see your speed and altitude • You can see your speed and altitude\n
• GPX recording option enables you to record your trip and share it • GPX recording option enables you to record your trip and share it\n
• Via an additional plugin you can enable contour lines and hillshading • Via an additional plugin you can enable contour lines and hillshading
</string> </string>
<string name="osmand_extended_description_part6"> <string name="osmand_extended_description_part6">
Walking, hiking, city tour Walking, hiking, city tour\n
• The map shows you walking and hiking paths • The map shows you walking and hiking paths\n
• Wikipedia in your preferred language can tell you a lot during a city tour • Wikipedia in your preferred language can tell you a lot during a city tour\n
• Public transport stops (bus, tram, train), including line names, help to navigate in a new city • Public transport stops (bus, tram, train), including line names, help to navigate in a new city\n
• GPS navigation in pedestrian mode builds your route using walking paths • GPS navigation in pedestrian mode builds your route using walking paths\n
• You can upload and follow a GPX route or record and share your own • You can upload and follow a GPX route or record and share your own\n
</string> </string>
<string name="osmand_extended_description_part7"> <string name="osmand_extended_description_part7">
Contribute to OSM Contribute to OSM\n
• Report data bugs • Report data bugs\n
• Upload GPX tracks to OSM directly from the app • Upload GPX tracks to OSM directly from the app\n
• Add POIs and directly upload them to OSM (or later if offline) • Add POIs and directly upload them to OSM (or later if offline)\n
</string> </string>
<string name="osmand_extended_description_part8"> <string name="osmand_extended_description_part8">
OsmAnd is open-source and actively being developed. Everyone can contribute to the app by reporting bugs, improving translations or coding new features. The project is in a lively state of continuous improvement by all these forms of developer and user interaction. The project progress also relies on financial contributions to fund coding and testing of new functionalities. OsmAnd is open-source and actively being developed. Everyone can contribute to the app by reporting bugs, improving translations or coding new features. The project is in a lively state of continuous improvement by all these forms of developer and user interaction. The project progress also relies on financial contributions to fund coding and testing of new functionalities.\n
Approximate map coverage and quality: Approximate map coverage and quality:\n
• Western Europe: **** • Western Europe: ****\n
• Eastern Europe: *** • Eastern Europe: ***\n
• Russia: *** • Russia: ***\n
• North America: *** • North America: ***\n
• South America: ** • South America: **\n
• Asia: ** • Asia: **\n
• Japan &amp; Korea: *** • Japan &amp; Korea: ***\n
• Middle East: ** • Middle East: **\n
• Africa: ** • Africa: **\n
• Antarctica: * • Antarctica: *\n
Most countries around the globe are available for download! Most countries around the globe are available for download!\n
Get a reliable navigator in your country - be it France, Germany, Mexico, UK, Spain, Netherlands, USA, Russia, Brazil or any other. Get a reliable navigator in your country - be it France, Germany, Mexico, UK, Spain, Netherlands, USA, Russia, Brazil or any other.
</string> </string>
<string name="osmand_plus_play_title_30_chars">OsmAnd+ Maps &amp; Navigation</string> <string name="osmand_plus_play_title_30_chars">OsmAnd+ Maps &amp; Navigation</string>
<string name="osmand_plus_short_description_80_chars">Global Mobile Map Viewing &amp; Navigation for Offline and Online OSM Maps</string> <string name="osmand_plus_short_description_80_chars">Global Mobile Map Viewing &amp; Navigation for Offline and Online OSM Maps</string>
<string name="osmand_plus_long_description_1000_chars"> <string name="osmand_plus_long_description_1000_chars">
OsmAnd+ (OSM Automated Navigation Directions) OsmAnd+ (OSM Automated Navigation Directions)\n\n
OsmAnd+ is an open source software navigation app with access to a wide variety of global OpenStreetMap (OSM) data. All map data (vector or tile maps) can be stored on the phone memory card for offline use. Offline and online routing functionality is also offered, including turn-by-turn voice guidance. OsmAnd+ is an open source software navigation app with access to a wide variety of global OpenStreetMap (OSM) data. All map data (vector or tile maps) can be stored on the phone memory card for offline use. Offline and online routing functionality is also offered, including turn-by-turn voice guidance.\n\n
OsmAnd+ is the paid app version, by buying it you support the project, fund the development of new features, and receive the latest updates. OsmAnd+ is the paid app version, by buying it you support the project, fund the development of new features, and receive the latest updates.\n\n
Some of the core features: Some of the core features:\n
- Complete offline functionality (store downloaded vector or tile maps in the device storage) - Complete offline functionality (store downloaded vector or tile maps in the device storage)\n
- Compact offline vector maps for the whole world available - Compact offline vector maps for the whole world available\n
- Unlimited downloading of country or region maps directly from the app - Unlimited downloading of country or region maps directly from the app\n
- Offline Wikipedia feature (download Wikipedia POIs), great for sightseeing - Offline Wikipedia feature (download Wikipedia POIs), great for sightseeing\n
- Overlay of several map layers possible, like GPX or navigation tracks, Points of Interest, favorites, contour lines, public transport stops, additional maps with customizable transparency - Overlay of several map layers possible, like GPX or navigation tracks, Points of Interest, favorites, contour lines, public transport stops, additional maps with customizable transparency\n\n
- Offline search for addresses and places (POIs) - Offline search for addresses and places (POIs)\n
- Offline routing for medium-range distances - Offline routing for medium-range distances\n
- Car, bicycle, and pedestrian modes with optional: - Car, bicycle, and pedestrian modes with optional:\n
- Automated day/night view switching - Automated day/night view switching\n
- Speed-dependent map zooming - Speed-dependent map zooming\n
- Map alignment according to compass or direction of motion - Map alignment according to compass or direction of motion\n
- Lane guidance, speed limit display, recorded and TTS voices - Lane guidance, speed limit display, recorded and TTS voices\n
</string> </string>
<string name="osmand_plus_extended_description_part1"> <string name="osmand_plus_extended_description_part1">
OsmAnd+ (OSM Automated Navigation Directions) is a map and navigation app with access to the free, worldwide, and high-quality OpenStreetMap (OSM) data. OsmAnd+ (OSM Automated Navigation Directions) is a map and navigation app with access to the free, worldwide, and high-quality OpenStreetMap (OSM) data.\n
Enjoy voice and optical navigation, viewing POIs (points of interest), creating and managing GPX tracks, using contour lines visualization and altitude info, a choice between driving, cycling, pedestrian modes, OSM editing and much more. Enjoy voice and optical navigation, viewing POIs (points of interest), creating and managing GPX tracks, using contour lines visualization and altitude info, a choice between driving, cycling, pedestrian modes, OSM editing and much more.\n\n
OsmAnd+ is the paid app version. By buying it, you support the project, fund the development of new features, and receive the latest updates. OsmAnd+ is the paid app version. By buying it, you support the project, fund the development of new features, and receive the latest updates.\n\n
Some of the main features: Some of the main features:
</string> </string>
<string name="osmand_plus_extended_description_part2"> <string name="osmand_plus_extended_description_part2">
Navigation Navigation\n
• Works online (fast) or offline (no roaming charges when you are abroad) • Works online (fast) or offline (no roaming charges when you are abroad)\n
• Turn-by-turn voice guidance (recorded and synthesized voices) • Turn-by-turn voice guidance (recorded and synthesized voices)\n
• Optional lane guidance, street name display, and estimated time of arrival • Optional lane guidance, street name display, and estimated time of arrival\n
• Supports intermediate points on your itinerary • Supports intermediate points on your itinerary\n
• Automatic re-routing whenever you deviate from the route • Automatic re-routing whenever you deviate from the route\n
• Search for places by address, by type (e.g: restaurant, hotel, gas station, museum), or by geographical coordinates • Search for places by address, by type (e.g: restaurant, hotel, gas station, museum), or by geographical coordinates\n
</string> </string>
<string name="osmand_plus_extended_description_part3"> <string name="osmand_plus_extended_description_part3">
Map Viewing Map Viewing\n
• Display your position and orientation • Display your position and orientation\n
• Optionally align the picture according to compass or your direction of motion • Optionally align the picture according to compass or your direction of motion\n
• Save your most important places as Favorites • Save your most important places as favorites\n
• Display POIs (point of interests) around you • Display POIs (point of interests) around you\n
• Display specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency • Display specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency\n
• Optionally display place names in English, local, or phonetic spelling • Optionally display place names in English, local, or phonetic spelling\n
</string> </string>
<string name="osmand_plus_extended_description_part4"> <string name="osmand_plus_extended_description_part4">
Use OSM and Wikipedia Data Use OSM and Wikipedia Data\n
• High-quality information from the best collaborative projects of the world • High-quality information from the best collaborative projects of the world\n
• OSM data available per country or region • OSM data available per country or region\n
• Wikipedia POIs, great for sightseeing • Wikipedia POIs, great for sightseeing\n
• Unlimited free downloads, directly from the app • Unlimited free downloads, directly from the app\n
• Compact offline vector maps updated at least once a month • Compact offline vector maps updated at least once a month\n\n
• Selection between complete region data and just road network (Example: All of Japan is 700 MB or 200 MB for the road network part thereof) • Selection between complete region data and just road network (Example: All of Japan is 700 MB or 200 MB for the road network part thereof)
</string> </string>
<string name="osmand_plus_extended_description_part5"> <string name="osmand_plus_extended_description_part5">
Safety Features Safety Features\n
• Optional automated day/night view switching • Optional automated day/night view switching\n
• Optional speed limit display, with reminder if you exceed it • Optional speed limit display, with reminder if you exceed it\n
• Optional speed-dependent zooming • Optional speed-dependent zooming\n
• Share your location so that your friends can find you • Share your location so that your friends can find you\n
</string> </string>
<string name="osmand_plus_extended_description_part6"> <string name="osmand_plus_extended_description_part6">
Bicycle and Pedestrian Features Bicycle and Pedestrian Features\n
• Viewing foot, hiking, and bike paths, great for outdoor activities • Viewing foot, hiking, and bike paths, great for outdoor activities\n
• Special routing and display modes for bike and pedestrian • Special routing and display modes for bike and pedestrian\n
• Optional public transport stops (bus, tram, train) including line names • Optional public transport stops (bus, tram, train) including line names\n
• Optional trip recording to local GPX file or online service • Optional trip recording to local GPX file or online service\n
• Optional speed and altitude display • Optional speed and altitude display\n
• Display of contour lines and hillshading (via additional plugin) • Display of contour lines and hillshading (via additional plugin)
</string> </string>
<string name="osmand_plus_extended_description_part7"> <string name="osmand_plus_extended_description_part7">
Directly Contribute to OSM Directly Contribute to OSM\n
• Report data bugs • Report data bugs\n
• Upload GPX tracks to OSM directly from the app • Upload GPX tracks to OSM directly from the app\n
• Add POIs and directly upload them to OSM (or later if offline) • Add POIs and directly upload them to OSM (or later if offline)\n
• Optional trip recording also in background mode (while device is in sleep mode) • Optional trip recording also in background mode (while device is in sleep mode)\n
OsmAnd is open-source software in active development. Everyone can contribute to the app by reporting bugs, improving translations or coding new features or user interaction. The project progress also relies on financial contributions for coding and testing new functionality. OsmAnd is open-source software in active development. Everyone can contribute to the app by reporting bugs, improving translations or coding new features or user interaction. The project progress also relies on financial contributions for coding and testing new functionality.
</string> </string>
<string name="osmand_plus_extended_description_part8"> <string name="osmand_plus_extended_description_part8">
Approximate map coverage and quality: Approximate map coverage and quality:\n
• Western Europe: **** • Western Europe: ****\n
• Eastern Europe: *** • Eastern Europe: ***\n
• Russia: *** • Russia: ***\n
• North America: *** • North America: ***\n
• South America: ** • South America: **\n
• Asia: ** • Asia: **\n
• Japan &amp; Korea: *** • Japan &amp; Korea: ***\n
• Middle East: ** • Middle East: **\n
• Africa: ** • Africa: **\n
• Antarctica: * • Antarctica: *\n
Most countries around the globe available as downloads! Most countries around the globe available as downloads\n
From Afghanistan to Zimbabwe, from Australia to the USA. Argentina, Brazil, Canada, France, Germany, Mexico, UK, Spain, … From Afghanistan to Zimbabwe, from Australia to the USA. Argentina, Brazil, Canada, France, Germany, Mexico, UK, Spain, …\n
</string> </string>
<string name="filterpoi_activity">Create POI filter</string> <string name="filterpoi_activity">Create POI filter</string>
<string name="recalculate_route_to_your_location">Transport mode:</string> <string name="recalculate_route_to_your_location">Transport mode:</string>

View file

@ -83,11 +83,12 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
case UNLOCK_ALL_FEATURES: case UNLOCK_ALL_FEATURES:
case DONATION_TO_OSM: case DONATION_TO_OSM:
return false; return false;
case SEA_DEPTH_MAPS:
return ctx.getSettings().DEPTH_CONTOURS_PURCHASED.get();
case WIKIVOYAGE_OFFLINE: case WIKIVOYAGE_OFFLINE:
return ctx.getSettings().TRAVEL_ARTICLES_PURCHASED.get(); return ctx.getSettings().TRAVEL_ARTICLES_PURCHASED.get();
case CONTOUR_LINES_HILLSHADE_MAPS: case CONTOUR_LINES_HILLSHADE_MAPS:
boolean srtmEnabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null; return OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null;
return srtmEnabled && ctx.getSettings().DEPTH_CONTOURS_PURCHASED.get();
} }
return false; return false;
} }
@ -234,6 +235,15 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
String featureName = feature.toHumanString(ctx); String featureName = feature.toHumanString(ctx);
View featureRow = inflate(hasSelectedOsmLiveFeature(feature) View featureRow = inflate(hasSelectedOsmLiveFeature(feature)
? R.layout.purchase_dialog_card_selected_row : R.layout.purchase_dialog_card_row, cardView); ? R.layout.purchase_dialog_card_selected_row : R.layout.purchase_dialog_card_row, cardView);
AppCompatImageView imgView = (AppCompatImageView) featureRow.findViewById(R.id.img);
AppCompatImageView imgPurchasedView = (AppCompatImageView) featureRow.findViewById(R.id.img_purchased);
if (feature.isFeaturePurchased(app)) {
imgView.setVisibility(View.GONE);
imgPurchasedView.setVisibility(View.VISIBLE);
} else {
imgView.setVisibility(View.VISIBLE);
imgPurchasedView.setVisibility(View.GONE);
}
TextViewEx titleView = (TextViewEx) featureRow.findViewById(R.id.title); TextViewEx titleView = (TextViewEx) featureRow.findViewById(R.id.title);
titleView.setText(featureName); titleView.setText(featureName);
featureRowDiv = featureRow.findViewById(R.id.div); featureRowDiv = featureRow.findViewById(R.id.div);
@ -325,6 +335,15 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
String featureName = feature.toHumanString(ctx); String featureName = feature.toHumanString(ctx);
featureRow = inflate(hasSelectedPlanTypeFeature(feature) featureRow = inflate(hasSelectedPlanTypeFeature(feature)
? R.layout.purchase_dialog_card_selected_row : R.layout.purchase_dialog_card_row, cardView); ? R.layout.purchase_dialog_card_selected_row : R.layout.purchase_dialog_card_row, cardView);
AppCompatImageView imgView = (AppCompatImageView) featureRow.findViewById(R.id.img);
AppCompatImageView imgPurchasedView = (AppCompatImageView) featureRow.findViewById(R.id.img_purchased);
if (feature.isFeaturePurchased(app)) {
imgView.setVisibility(View.GONE);
imgPurchasedView.setVisibility(View.VISIBLE);
} else {
imgView.setVisibility(View.VISIBLE);
imgPurchasedView.setVisibility(View.GONE);
}
TextViewEx titleView = (TextViewEx) featureRow.findViewById(R.id.title); TextViewEx titleView = (TextViewEx) featureRow.findViewById(R.id.title);
titleView.setText(featureName); titleView.setText(featureName);
rowsContainer.addView(featureRow); rowsContainer.addView(featureRow);

View file

@ -252,7 +252,7 @@ public class InAppPurchaseHelper {
} }
public boolean needRequestInventory() { public boolean needRequestInventory() {
return !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get() return (ctx.getSettings().LIVE_UPDATES_PURCHASED.get() && !ctx.getSettings().BILLING_PURCHASE_TOKEN_SENT.get())
|| System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC; || System.currentTimeMillis() - lastValidationCheckTime > PURCHASE_VALIDATION_PERIOD_MSEC;
} }

View file

@ -1,6 +1,5 @@
package net.osmand.plus.srtmplugin; package net.osmand.plus.srtmplugin;
import android.content.Intent;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -11,8 +10,8 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.DownloadResources;
@ -135,9 +134,12 @@ public class ContourLinesMenu {
} }
}); });
} else if (itemId == R.string.srtm_plugin_name) { } else if (itemId == R.string.srtm_plugin_name) {
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager());
/*
Intent intent = new Intent(mapActivity, PluginActivity.class); Intent intent = new Intent(mapActivity, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId()); intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId());
mapActivity.startActivity(intent); mapActivity.startActivity(intent);
*/
closeDashboard(mapActivity); closeDashboard(mapActivity);
} else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) { } else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) {
plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() { plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() {

View file

@ -10,6 +10,7 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.DownloadResources;
@ -19,6 +20,8 @@ import net.osmand.plus.download.IndexItem;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import static net.osmand.plus.srtmplugin.ContourLinesMenu.closeDashboard;
public class HillshadeMenu { public class HillshadeMenu {
private static final String TAG = "HillshadeMenu"; private static final String TAG = "HillshadeMenu";
@ -71,6 +74,14 @@ public class HillshadeMenu {
}); });
} }
}); });
} else if (itemId == R.string.srtm_plugin_name) {
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager());
/*
Intent intent = new Intent(mapActivity, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId());
mapActivity.startActivity(intent);
*/
closeDashboard(mapActivity);
} }
return false; return false;
} }

View file

@ -8,8 +8,10 @@ import net.osmand.Collator;
import net.osmand.CollatorStringMatcher; import net.osmand.CollatorStringMatcher;
import net.osmand.CollatorStringMatcher.StringMatcherMode; import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.OsmAndCollator; import net.osmand.OsmAndCollator;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -17,6 +19,7 @@ import net.osmand.plus.R;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -205,7 +208,11 @@ public class TravelDbHelper {
SQLiteConnection conn = openConnection(); SQLiteConnection conn = openConnection();
if (conn != null) { if (conn != null) {
TravelArticle travelArticle; TravelArticle travelArticle;
SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " + ARTICLES_TABLE_NAME + " ORDER BY RANDOM() LIMIT 100", null); SQLiteCursor cursor = conn.rawQuery("SELECT * FROM "
+ ARTICLES_TABLE_NAME
+ " WHERE article_id IN (SELECT article_id FROM "
+ ARTICLES_TABLE_NAME
+ " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null);
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
travelArticle = readArticle(cursor); travelArticle = readArticle(cursor);

View file

@ -68,6 +68,10 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
holder.description.setText(String.valueOf(getArticleItemCount())); holder.description.setText(String.valueOf(getArticleItemCount()));
} else if (viewHolder instanceof ArticleTravelVH && item instanceof ArticleTravelCard) { } else if (viewHolder instanceof ArticleTravelVH && item instanceof ArticleTravelCard) {
((ArticleTravelCard) item).bindViewHolder(viewHolder); ((ArticleTravelCard) item).bindViewHolder(viewHolder);
ArticleTravelCard articleTravelCard = (ArticleTravelCard) item;
articleTravelCard.setLastItem(position == getLastArticleItemIndex());
articleTravelCard.bindViewHolder(viewHolder);
((ArticleTravelCard) item).bindViewHolder(viewHolder);
} else if (viewHolder instanceof OpenBetaTravelVH && item instanceof OpenBetaTravelCard) { } else if (viewHolder instanceof OpenBetaTravelVH && item instanceof OpenBetaTravelCard) {
((OpenBetaTravelCard) item).bindViewHolder(viewHolder); ((OpenBetaTravelCard) item).bindViewHolder(viewHolder);
} else if (viewHolder instanceof StartEditingTravelVH && item instanceof StartEditingTravelCard) { } else if (viewHolder instanceof StartEditingTravelVH && item instanceof StartEditingTravelCard) {
@ -109,6 +113,16 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
return count; return count;
} }
private int getLastArticleItemIndex() {
for (int i = items.size() - 1; i > 0; i--) {
Object o = items.get(i);
if (o instanceof ArticleTravelCard) {
return i;
}
}
return 0;
}
private Object getItem(int position) { private Object getItem(int position) {
return items.get(position); return items.get(position);
} }

View file

@ -9,15 +9,18 @@ import android.support.v7.widget.RecyclerView;
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.ProgressBar;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.LocalIndexHelper; import net.osmand.plus.activities.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask; import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
import net.osmand.plus.wikivoyage.data.TravelArticle; import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard; import net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard;
import net.osmand.plus.wikivoyage.explore.travelcards.OpenBetaTravelCard; import net.osmand.plus.wikivoyage.explore.travelcards.OpenBetaTravelCard;
import net.osmand.plus.wikivoyage.explore.travelcards.StartEditingTravelCard; import net.osmand.plus.wikivoyage.explore.travelcards.StartEditingTravelCard;
@ -32,82 +35,71 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
private static final int DOWNLOAD_UPDATE_CARD_POSITION = 0; private static final int DOWNLOAD_UPDATE_CARD_POSITION = 0;
private ExploreRvAdapter adapter = new ExploreRvAdapter(); private ExploreRvAdapter adapter = new ExploreRvAdapter();
private StartEditingTravelCard startEditingTravelCard;
private AddDownloadUpdateCardTask addDownloadUpdateCardTask; private ProgressBar progressBar;
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View mainView = inflater.inflate(R.layout.fragment_explore_tab, container, false); final View mainView = inflater.inflate(R.layout.fragment_explore_tab, container, false);
progressBar = (ProgressBar) mainView.findViewById(R.id.progressBar);
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
adapter.setItems(generateItems()); adapter.setItems(generateItems());
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
rv.setLayoutManager(new LinearLayoutManager(getContext())); rv.setLayoutManager(new LinearLayoutManager(getContext()));
rv.setAdapter(adapter); rv.setAdapter(adapter);
return mainView; return mainView;
} }
@Override
public void onDestroyView() {
cancelAddDownloadUpdateCardTask();
super.onDestroyView();
}
private void cancelAddDownloadUpdateCardTask() {
if (addDownloadUpdateCardTask != null) {
addDownloadUpdateCardTask.cancel(true);
addDownloadUpdateCardTask = null;
}
}
private List<Object> generateItems() { private List<Object> generateItems() {
final List<Object> items = new ArrayList<>(); final List<Object> items = new ArrayList<>();
final OsmandApplication app = getMyApplication(); final OsmandApplication app = getMyApplication();
final boolean nightMode = !getSettings().isLightContent(); final boolean nightMode = !getSettings().isLightContent();
addDownloadUpdateCard(nightMode); addDownloadUpdateCard(nightMode);
startEditingTravelCard = new StartEditingTravelCard(app, nightMode);
items.add(new OpenBetaTravelCard(app, nightMode, getFragmentManager())); items.add(new OpenBetaTravelCard(app, nightMode, getFragmentManager()));
items.add(new StartEditingTravelCard(app, nightMode)); items.add(startEditingTravelCard);
addPopularDestinations(items, nightMode); addPopularDestinations(app, nightMode);
return items; return items;
} }
private void addDownloadUpdateCard(boolean nightMode) { private void addDownloadUpdateCard(final boolean nightMode) {
addDownloadUpdateCardTask = new AddDownloadUpdateCardTask(getMyApplication(), adapter, nightMode); final OsmandApplication app = getMyApplication();
addDownloadUpdateCardTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new CheckWorldWikivoyageTask(app, new CheckWorldWikivoyageTask.Callback() {
} @Override
public void onCheckFinished(boolean worldWikivoyageDownloaded) {
private void addPopularDestinations(@NonNull List<Object> items, boolean nightMode) { if (!worldWikivoyageDownloaded && adapter != null) {
OsmandApplication app = getMyApplication(); TravelDownloadUpdateCard card = new TravelDownloadUpdateCard(app, nightMode, true);
List<TravelArticle> savedArticles = app.getTravelDbHelper().searchPopular(); if (adapter.addItem(DOWNLOAD_UPDATE_CARD_POSITION, card)) {
if (!savedArticles.isEmpty()) { adapter.notifyDataSetChanged();
items.add(getString(R.string.popular_destinations)); }
for (TravelArticle article : savedArticles) { }
items.add(new ArticleTravelCard(app, nightMode, article, getFragmentManager()));
} }
} }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
private static class AddDownloadUpdateCardTask extends AsyncTask<Void, Void, TravelDownloadUpdateCard> { private void addPopularDestinations(OsmandApplication app, boolean nightMode) {
PopularDestinationsSearchTask popularDestinationsSearchTask = new PopularDestinationsSearchTask(app.getTravelDbHelper(), getMyActivity(), adapter, nightMode, startEditingTravelCard, progressBar);
popularDestinationsSearchTask.execute();
}
private static class CheckWorldWikivoyageTask extends AsyncTask<Void, Void, Boolean> {
private OsmandApplication app; private OsmandApplication app;
private WeakReference<ExploreRvAdapter> adapterWr; private Callback callback;
private boolean nightMode; CheckWorldWikivoyageTask(OsmandApplication app, Callback callback) {
AddDownloadUpdateCardTask(OsmandApplication app, ExploreRvAdapter adapter, boolean nightMode) {
this.app = app; this.app = app;
this.adapterWr = new WeakReference<>(adapter); this.callback = callback;
this.nightMode = nightMode;
} }
@Override @Override
protected TravelDownloadUpdateCard doInBackground(Void... voids) { protected Boolean doInBackground(Void... voids) {
final boolean[] worldWikivoyageDownloaded = new boolean[1]; final boolean[] worldWikivoyageDownloaded = new boolean[1];
new LocalIndexHelper(app).getLocalTravelFiles(new AbstractLoadLocalIndexTask() { new LocalIndexHelper(app).getLocalTravelFiles(new AbstractLoadLocalIndexTask() {
@Override @Override
public void loadFile(LocalIndexInfo... loaded) { public void loadFile(LocalIndexInfo... loaded) {
@ -118,25 +110,73 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
} }
} }
}); });
return worldWikivoyageDownloaded[0];
if (!worldWikivoyageDownloaded[0] && !isCancelled()) {
TravelDownloadUpdateCard card = new TravelDownloadUpdateCard(app, nightMode, true);
return card;
}
return null;
} }
@Override @Override
protected void onPostExecute(TravelDownloadUpdateCard card) { protected void onPostExecute(Boolean worldWikivoyageDownloaded) {
if (!isCancelled() && card != null) { if (callback != null) {
ExploreRvAdapter adapter = adapterWr.get(); callback.onCheckFinished(worldWikivoyageDownloaded);
if (adapter != null) { }
if (adapter.addItem(DOWNLOAD_UPDATE_CARD_POSITION, card)) { callback = null;
adapter.notifyItemInserted(DOWNLOAD_UPDATE_CARD_POSITION); }
interface Callback {
void onCheckFinished(boolean worldWikivoyageDownloaded);
}
}
private static class PopularDestinationsSearchTask extends AsyncTask<Void, TravelDbHelper, List<TravelArticle>> {
private TravelDbHelper travelDbHelper;
private WeakReference<OsmandActionBarActivity> weakContext;
private WeakReference<ExploreRvAdapter> weakAdapter;
private WeakReference<StartEditingTravelCard> weakStartEditingTravelCard;
private WeakReference<View> weakProgressBar;
private boolean nightMode;
PopularDestinationsSearchTask(TravelDbHelper travelDbHelper,
OsmandActionBarActivity context, ExploreRvAdapter adapter, boolean nightMode, StartEditingTravelCard startEditingTravelCard, View progressBar) {
this.travelDbHelper = travelDbHelper;
weakContext = new WeakReference<>(context);
weakAdapter = new WeakReference<>(adapter);
weakStartEditingTravelCard = new WeakReference<>(startEditingTravelCard);
weakProgressBar = new WeakReference<>(progressBar);
this.nightMode = nightMode;
}
@Override
protected List<TravelArticle> doInBackground(Void... voids) {
return travelDbHelper.searchPopular();
}
@Override
protected void onPreExecute() {
super.onPreExecute();
weakProgressBar.get().setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(List<TravelArticle> items) {
OsmandActionBarActivity activity = weakContext.get();
ExploreRvAdapter adapter = weakAdapter.get();
List<Object> adapterItems = adapter.getItems();
StartEditingTravelCard startEditingTravelCard = weakStartEditingTravelCard.get();
adapterItems.remove(startEditingTravelCard);
if (!items.isEmpty()) {
if (activity != null) {
adapterItems.add(activity.getResources().getString(R.string.popular_destinations));
for (TravelArticle article : items) {
adapterItems.add(new ArticleTravelCard(activity.getMyApplication(), nightMode, article, activity.getSupportFragmentManager()));
} }
} }
} }
weakProgressBar.get().setVisibility(View.GONE);
adapterItems.add(startEditingTravelCard);
adapter.notifyDataSetChanged();
} }
} }
} }

View file

@ -30,6 +30,7 @@ public class ArticleTravelCard extends BaseTravelCard {
private TravelArticle article; private TravelArticle article;
private final Drawable readIcon; private final Drawable readIcon;
private FragmentManager fragmentManager; private FragmentManager fragmentManager;
private boolean isLastItem;
public ArticleTravelCard(OsmandApplication app, boolean nightMode, TravelArticle article, FragmentManager fragmentManager) { public ArticleTravelCard(OsmandApplication app, boolean nightMode, TravelArticle article, FragmentManager fragmentManager) {
super(app, nightMode); super(app, nightMode);
@ -73,6 +74,8 @@ public class ArticleTravelCard extends BaseTravelCard {
holder.itemView.setOnClickListener(readClickListener); holder.itemView.setOnClickListener(readClickListener);
holder.leftButton.setCompoundDrawablesWithIntrinsicBounds(readIcon, null, null, null); holder.leftButton.setCompoundDrawablesWithIntrinsicBounds(readIcon, null, null, null);
updateSaveButton(holder); updateSaveButton(holder);
holder.divider.setVisibility(isLastItem ? View.GONE : View.VISIBLE);
holder.shadow.setVisibility(isLastItem ? View.VISIBLE : View.GONE);
} }
} }
@ -124,6 +127,10 @@ public class ArticleTravelCard extends BaseTravelCard {
} }
} }
public void setLastItem(boolean lastItem) {
isLastItem = lastItem;
}
@Override @Override
public int getCardType() { public int getCardType() {
return TYPE; return TYPE;