Fix open play store with mapillary app
This commit is contained in:
parent
4fe4e42c92
commit
feacbdc395
6 changed files with 9 additions and 14 deletions
|
@ -54,6 +54,7 @@ android {
|
|||
aaptOptions {
|
||||
// Don't compress any embedded resources
|
||||
noCompress "qz"
|
||||
cruncherEnabled = false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class AbstractCard {
|
|||
|
||||
public abstract void update();
|
||||
|
||||
public OsmandApplication getOsmandApplication() {
|
||||
public OsmandApplication getMyApplication() {
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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<MapillaryImageCard>() {
|
||||
@Override
|
||||
public void onFinish(List<MapillaryImageCard> 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) {
|
||||
|
|
Loading…
Reference in a new issue