diff --git a/LICENSE b/LICENSE index f92e0c13e5..30c2895d1f 100644 --- a/LICENSE +++ b/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* @@ -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. - 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) - \ No newline at end of file + diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index 908a154565..b51ce15682 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -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]); } diff --git a/OsmAnd/res/drawable/img_feature_purchased.xml b/OsmAnd/res/drawable/img_feature_purchased.xml new file mode 100644 index 0000000000..e82f078224 --- /dev/null +++ b/OsmAnd/res/drawable/img_feature_purchased.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/fragment_explore_tab.xml b/OsmAnd/res/layout/fragment_explore_tab.xml index 0d82ee83b9..97565b853f 100644 --- a/OsmAnd/res/layout/fragment_explore_tab.xml +++ b/OsmAnd/res/layout/fragment_explore_tab.xml @@ -6,6 +6,13 @@ android:gravity="center" android:orientation="vertical"> + + + + + + Количество тросов Сложность + Тип ледника + + Ледниковый покров + Ледниковое поле + Плато + Долинный ледник + Горный + Висячий + Rock + Шельфовый + Останец + Ледяной язык + + Высшая точка + Низшая точка + Средний уклон + diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index 195697b21a..0f1466ffb6 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -1,6 +1,8 @@ + #78cc5c + #212121 #cccccc #212121 @@ -11,7 +13,6 @@ #b3b3b3 #4d4d4d - #bfbfbf #c5d2e6 #3db878 diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 4bf23631a5..58580b534f 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -105,6 +105,7 @@ CEE blue output Schuko output Car service + Glacier type Store @@ -3803,4 +3804,22 @@ Cable number Difficulty + Icecap + Icefield + Plateau + Valley + Outlet + Tidewater + Mountain + Hanging + Icefall + Rock + Shelf + Remnant + Ice tongue + + Highest point + Lowest point + Average slope + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 76705a0755..952a918b21 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1721,196 +1721,196 @@ OsmAnd Maps & Navigation Global Mobile Map Viewing & Navigation for Offline and Online OSM Maps - 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. - 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. - 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 - 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 - 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. - 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 - 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 - 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 - 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. OsmAnd+ Maps & Navigation Global Mobile Map Viewing & Navigation for Offline and Online OSM Maps - 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 - 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: - 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 - 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 - 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) - 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 - 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) - 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. - 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 Create POI filter Transport mode: diff --git a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java index baa2a32d15..a55cfd1502 100644 --- a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java index d30665dfc7..1a74139640 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java @@ -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; } diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java index f7e5099b9f..bcf8804b92 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java @@ -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() { diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java index 2a1979fefc..821def2866 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeMenu.java @@ -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; } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index f4b0a02fae..1b4ef91f95 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index 02a50602cb..5bed8a0d98 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -68,6 +68,10 @@ public class ExploreRvAdapter extends RecyclerView.Adapter 0; i--) { + Object o = items.get(i); + if (o instanceof ArticleTravelCard) { + return i; + } + } + return 0; + } + private Object getItem(int position) { return items.get(position); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 4a24ed3eed..a62172d333 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -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 generateItems() { final List 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 addPopularDestinations(@NonNull List items, boolean nightMode) { - OsmandApplication app = getMyApplication(); - List 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 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 static class AddDownloadUpdateCardTask extends AsyncTask { + 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 { private OsmandApplication app; - private WeakReference 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> { + + private TravelDbHelper travelDbHelper; + private WeakReference weakContext; + private WeakReference weakAdapter; + private WeakReference weakStartEditingTravelCard; + private WeakReference 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 doInBackground(Void... voids) { + return travelDbHelper.searchPopular(); + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + weakProgressBar.get().setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(List items) { + OsmandActionBarActivity activity = weakContext.get(); + ExploreRvAdapter adapter = weakAdapter.get(); + + List 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(); } } -} +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/ArticleTravelCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/ArticleTravelCard.java index eb80af9b00..5c4649c0a5 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/ArticleTravelCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/ArticleTravelCard.java @@ -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;