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 {
|
aaptOptions {
|
||||||
// Don't compress any embedded resources
|
// Don't compress any embedded resources
|
||||||
noCompress "qz"
|
noCompress "qz"
|
||||||
|
cruncherEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
dexOptions {
|
dexOptions {
|
||||||
|
|
|
@ -3,21 +3,15 @@ package net.osmand.plus;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
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.IProgress;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -456,13 +450,13 @@ public abstract class OsmandPlugin {
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPackageInstalled(String packageInfo, OsmandApplication app) {
|
public static boolean isPackageInstalled(String packageInfo, Context ctx) {
|
||||||
if (packageInfo == null) {
|
if (packageInfo == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean installed = false;
|
boolean installed = false;
|
||||||
try {
|
try {
|
||||||
installed = app.getPackageManager().getPackageInfo(packageInfo, 0) != null;
|
installed = ctx.getPackageManager().getPackageInfo(packageInfo, 0) != null;
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
}
|
}
|
||||||
return installed;
|
return installed;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public abstract class AbstractCard {
|
||||||
|
|
||||||
public abstract void update();
|
public abstract void update();
|
||||||
|
|
||||||
public OsmandApplication getOsmandApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ public abstract class ImageCard extends AbstractCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Bitmap doInBackground(Void... params) {
|
protected Bitmap doInBackground(Void... params) {
|
||||||
return AndroidNetworkUtils.downloadImage(getOsmandApplication(), imageUrl);
|
return AndroidNetworkUtils.downloadImage(getMyApplication(), imageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,7 @@ class AddMapillaryPhotoCard extends AbstractCard {
|
||||||
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapillaryPlugin.openMapillary(getOsmandApplication());
|
MapillaryPlugin.openMapillary(getMyApplication());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,7 @@ public class MapillaryPlugin extends OsmandPlugin {
|
||||||
contextMenuCards = new ArrayList<>();
|
contextMenuCards = new ArrayList<>();
|
||||||
contextMenuCardsRow.setProgressCard();
|
contextMenuCardsRow.setProgressCard();
|
||||||
ImageCard.execute(new GetImageCardsTask<>(
|
ImageCard.execute(new GetImageCardsTask<>(
|
||||||
new MapillaryImageCard.MapillaryImageCardFactory(),
|
new MapillaryImageCard.MapillaryImageCardFactory(), app, menuBuilder.getLatLon(),
|
||||||
app, menuBuilder.getLatLon(),
|
|
||||||
new GetImageCardsTask.Listener<MapillaryImageCard>() {
|
new GetImageCardsTask.Listener<MapillaryImageCard>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(List<MapillaryImageCard> cardList) {
|
public void onFinish(List<MapillaryImageCard> cardList) {
|
||||||
|
@ -281,6 +280,7 @@ public class MapillaryPlugin extends OsmandPlugin {
|
||||||
private static boolean execInstall(OsmandApplication app, String url) {
|
private static boolean execInstall(OsmandApplication app, String url) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
try {
|
try {
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
app.startActivity(intent);
|
app.startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
Loading…
Reference in a new issue