Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
082617d259
18 changed files with 387 additions and 204 deletions
6
LICENSE
6
LICENSE
|
@ -2,7 +2,7 @@
|
|||
OsmAnd – OSM Automated Navigation Directions – navigation software based on OpenStreetMap.
|
||||
Copyright © 2010–2017 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.
|
||||
|
||||
Main AUTHORS (more detailed list in AUTHORS):
|
||||
|
@ -36,9 +36,9 @@
|
|||
- https://github.com/osmandapp/OsmAnd-tools
|
||||
- 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
|
||||
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*
|
||||
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@ public class OpeningHoursParser {
|
|||
static {
|
||||
DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US);
|
||||
monthsStr = dateFormatSymbols.getShortMonths();
|
||||
daysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays());
|
||||
daysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 2);
|
||||
|
||||
dateFormatSymbols = DateFormatSymbols.getInstance();
|
||||
localMothsStr = dateFormatSymbols.getShortMonths();
|
||||
localDaysStr = getTwoLettersStringArray(dateFormatSymbols.getShortWeekdays());
|
||||
localDaysStr = getLettersStringArray(dateFormatSymbols.getShortWeekdays(), 3);
|
||||
|
||||
additionalStrings.put("off", "off");
|
||||
additionalStrings.put("is_open", "Open");
|
||||
|
@ -75,12 +75,12 @@ public class OpeningHoursParser {
|
|||
*/
|
||||
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];
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
if (strings[i] != null) {
|
||||
if (strings[i].length() > 3) {
|
||||
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, 3));
|
||||
if (strings[i].length() > letters) {
|
||||
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i].substring(0, letters));
|
||||
} else {
|
||||
newStrings[i] = Algorithms.capitalizeFirstLetter(strings[i]);
|
||||
}
|
||||
|
|
19
OsmAnd/res/drawable/img_feature_purchased.xml
Normal file
19
OsmAnd/res/drawable/img_feature_purchased.xml
Normal 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>
|
|
@ -6,6 +6,13 @@
|
|||
android:gravity="center"
|
||||
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:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
android:src="@drawable/ic_action_plus"
|
||||
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
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
android:src="@drawable/ic_action_plus"
|
||||
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
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -3783,4 +3783,21 @@
|
|||
<string name="poi_cable_number">Количество тросов</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>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="feature_purchased_bg">#78cc5c</color>
|
||||
|
||||
<color name="dialog_title_color_light">#212121</color>
|
||||
<color name="dialog_title_color_dark">#cccccc</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_dark">#4d4d4d</color>
|
||||
|
||||
|
||||
<color name="ctx_menu_nearby_routes_text_color_dark">#bfbfbf</color>
|
||||
<color name="map_toolbar_switch_track_color">#c5d2e6</color>
|
||||
<color name="mapillary_color">#3db878</color>
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
<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_service_car">Car service</string>
|
||||
<string name="poi_glacier_type">Glacier type</string>
|
||||
|
||||
<!-- categories -->
|
||||
<string name="poi_shop">Store</string>
|
||||
|
@ -3803,4 +3804,22 @@
|
|||
<string name="poi_cable_number">Cable number</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>
|
||||
|
|
|
@ -1721,196 +1721,196 @@
|
|||
<string name="osmand_play_title_30_chars">OsmAnd Maps & Navigation</string>
|
||||
<string name="osmand_short_description_80_chars">Global Mobile Map Viewing & Navigation for Offline and Online OSM Maps</string>
|
||||
<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:
|
||||
- Complete offline functionality (store downloaded vector or tile maps in the device storage)
|
||||
- Compact offline vector maps for the whole world available
|
||||
- Download of country or region maps directly from the app
|
||||
- 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
|
||||
- Offline search for addresses and places (POIs)
|
||||
- Offline routing for medium-range distances
|
||||
- Car, bicycle, and pedestrian modes with optional:
|
||||
- Automated day/night view switching
|
||||
- Speed-dependent map zooming
|
||||
- Map alignment according to compass or direction of motion
|
||||
- Lane guidance, speed limit display, recorded and TTS voices
|
||||
Some of the core features:\n
|
||||
- Complete offline functionality (store downloaded vector or tile maps in the device storage)\n
|
||||
- Compact offline vector maps for the whole world available\n
|
||||
- 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\n
|
||||
- Offline search for addresses and places (POIs)\n
|
||||
- Offline routing for medium-range distances\n
|
||||
- Car, bicycle, and pedestrian modes with optional:\n
|
||||
- Automated day/night view switching\n
|
||||
- Speed-dependent map zooming\n
|
||||
- Map alignment according to compass or direction of motion\n
|
||||
- Lane guidance, speed limit display, recorded and TTS voices\n\n
|
||||
|
||||
Limitations of this free version of OsmAnd:
|
||||
- Number of map downloads limited
|
||||
- No offline access to Wikipedia POIs
|
||||
Limitations of this free version of OsmAnd:\n
|
||||
- Number of map downloads limited\n
|
||||
- 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.
|
||||
</string>
|
||||
<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.
|
||||
</string>
|
||||
<string name="osmand_extended_description_part2">
|
||||
GPS navigation
|
||||
• You can choose between offline (no roaming charges when you are abroad) or online (faster) mode
|
||||
• Turn-by-turn voice guidance leads you along the way (recorded and synthesized voices)
|
||||
• The route gets rebuilt whenever you deviate from it
|
||||
• Lane guidance, street names, and estimated time of arrival will help along the way
|
||||
• To make your trip safer, day/night mode switches automatically
|
||||
• You can choose to show speed limits, and get reminders if you exceed it
|
||||
• Map zoom adjusts to your speed
|
||||
• You can searches destinations by address, by type (e.g: parking, restaurant, hotel, gas station, museum), or by geographical coordinates
|
||||
• Supports intermediate points on your itinerary
|
||||
• You can record your own or upload a GPX track and follow it
|
||||
GPS navigation\n
|
||||
• 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)\n
|
||||
• The route gets rebuilt whenever you deviate from it\n
|
||||
• 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\n
|
||||
• You can choose to show speed limits, and get reminders if you exceed it\n
|
||||
• Map zoom adjusts to your speed\n
|
||||
• 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\n
|
||||
• You can record your own or upload a GPX track and follow it\n
|
||||
</string>
|
||||
<string name="osmand_extended_description_part3">
|
||||
Map
|
||||
• Displays POIs (point of interests) around you
|
||||
• Adjusts the map to your direction of motion (or compass)
|
||||
• Shows where you are and where you are looking at
|
||||
• Share your location so that your friends can find you
|
||||
• Keeps your most important places in \'Favorites\'
|
||||
• Allows you to choose how to display names on the map: In English, local, or phonetic spelling
|
||||
• Displays specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency
|
||||
Map\n
|
||||
• Displays POIs (point of interests) around you\n
|
||||
• Adjusts the map to your direction of motion (or compass)\n
|
||||
• Shows where you are and where you are looking at\n
|
||||
• Share your location so that your friends can find you\n
|
||||
• 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\n
|
||||
• Displays specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency\n
|
||||
</string>
|
||||
<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.
|
||||
</string>
|
||||
<string name="osmand_extended_description_part5">
|
||||
Cycling
|
||||
• You can find cycling paths on the map
|
||||
• GPS navigation in cycling mode builds your route using cycling paths
|
||||
• You can see your speed and altitude
|
||||
• GPX recording option enables you to record your trip and share it
|
||||
Cycling\n
|
||||
• You can find cycling paths on the map\n
|
||||
• GPS navigation in cycling mode builds your route using cycling paths\n
|
||||
• You can see your speed and altitude\n
|
||||
• GPX recording option enables you to record your trip and share it\n
|
||||
• Via an additional plugin you can enable contour lines and hillshading
|
||||
</string>
|
||||
<string name="osmand_extended_description_part6">
|
||||
Walking, hiking, city tour
|
||||
• The map shows you walking and hiking paths
|
||||
• Wikipedia in your preferred language can tell you a lot during a city tour
|
||||
• Public transport stops (bus, tram, train), including line names, help to navigate in a new city
|
||||
• GPS navigation in pedestrian mode builds your route using walking paths
|
||||
• You can upload and follow a GPX route or record and share your own
|
||||
Walking, hiking, city tour\n
|
||||
• The map shows you walking and hiking paths\n
|
||||
• 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\n
|
||||
• 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\n
|
||||
</string>
|
||||
<string name="osmand_extended_description_part7">
|
||||
Contribute to OSM
|
||||
• Report data bugs
|
||||
• Upload GPX tracks to OSM directly from the app
|
||||
• Add POIs and directly upload them to OSM (or later if offline)
|
||||
Contribute to OSM\n
|
||||
• Report data bugs\n
|
||||
• Upload GPX tracks to OSM directly from the app\n
|
||||
• Add POIs and directly upload them to OSM (or later if offline)\n
|
||||
</string>
|
||||
<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.
|
||||
Approximate map coverage and quality:
|
||||
• Western Europe: ****
|
||||
• Eastern Europe: ***
|
||||
• Russia: ***
|
||||
• North America: ***
|
||||
• South America: **
|
||||
• Asia: **
|
||||
• Japan & Korea: ***
|
||||
• Middle East: **
|
||||
• Africa: **
|
||||
• Antarctica: *
|
||||
Most countries around the globe are available for download!
|
||||
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:\n
|
||||
• Western Europe: ****\n
|
||||
• Eastern Europe: ***\n
|
||||
• Russia: ***\n
|
||||
• North America: ***\n
|
||||
• South America: **\n
|
||||
• Asia: **\n
|
||||
• Japan & Korea: ***\n
|
||||
• Middle East: **\n
|
||||
• Africa: **\n
|
||||
• Antarctica: *\n
|
||||
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.
|
||||
</string>
|
||||
<string name="osmand_plus_play_title_30_chars">OsmAnd+ Maps & Navigation</string>
|
||||
<string name="osmand_plus_short_description_80_chars">Global Mobile Map Viewing & Navigation for Offline and Online OSM Maps</string>
|
||||
<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:
|
||||
- Complete offline functionality (store downloaded vector or tile maps in the device storage)
|
||||
- Compact offline vector maps for the whole world available
|
||||
- Unlimited downloading of country or region maps directly from the app
|
||||
- Offline Wikipedia feature (download Wikipedia POIs), great for sightseeing
|
||||
- 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
|
||||
- Offline search for addresses and places (POIs)
|
||||
- Offline routing for medium-range distances
|
||||
- Car, bicycle, and pedestrian modes with optional:
|
||||
- Automated day/night view switching
|
||||
- Speed-dependent map zooming
|
||||
- Map alignment according to compass or direction of motion
|
||||
- Lane guidance, speed limit display, recorded and TTS voices
|
||||
Some of the core features:\n
|
||||
- Complete offline functionality (store downloaded vector or tile maps in the device storage)\n
|
||||
- Compact offline vector maps for the whole world available\n
|
||||
- Unlimited downloading of country or region maps directly from the app\n
|
||||
- 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\n\n
|
||||
- Offline search for addresses and places (POIs)\n
|
||||
- Offline routing for medium-range distances\n
|
||||
- Car, bicycle, and pedestrian modes with optional:\n
|
||||
- Automated day/night view switching\n
|
||||
- Speed-dependent map zooming\n
|
||||
- Map alignment according to compass or direction of motion\n
|
||||
- Lane guidance, speed limit display, recorded and TTS voices\n
|
||||
</string>
|
||||
<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.
|
||||
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.
|
||||
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.\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:
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part2">
|
||||
Navigation
|
||||
• Works online (fast) or offline (no roaming charges when you are abroad)
|
||||
• Turn-by-turn voice guidance (recorded and synthesized voices)
|
||||
• Optional lane guidance, street name display, and estimated time of arrival
|
||||
• Supports intermediate points on your itinerary
|
||||
• Automatic re-routing whenever you deviate from the route
|
||||
• Search for places by address, by type (e.g: restaurant, hotel, gas station, museum), or by geographical coordinates
|
||||
Navigation\n
|
||||
• Works online (fast) or offline (no roaming charges when you are abroad)\n
|
||||
• Turn-by-turn voice guidance (recorded and synthesized voices)\n
|
||||
• Optional lane guidance, street name display, and estimated time of arrival\n
|
||||
• Supports intermediate points on your itinerary\n
|
||||
• 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\n
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part3">
|
||||
Map Viewing
|
||||
• Display your position and orientation
|
||||
• Optionally align the picture according to compass or your direction of motion
|
||||
• Save your most important places as Favorites
|
||||
• Display POIs (point of interests) around you
|
||||
• Display specialized online tiles, satellite view (from Bing), different overlays like touring/navigation GPX tracks and additional layers with customizable transparency
|
||||
• Optionally display place names in English, local, or phonetic spelling
|
||||
Map Viewing\n
|
||||
• Display your position and orientation\n
|
||||
• Optionally align the picture according to compass or your direction of motion\n
|
||||
• Save your most important places as favorites\n
|
||||
• 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\n
|
||||
• Optionally display place names in English, local, or phonetic spelling\n
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part4">
|
||||
Use OSM and Wikipedia Data
|
||||
• High-quality information from the best collaborative projects of the world
|
||||
• OSM data available per country or region
|
||||
• Wikipedia POIs, great for sightseeing
|
||||
• Unlimited free downloads, directly from the app
|
||||
• Compact offline vector maps updated at least once a month
|
||||
Use OSM and Wikipedia Data\n
|
||||
• High-quality information from the best collaborative projects of the world\n
|
||||
• OSM data available per country or region\n
|
||||
• Wikipedia POIs, great for sightseeing\n
|
||||
• Unlimited free downloads, directly from the app\n
|
||||
• 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)
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part5">
|
||||
Safety Features
|
||||
• Optional automated day/night view switching
|
||||
• Optional speed limit display, with reminder if you exceed it
|
||||
• Optional speed-dependent zooming
|
||||
• Share your location so that your friends can find you
|
||||
Safety Features\n
|
||||
• Optional automated day/night view switching\n
|
||||
• Optional speed limit display, with reminder if you exceed it\n
|
||||
• Optional speed-dependent zooming\n
|
||||
• Share your location so that your friends can find you\n
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part6">
|
||||
Bicycle and Pedestrian Features
|
||||
• Viewing foot, hiking, and bike paths, great for outdoor activities
|
||||
• Special routing and display modes for bike and pedestrian
|
||||
• Optional public transport stops (bus, tram, train) including line names
|
||||
• Optional trip recording to local GPX file or online service
|
||||
• Optional speed and altitude display
|
||||
Bicycle and Pedestrian Features\n
|
||||
• Viewing foot, hiking, and bike paths, great for outdoor activities\n
|
||||
• Special routing and display modes for bike and pedestrian\n
|
||||
• Optional public transport stops (bus, tram, train) including line names\n
|
||||
• Optional trip recording to local GPX file or online service\n
|
||||
• Optional speed and altitude display\n
|
||||
• Display of contour lines and hillshading (via additional plugin)
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part7">
|
||||
Directly Contribute to OSM
|
||||
• Report data bugs
|
||||
• Upload GPX tracks to OSM directly from the app
|
||||
• Add POIs and directly upload them to OSM (or later if offline)
|
||||
• Optional trip recording also in background mode (while device is in sleep mode)
|
||||
Directly Contribute to OSM\n
|
||||
• Report data bugs\n
|
||||
• Upload GPX tracks to OSM directly from the app\n
|
||||
• 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)\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.
|
||||
</string>
|
||||
<string name="osmand_plus_extended_description_part8">
|
||||
Approximate map coverage and quality:
|
||||
• Western Europe: ****
|
||||
• Eastern Europe: ***
|
||||
• Russia: ***
|
||||
• North America: ***
|
||||
• South America: **
|
||||
• Asia: **
|
||||
• Japan & Korea: ***
|
||||
• Middle East: **
|
||||
• Africa: **
|
||||
• Antarctica: *
|
||||
Most countries around the globe available as downloads!
|
||||
From Afghanistan to Zimbabwe, from Australia to the USA. Argentina, Brazil, Canada, France, Germany, Mexico, UK, Spain, …
|
||||
Approximate map coverage and quality:\n
|
||||
• Western Europe: ****\n
|
||||
• Eastern Europe: ***\n
|
||||
• Russia: ***\n
|
||||
• North America: ***\n
|
||||
• South America: **\n
|
||||
• Asia: **\n
|
||||
• Japan & Korea: ***\n
|
||||
• Middle East: **\n
|
||||
• Africa: **\n
|
||||
• Antarctica: *\n
|
||||
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, …\n
|
||||
</string>
|
||||
<string name="filterpoi_activity">Create POI filter</string>
|
||||
<string name="recalculate_route_to_your_location">Transport mode:</string>
|
||||
|
|
|
@ -83,11 +83,12 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
|
|||
case UNLOCK_ALL_FEATURES:
|
||||
case DONATION_TO_OSM:
|
||||
return false;
|
||||
case SEA_DEPTH_MAPS:
|
||||
return ctx.getSettings().DEPTH_CONTOURS_PURCHASED.get();
|
||||
case WIKIVOYAGE_OFFLINE:
|
||||
return ctx.getSettings().TRAVEL_ARTICLES_PURCHASED.get();
|
||||
case CONTOUR_LINES_HILLSHADE_MAPS:
|
||||
boolean srtmEnabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null;
|
||||
return srtmEnabled && ctx.getSettings().DEPTH_CONTOURS_PURCHASED.get();
|
||||
return OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -234,6 +235,15 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
|
|||
String featureName = feature.toHumanString(ctx);
|
||||
View featureRow = inflate(hasSelectedOsmLiveFeature(feature)
|
||||
? 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);
|
||||
titleView.setText(featureName);
|
||||
featureRowDiv = featureRow.findViewById(R.id.div);
|
||||
|
@ -325,6 +335,15 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
|
|||
String featureName = feature.toHumanString(ctx);
|
||||
featureRow = inflate(hasSelectedPlanTypeFeature(feature)
|
||||
? 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);
|
||||
titleView.setText(featureName);
|
||||
rowsContainer.addView(featureRow);
|
||||
|
|
|
@ -252,7 +252,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.srtmplugin;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
|
@ -11,8 +10,8 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.PluginActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
|
@ -135,9 +134,12 @@ public class ContourLinesMenu {
|
|||
}
|
||||
});
|
||||
} 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);
|
||||
} else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) {
|
||||
plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() {
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
|
@ -19,6 +20,8 @@ import net.osmand.plus.download.IndexItem;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.srtmplugin.ContourLinesMenu.closeDashboard;
|
||||
|
||||
public class 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;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,10 @@ import net.osmand.Collator;
|
|||
import net.osmand.CollatorStringMatcher;
|
||||
import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.OsmAndCollator;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
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.SQLiteCursor;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -205,7 +208,11 @@ public class TravelDbHelper {
|
|||
SQLiteConnection conn = openConnection();
|
||||
if (conn != null) {
|
||||
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()) {
|
||||
do {
|
||||
travelArticle = readArticle(cursor);
|
||||
|
|
|
@ -68,6 +68,10 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
holder.description.setText(String.valueOf(getArticleItemCount()));
|
||||
} else if (viewHolder instanceof ArticleTravelVH && item instanceof ArticleTravelCard) {
|
||||
((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) {
|
||||
((OpenBetaTravelCard) item).bindViewHolder(viewHolder);
|
||||
} else if (viewHolder instanceof StartEditingTravelVH && item instanceof StartEditingTravelCard) {
|
||||
|
@ -109,6 +113,16 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
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) {
|
||||
return items.get(position);
|
||||
}
|
||||
|
|
|
@ -9,15 +9,18 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexHelper;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
|
||||
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.OpenBetaTravelCard;
|
||||
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 ExploreRvAdapter adapter = new ExploreRvAdapter();
|
||||
|
||||
private AddDownloadUpdateCardTask addDownloadUpdateCardTask;
|
||||
private StartEditingTravelCard startEditingTravelCard;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
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());
|
||||
|
||||
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
|
||||
rv.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
rv.setAdapter(adapter);
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
cancelAddDownloadUpdateCardTask();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
private void cancelAddDownloadUpdateCardTask() {
|
||||
if (addDownloadUpdateCardTask != null) {
|
||||
addDownloadUpdateCardTask.cancel(true);
|
||||
addDownloadUpdateCardTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Object> generateItems() {
|
||||
final List<Object> items = new ArrayList<>();
|
||||
final OsmandApplication app = getMyApplication();
|
||||
final boolean nightMode = !getSettings().isLightContent();
|
||||
|
||||
addDownloadUpdateCard(nightMode);
|
||||
startEditingTravelCard = new StartEditingTravelCard(app, nightMode);
|
||||
items.add(new OpenBetaTravelCard(app, nightMode, getFragmentManager()));
|
||||
items.add(new StartEditingTravelCard(app, nightMode));
|
||||
addPopularDestinations(items, nightMode);
|
||||
items.add(startEditingTravelCard);
|
||||
addPopularDestinations(app, nightMode);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
private void addDownloadUpdateCard(boolean nightMode) {
|
||||
addDownloadUpdateCardTask = new AddDownloadUpdateCardTask(getMyApplication(), adapter, nightMode);
|
||||
addDownloadUpdateCardTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
private void addDownloadUpdateCard(final boolean nightMode) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
new CheckWorldWikivoyageTask(app, new CheckWorldWikivoyageTask.Callback() {
|
||||
@Override
|
||||
public void onCheckFinished(boolean worldWikivoyageDownloaded) {
|
||||
if (!worldWikivoyageDownloaded && adapter != null) {
|
||||
TravelDownloadUpdateCard card = new TravelDownloadUpdateCard(app, nightMode, true);
|
||||
if (adapter.addItem(DOWNLOAD_UPDATE_CARD_POSITION, card)) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void addPopularDestinations(@NonNull List<Object> items, boolean nightMode) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
List<TravelArticle> savedArticles = app.getTravelDbHelper().searchPopular();
|
||||
if (!savedArticles.isEmpty()) {
|
||||
items.add(getString(R.string.popular_destinations));
|
||||
for (TravelArticle article : savedArticles) {
|
||||
items.add(new ArticleTravelCard(app, nightMode, article, getFragmentManager()));
|
||||
}
|
||||
}
|
||||
private void addPopularDestinations(OsmandApplication app, boolean nightMode) {
|
||||
PopularDestinationsSearchTask popularDestinationsSearchTask = new PopularDestinationsSearchTask(app.getTravelDbHelper(), getMyActivity(), adapter, nightMode, startEditingTravelCard, progressBar);
|
||||
popularDestinationsSearchTask.execute();
|
||||
}
|
||||
|
||||
private static class AddDownloadUpdateCardTask extends AsyncTask<Void, Void, TravelDownloadUpdateCard> {
|
||||
private static class CheckWorldWikivoyageTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private OsmandApplication app;
|
||||
private WeakReference<ExploreRvAdapter> adapterWr;
|
||||
private Callback callback;
|
||||
|
||||
private boolean nightMode;
|
||||
|
||||
AddDownloadUpdateCardTask(OsmandApplication app, ExploreRvAdapter adapter, boolean nightMode) {
|
||||
CheckWorldWikivoyageTask(OsmandApplication app, Callback callback) {
|
||||
this.app = app;
|
||||
this.adapterWr = new WeakReference<>(adapter);
|
||||
this.nightMode = nightMode;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TravelDownloadUpdateCard doInBackground(Void... voids) {
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
final boolean[] worldWikivoyageDownloaded = new boolean[1];
|
||||
|
||||
new LocalIndexHelper(app).getLocalTravelFiles(new AbstractLoadLocalIndexTask() {
|
||||
@Override
|
||||
public void loadFile(LocalIndexInfo... loaded) {
|
||||
|
@ -118,25 +110,73 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!worldWikivoyageDownloaded[0] && !isCancelled()) {
|
||||
TravelDownloadUpdateCard card = new TravelDownloadUpdateCard(app, nightMode, true);
|
||||
return card;
|
||||
}
|
||||
|
||||
return null;
|
||||
return worldWikivoyageDownloaded[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(TravelDownloadUpdateCard card) {
|
||||
if (!isCancelled() && card != null) {
|
||||
ExploreRvAdapter adapter = adapterWr.get();
|
||||
if (adapter != null) {
|
||||
if (adapter.addItem(DOWNLOAD_UPDATE_CARD_POSITION, card)) {
|
||||
adapter.notifyItemInserted(DOWNLOAD_UPDATE_CARD_POSITION);
|
||||
protected void onPostExecute(Boolean worldWikivoyageDownloaded) {
|
||||
if (callback != null) {
|
||||
callback.onCheckFinished(worldWikivoyageDownloaded);
|
||||
}
|
||||
callback = null;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ public class ArticleTravelCard extends BaseTravelCard {
|
|||
private TravelArticle article;
|
||||
private final Drawable readIcon;
|
||||
private FragmentManager fragmentManager;
|
||||
private boolean isLastItem;
|
||||
|
||||
public ArticleTravelCard(OsmandApplication app, boolean nightMode, TravelArticle article, FragmentManager fragmentManager) {
|
||||
super(app, nightMode);
|
||||
|
@ -73,6 +74,8 @@ public class ArticleTravelCard extends BaseTravelCard {
|
|||
holder.itemView.setOnClickListener(readClickListener);
|
||||
holder.leftButton.setCompoundDrawablesWithIntrinsicBounds(readIcon, null, null, null);
|
||||
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
|
||||
public int getCardType() {
|
||||
return TYPE;
|
||||
|
|
Loading…
Reference in a new issue