Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e511c2f126
1 changed files with 13 additions and 8 deletions
|
@ -34,8 +34,11 @@ import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static android.content.Intent.ACTION_VIEW;
|
||||||
|
|
||||||
public class MapillaryPlugin extends OsmandPlugin {
|
public class MapillaryPlugin extends OsmandPlugin {
|
||||||
public static final String ID = "osmand.mapillary";
|
public static final String ID = "osmand.mapillary";
|
||||||
private static final String MAPILLARY_PACKAGE_ID = "app.mapillary";
|
private static final String MAPILLARY_PACKAGE_ID = "app.mapillary";
|
||||||
|
@ -216,14 +219,16 @@ public class MapillaryPlugin extends OsmandPlugin {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
if (isPackageInstalled(MAPILLARY_PACKAGE_ID, app)) {
|
if (isPackageInstalled(MAPILLARY_PACKAGE_ID, app)) {
|
||||||
Intent launchIntent = app.getPackageManager().getLaunchIntentForPackage(MAPILLARY_PACKAGE_ID);
|
|
||||||
if (launchIntent != null) {
|
|
||||||
if (imageKey != null) {
|
if (imageKey != null) {
|
||||||
launchIntent.putExtra("photo_id", imageKey);
|
Intent intent = new Intent(ACTION_VIEW, Uri.parse(MessageFormat.format("mapillary://mapillary/photo/{0}?image_key={0}", imageKey)));
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
app.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mapillary://mapillary/capture"));
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
app.startActivity(intent);
|
||||||
}
|
}
|
||||||
app.startActivity(launchIntent);
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
new MapillaryInstallDialogFragment().show(activity.getSupportFragmentManager(), MapillaryInstallDialogFragment.TAG);
|
new MapillaryInstallDialogFragment().show(activity.getSupportFragmentManager(), MapillaryInstallDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +244,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(ACTION_VIEW, Uri.parse(url));
|
||||||
try {
|
try {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
app.startActivity(intent);
|
app.startActivity(intent);
|
||||||
|
|
Loading…
Reference in a new issue