Fix crashes
This commit is contained in:
parent
40b857a6a1
commit
ff5b795694
2 changed files with 13 additions and 10 deletions
|
@ -13,7 +13,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager;
|
||||
|
@ -230,6 +229,7 @@ public class MapillaryPlugin extends OsmandPlugin {
|
|||
boolean success = false;
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
if (isPackageInstalled(MAPILLARY_PACKAGE_ID, app)) {
|
||||
try {
|
||||
if (imageKey != null) {
|
||||
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);
|
||||
|
@ -239,6 +239,9 @@ public class MapillaryPlugin extends OsmandPlugin {
|
|||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
app.startActivity(intent);
|
||||
}
|
||||
} catch (ActivityNotFoundException e) {
|
||||
new MapillaryInstallDialogFragment().show(activity.getSupportFragmentManager(), MapillaryInstallDialogFragment.TAG);
|
||||
}
|
||||
success = true;
|
||||
} else {
|
||||
new MapillaryInstallDialogFragment().show(activity.getSupportFragmentManager(), MapillaryInstallDialogFragment.TAG);
|
||||
|
|
|
@ -769,7 +769,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
if (dialog == null) {
|
||||
return;
|
||||
}
|
||||
if (useMapCenter) {
|
||||
if (useMapCenter && getMapActivity() != null) {
|
||||
LatLon mapCenter = getMapActivity().getMapView().getCurrentRotatedTileBox().getCenterLatLon();
|
||||
SearchSettings ss = searchUICore.getSearchSettings().setOriginalLocation(
|
||||
new LatLon(mapCenter.getLatitude(), mapCenter.getLongitude()));
|
||||
|
|
Loading…
Reference in a new issue