From feacbdc3953311acc34e2a85ae31c6d94fb9b013 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 5 May 2017 14:20:55 +0300 Subject: [PATCH] Fix open play store with mapillary app --- OsmAnd/build.gradle | 1 + OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 12 +++--------- .../mapcontextmenu/builders/cards/AbstractCard.java | 2 +- .../mapcontextmenu/builders/cards/ImageCard.java | 2 +- .../osmand/plus/mapillary/AddMapillaryPhotoCard.java | 2 +- .../net/osmand/plus/mapillary/MapillaryPlugin.java | 4 ++-- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index 32ac68e7e3..0f6836cda7 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -54,6 +54,7 @@ android { aaptOptions { // Don't compress any embedded resources noCompress "qz" + cruncherEnabled = false } dexOptions { diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 5b8a69b000..e102de311f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -3,21 +3,15 @@ package net.osmand.plus; import android.annotation.TargetApi; import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build; import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; -import android.view.Gravity; -import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; -import net.osmand.AndroidUtils; import net.osmand.IProgress; import net.osmand.Location; import net.osmand.PlatformUtil; @@ -456,13 +450,13 @@ public abstract class OsmandPlugin { return collection; } - public static boolean isPackageInstalled(String packageInfo, OsmandApplication app) { + public static boolean isPackageInstalled(String packageInfo, Context ctx) { if (packageInfo == null) { return false; } boolean installed = false; try { - installed = app.getPackageManager().getPackageInfo(packageInfo, 0) != null; + installed = ctx.getPackageManager().getPackageInfo(packageInfo, 0) != null; } catch (NameNotFoundException e) { } return installed; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/AbstractCard.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/AbstractCard.java index 5a82080452..e0fe2ad113 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/AbstractCard.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/AbstractCard.java @@ -25,7 +25,7 @@ public abstract class AbstractCard { public abstract void update(); - public OsmandApplication getOsmandApplication() { + public OsmandApplication getMyApplication() { return app; } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java index 75fd3818d5..25d316d4f8 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/cards/ImageCard.java @@ -368,7 +368,7 @@ public abstract class ImageCard extends AbstractCard { @Override protected Bitmap doInBackground(Void... params) { - return AndroidNetworkUtils.downloadImage(getOsmandApplication(), imageUrl); + return AndroidNetworkUtils.downloadImage(getMyApplication(), imageUrl); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryPhotoCard.java b/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryPhotoCard.java index a14467e809..c946e9300b 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryPhotoCard.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/AddMapillaryPhotoCard.java @@ -23,7 +23,7 @@ class AddMapillaryPhotoCard extends AbstractCard { view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - MapillaryPlugin.openMapillary(getOsmandApplication()); + MapillaryPlugin.openMapillary(getMyApplication()); } }); } diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java index ca2e564e58..4dce5c8875 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java @@ -239,8 +239,7 @@ public class MapillaryPlugin extends OsmandPlugin { contextMenuCards = new ArrayList<>(); contextMenuCardsRow.setProgressCard(); ImageCard.execute(new GetImageCardsTask<>( - new MapillaryImageCard.MapillaryImageCardFactory(), - app, menuBuilder.getLatLon(), + new MapillaryImageCard.MapillaryImageCardFactory(), app, menuBuilder.getLatLon(), new GetImageCardsTask.Listener() { @Override public void onFinish(List cardList) { @@ -281,6 +280,7 @@ public class MapillaryPlugin extends OsmandPlugin { private static boolean execInstall(OsmandApplication app, String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); try { + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); app.startActivity(intent); return true; } catch (ActivityNotFoundException e) {