From 54dc44bcd43b7adb14ae5faa0b3873859eef2951 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Mon, 8 May 2017 20:11:59 +0300 Subject: [PATCH] Added non webgl image dialog --- ..._view.xml => context_menu_card_dialog.xml} | 14 +- ..._view.xml => context_menu_card_dialog.xml} | 16 +- .../builders/cards/ImageCard.java | 9 + .../cards/dialogs/ContextMenuCardDialog.java | 119 +++++++++ .../ContextMenuCardDialogFragment.java} | 53 ++-- .../mapcontextmenu/other/WebImageMenu.java | 239 ----------------- .../plus/mapillary/MapillaryImageCard.java | 4 +- .../plus/mapillary/MapillaryImageDialog.java | 243 ++++++++++++++++++ .../plus/mapillary/MapillaryPlugin.java | 10 + 9 files changed, 423 insertions(+), 284 deletions(-) rename OsmAnd/res/layout-land/{map_image_view.xml => context_menu_card_dialog.xml} (90%) rename OsmAnd/res/layout/{map_image_view.xml => context_menu_card_dialog.xml} (89%) create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/dialogs/ContextMenuCardDialog.java rename OsmAnd/src/net/osmand/plus/mapcontextmenu/{other/WebImageMenuFragment.java => builders/cards/dialogs/ContextMenuCardDialogFragment.java} (55%) delete mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/other/WebImageMenu.java create mode 100644 OsmAnd/src/net/osmand/plus/mapillary/MapillaryImageDialog.java diff --git a/OsmAnd/res/layout-land/map_image_view.xml b/OsmAnd/res/layout-land/context_menu_card_dialog.xml similarity index 90% rename from OsmAnd/res/layout-land/map_image_view.xml rename to OsmAnd/res/layout-land/context_menu_card_dialog.xml index 57de22d2e6..3b83e5ad54 100644 --- a/OsmAnd/res/layout-land/map_image_view.xml +++ b/OsmAnd/res/layout-land/context_menu_card_dialog.xml @@ -13,7 +13,7 @@ android:orientation="vertical"> { + + private ProgressBar progressBar; + private ImageView imageView; + + public DownloadImageTask(ProgressBar progressBar, ImageView imageView) { + this.progressBar = progressBar; + this.imageView = imageView; + } + + @Override + protected void onPreExecute() { + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected Bitmap doInBackground(Void... params) { + return AndroidNetworkUtils.downloadImage(getMapActivity().getMyApplication(), imageUrl); + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + progressBar.setVisibility(View.GONE); + if (bitmap != null) { + imageView.setImageDrawable(new BitmapDrawable(getMapActivity().getResources(), bitmap)); + } + } + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java index 6cb030c2c4..2ce6ce85e1 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java @@ -45,6 +45,8 @@ public class MapillaryPlugin extends OsmandPlugin { private TextInfoWidget mapillaryControl; private MapWidgetRegInfo mapillaryWidgetRegInfo; + private static boolean webGlSupported = true; + public MapillaryPlugin(OsmandApplication app) { this.app = app; settings = app.getSettings(); @@ -81,6 +83,14 @@ public class MapillaryPlugin extends OsmandPlugin { registerWidget(activity); } + public static boolean isWebGlSupported() { + return webGlSupported; + } + + public static void setWebGlSupported(boolean webGlSupported) { + MapillaryPlugin.webGlSupported = webGlSupported; + } + private void createLayers() { rasterLayer = new MapillaryLayer(); }