Replace AIDL-API#showLayerPointOnMap with AIDL-API#showMapPoint
This commit is contained in:
parent
f00a89e0e8
commit
9e5e8bef1f
7 changed files with 84 additions and 74 deletions
|
@ -51,7 +51,7 @@ import net.osmand.aidl.note.StopRecordingParams;
|
|||
|
||||
import net.osmand.aidl.gpx.RemoveGpxParams;
|
||||
|
||||
import net.osmand.aidl.maplayer.ShowLayerPointOnMapParams;
|
||||
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
|
||||
|
||||
// NOTE: Add new methods at the end of file!!!
|
||||
|
||||
|
@ -104,5 +104,5 @@ interface IOsmAndAidlInterface {
|
|||
|
||||
boolean removeGpx(in RemoveGpxParams params);
|
||||
|
||||
boolean showLayerPointOnMap(in ShowLayerPointOnMapParams params);
|
||||
boolean showMapPoint(in ShowMapPointParams params);
|
||||
}
|
|
@ -833,23 +833,28 @@ public class OsmandAidlApi {
|
|||
}
|
||||
}
|
||||
|
||||
boolean showLayerPointOnMap(String layerId, String pointId) {
|
||||
if (!TextUtils.isEmpty(layerId) && !TextUtils.isEmpty(pointId)) {
|
||||
AMapLayer layer = layers.get(layerId);
|
||||
if (layer != null) {
|
||||
AMapPoint point = layer.getPoint(pointId);
|
||||
if (point != null) {
|
||||
app.getSettings().setMapLocationToShow(
|
||||
point.getLocation().getLatitude(),
|
||||
point.getLocation().getLongitude(),
|
||||
DEFAULT_ZOOM,
|
||||
new PointDescription(PointDescription.POINT_TYPE_MARKER, point.getFullName()),
|
||||
false,
|
||||
point
|
||||
);
|
||||
MapActivity.launchMapActivityMoveToTop(app);
|
||||
boolean showMapPoint(String layerId, AMapPoint point) {
|
||||
if (point != null) {
|
||||
if (!TextUtils.isEmpty(layerId)) {
|
||||
AMapLayer layer = layers.get(layerId);
|
||||
if (layer != null) {
|
||||
AMapPoint p = layer.getPoint(point.getId());
|
||||
if (p != null) {
|
||||
point = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
app.getSettings().setMapLocationToShow(
|
||||
point.getLocation().getLatitude(),
|
||||
point.getLocation().getLongitude(),
|
||||
DEFAULT_ZOOM,
|
||||
new PointDescription(PointDescription.POINT_TYPE_MARKER, point.getFullName()),
|
||||
false,
|
||||
point
|
||||
);
|
||||
MapActivity.launchMapActivityMoveToTop(app);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ import net.osmand.aidl.gpx.StopGpxRecordingParams;
|
|||
import net.osmand.aidl.map.SetMapLocationParams;
|
||||
import net.osmand.aidl.maplayer.AddMapLayerParams;
|
||||
import net.osmand.aidl.maplayer.RemoveMapLayerParams;
|
||||
import net.osmand.aidl.maplayer.ShowLayerPointOnMapParams;
|
||||
import net.osmand.aidl.maplayer.UpdateMapLayerParams;
|
||||
import net.osmand.aidl.maplayer.point.AddMapPointParams;
|
||||
import net.osmand.aidl.maplayer.point.RemoveMapPointParams;
|
||||
import net.osmand.aidl.maplayer.point.ShowMapPointParams;
|
||||
import net.osmand.aidl.maplayer.point.UpdateMapPointParams;
|
||||
import net.osmand.aidl.mapmarker.AddMapMarkerParams;
|
||||
import net.osmand.aidl.mapmarker.RemoveMapMarkerParams;
|
||||
|
@ -203,9 +203,9 @@ public class OsmandAidlService extends Service {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showLayerPointOnMap(ShowLayerPointOnMapParams params) throws RemoteException {
|
||||
public boolean showMapPoint(ShowMapPointParams params) throws RemoteException {
|
||||
try {
|
||||
return params != null && getApi("showLayerPointOnMap").showLayerPointOnMap(params.getLayerId(), params.getPointId());
|
||||
return params != null && getApi("showMapPoint").showMapPoint(params.getLayerId(), params.getPoint());
|
||||
} catch (Exception e) {
|
||||
handleException(e);
|
||||
return false;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
package net.osmand.aidl.maplayer;
|
||||
|
||||
parcelable ShowLayerPointOnMapParams;
|
|
@ -1,51 +0,0 @@
|
|||
package net.osmand.aidl.maplayer;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class ShowLayerPointOnMapParams implements Parcelable {
|
||||
|
||||
private String layerId;
|
||||
private String pointId;
|
||||
|
||||
public ShowLayerPointOnMapParams(String layerId, String pointId) {
|
||||
this.layerId = layerId;
|
||||
this.pointId = pointId;
|
||||
}
|
||||
|
||||
public ShowLayerPointOnMapParams(Parcel in) {
|
||||
layerId = in.readString();
|
||||
pointId = in.readString();
|
||||
}
|
||||
|
||||
public String getLayerId() {
|
||||
return layerId;
|
||||
}
|
||||
|
||||
public String getPointId() {
|
||||
return pointId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(layerId);
|
||||
dest.writeString(pointId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<ShowLayerPointOnMapParams> CREATOR = new Creator<ShowLayerPointOnMapParams>() {
|
||||
@Override
|
||||
public ShowLayerPointOnMapParams createFromParcel(Parcel in) {
|
||||
return new ShowLayerPointOnMapParams(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShowLayerPointOnMapParams[] newArray(int size) {
|
||||
return new ShowLayerPointOnMapParams[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package net.osmand.aidl.maplayer.point;
|
||||
|
||||
parcelable ShowMapPointParams;
|
|
@ -0,0 +1,56 @@
|
|||
package net.osmand.aidl.maplayer.point;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class ShowMapPointParams implements Parcelable {
|
||||
|
||||
private String layerId;
|
||||
private AMapPoint point;
|
||||
|
||||
public ShowMapPointParams(String layerId, AMapPoint point) {
|
||||
this.layerId = layerId;
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public ShowMapPointParams(Parcel in) {
|
||||
readFromParcel(in);
|
||||
}
|
||||
|
||||
public static final Creator<ShowMapPointParams> CREATOR = new
|
||||
Creator<ShowMapPointParams>() {
|
||||
@Override
|
||||
public ShowMapPointParams createFromParcel(Parcel in) {
|
||||
return new ShowMapPointParams(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShowMapPointParams[] newArray(int size) {
|
||||
return new ShowMapPointParams[size];
|
||||
}
|
||||
};
|
||||
|
||||
public String getLayerId() {
|
||||
return layerId;
|
||||
}
|
||||
|
||||
public AMapPoint getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(layerId);
|
||||
out.writeParcelable(point, flags);
|
||||
}
|
||||
|
||||
private void readFromParcel(Parcel in) {
|
||||
layerId = in.readString();
|
||||
point = in.readParcelable(AMapPoint.class.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue