From 609f4d45ae66129adfda49c7931d17837d810add Mon Sep 17 00:00:00 2001 From: Nazar Date: Thu, 19 Sep 2019 20:11:10 +0300 Subject: [PATCH] Add "Download Map" Top Sheet card --- .../java/net/osmand/map/OsmandRegions.java | 4 + OsmAnd/res/anim/slide_in_top.xml | 7 + OsmAnd/res/anim/slide_out_top.xml | 7 + OsmAnd/res/drawable/bg_top_menu_dark.xml | 13 ++ OsmAnd/res/drawable/bg_top_menu_light.xml | 13 ++ ..._top_sheet_bottom_sides_landscape_dark.xml | 13 ++ ...top_sheet_bottom_sides_landscape_light.xml | 13 ++ OsmAnd/res/layout/bottom_sheet_dialog.xml | 18 -- .../res/layout/card_download_detailed_map.xml | 72 ++++++ OsmAnd/res/values-large/sizes.xml | 2 + OsmAnd/res/values/sizes.xml | 2 + OsmAnd/res/values/strings.xml | 1 + OsmAnd/res/values/styles.xml | 5 + .../src/net/osmand/plus/AppInitializer.java | 1 + .../plus/activities/MapActivityLayers.java | 2 +- .../actions/OsmandRestoreOrExitDialog.java | 4 +- .../base/MenuBottomSheetDialogFragment.java | 2 +- ...nt.java => OsmAndSheetDialogFragment.java} | 39 +++- ...heetDialog.java => OsmandSheetDialog.java} | 72 +++++- .../net/osmand/plus/base/SheetDialogType.java | 19 ++ .../plus/dialogs/RateUsBottomSheetDialog.java | 4 +- .../plus/download/DownloadActivity.java | 6 +- .../ui/DataStoragePlaceDialogFragment.java | 4 +- .../ui/DownloadMapDialogFragment.java | 211 ++++++++++++++++++ .../download/ui/DownloadMapDialogManager.java | 35 +++ ...ionalActionsBottomSheetDialogFragment.java | 3 +- .../plus/mapillary/MapillaryPlugin.java | 4 +- .../OptionsBottomSheetDialogFragment.java | 4 +- .../SaveAsTrackBottomSheetDialogFragment.java | 4 +- .../OnSaveCurrentTrackFragment.java | 4 +- .../plus/views/DownloadedRegionsLayer.java | 75 +++++++ .../WikivoyageShowPicturesDialogFragment.java | 4 +- 32 files changed, 613 insertions(+), 54 deletions(-) create mode 100644 OsmAnd/res/anim/slide_in_top.xml create mode 100644 OsmAnd/res/anim/slide_out_top.xml create mode 100644 OsmAnd/res/drawable/bg_top_menu_dark.xml create mode 100644 OsmAnd/res/drawable/bg_top_menu_light.xml create mode 100644 OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_dark.xml create mode 100644 OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_light.xml delete mode 100644 OsmAnd/res/layout/bottom_sheet_dialog.xml create mode 100644 OsmAnd/res/layout/card_download_detailed_map.xml rename OsmAnd/src/net/osmand/plus/base/{BottomSheetDialogFragment.java => OsmAndSheetDialogFragment.java} (72%) rename OsmAnd/src/net/osmand/plus/base/{BottomSheetDialog.java => OsmandSheetDialog.java} (59%) create mode 100644 OsmAnd/src/net/osmand/plus/base/SheetDialogType.java create mode 100644 OsmAnd/src/net/osmand/plus/download/ui/DownloadMapDialogFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/download/ui/DownloadMapDialogManager.java diff --git a/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java b/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java index 13f3ed42f1..1e0238159c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/OsmandRegions.java @@ -707,6 +707,10 @@ public class OsmandRegions { public BinaryMapDataObject getSmallestBinaryMapDataObjectAt(LatLon latLon) throws IOException { List mapDataObjects = getBinaryMapDataObjectsAt(latLon); + return getSmallestBinaryMapDataObjectAt(mapDataObjects); + } + + public BinaryMapDataObject getSmallestBinaryMapDataObjectAt(List mapDataObjects) throws IOException { BinaryMapDataObject res = null; double smallestArea = -1; for (BinaryMapDataObject o : mapDataObjects) { diff --git a/OsmAnd/res/anim/slide_in_top.xml b/OsmAnd/res/anim/slide_in_top.xml new file mode 100644 index 0000000000..5bc36e7675 --- /dev/null +++ b/OsmAnd/res/anim/slide_in_top.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/res/anim/slide_out_top.xml b/OsmAnd/res/anim/slide_out_top.xml new file mode 100644 index 0000000000..f50ed1818f --- /dev/null +++ b/OsmAnd/res/anim/slide_out_top.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/bg_top_menu_dark.xml b/OsmAnd/res/drawable/bg_top_menu_dark.xml new file mode 100644 index 0000000000..47de9f6025 --- /dev/null +++ b/OsmAnd/res/drawable/bg_top_menu_dark.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/bg_top_menu_light.xml b/OsmAnd/res/drawable/bg_top_menu_light.xml new file mode 100644 index 0000000000..3a48a32f5e --- /dev/null +++ b/OsmAnd/res/drawable/bg_top_menu_light.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_dark.xml b/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_dark.xml new file mode 100644 index 0000000000..6d4b38d914 --- /dev/null +++ b/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_dark.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_light.xml b/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_light.xml new file mode 100644 index 0000000000..cc00abd48e --- /dev/null +++ b/OsmAnd/res/drawable/bg_top_sheet_bottom_sides_landscape_light.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/bottom_sheet_dialog.xml b/OsmAnd/res/layout/bottom_sheet_dialog.xml deleted file mode 100644 index 412a51f9ab..0000000000 --- a/OsmAnd/res/layout/bottom_sheet_dialog.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/OsmAnd/res/layout/card_download_detailed_map.xml b/OsmAnd/res/layout/card_download_detailed_map.xml new file mode 100644 index 0000000000..b20741d3d6 --- /dev/null +++ b/OsmAnd/res/layout/card_download_detailed_map.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml index d85f69044b..892b4c3048 100644 --- a/OsmAnd/res/values-large/sizes.xml +++ b/OsmAnd/res/values-large/sizes.xml @@ -13,6 +13,8 @@ 510dp 496dp + 42dp + 60dp 78dp 66dp diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 185b9c7878..05ae83b1f2 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -19,6 +19,8 @@ 24dp 12dp 3dp + + 28dp 36dp 6dp diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 52235fb3a1..603dd41e1e 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -13,6 +13,7 @@ --> Plugin settings Logcat buffer + Download detailed %s map, to view this area. Application profile changed to \"%s\" Switch profile Configure profile diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index 0c5caa220e..27c6246948 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -647,6 +647,11 @@ @anim/shrink_from_top + +