diff --git a/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl b/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl index 475093644e..3edd8c94da 100644 --- a/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl +++ b/OsmAnd-api/src/net/osmand/aidlapi/IOsmAndAidlInterface.aidl @@ -74,6 +74,7 @@ import net.osmand.aidlapi.customization.OsmandSettingsParams; import net.osmand.aidlapi.customization.OsmandSettingsInfoParams; import net.osmand.aidlapi.customization.CustomizationInfoParams; import net.osmand.aidlapi.customization.ProfileSettingsParams; +import net.osmand.aidlapi.customization.MapMarginsParams; import net.osmand.aidlapi.gpx.AGpxFile; import net.osmand.aidlapi.gpx.AGpxFileDetails; @@ -864,4 +865,6 @@ interface IOsmAndAidlInterface { long registerForKeyEvents(in AKeyEventsParams params, IOsmAndAidlCallback callback); AppInfoParams getAppInfo(); + + boolean setMapMargins(in MapMarginsParams params); } \ No newline at end of file diff --git a/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.aidl b/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.aidl new file mode 100644 index 0000000000..6cba21877e --- /dev/null +++ b/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidlapi.customization; + +parcelable MapMarginsParams; \ No newline at end of file diff --git a/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.java b/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.java new file mode 100644 index 0000000000..e5bdffe11c --- /dev/null +++ b/OsmAnd-api/src/net/osmand/aidlapi/customization/MapMarginsParams.java @@ -0,0 +1,75 @@ +package net.osmand.aidlapi.customization; + +import android.os.Bundle; +import android.os.Parcel; + +import net.osmand.aidlapi.AidlParams; + +public class MapMarginsParams extends AidlParams { + + private String appModeKey; + private int leftMargin; + private int topMargin; + private int rightMargin; + private int bottomMargin; + + public MapMarginsParams(String appModeKey, int leftMargin, int topMargin, int rightMargin, int bottomMargin) { + this.appModeKey = appModeKey; + this.leftMargin = leftMargin; + this.topMargin = topMargin; + this.rightMargin = rightMargin; + this.bottomMargin = bottomMargin; + } + + public MapMarginsParams(Parcel in) { + readFromParcel(in); + } + + public static final Creator CREATOR = new Creator() { + @Override + public MapMarginsParams createFromParcel(Parcel in) { + return new MapMarginsParams(in); + } + + @Override + public MapMarginsParams[] newArray(int size) { + return new MapMarginsParams[size]; + } + }; + + public String getAppModeKey() { + return appModeKey; + } + + public int getLeftMargin() { + return leftMargin; + } + + public int getTopMargin() { + return topMargin; + } + + public int getRightMargin() { + return rightMargin; + } + + public int getBottomMargin() { + return bottomMargin; + } + + @Override + public void writeToBundle(Bundle bundle) { + bundle.putInt("leftMargin", leftMargin); + bundle.putInt("topMargin", topMargin); + bundle.putInt("rightMargin", rightMargin); + bundle.putInt("bottomMargin", bottomMargin); + } + + @Override + protected void readFromBundle(Bundle bundle) { + leftMargin = bundle.getInt("leftMargin"); + topMargin = bundle.getInt("topMargin"); + rightMargin = bundle.getInt("rightMargin"); + bottomMargin = bundle.getInt("bottomMargin"); + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 3bdf3862a7..3c6fdb37c7 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -2273,6 +2273,10 @@ public class OsmandAidlApi { return true; } + public boolean setMapMargins(String appModeKey, int leftMargin, int topMargin, int bottomMargin, int rightMargin) { + return false; + } + private class FileCopyInfo { long startTime; long lastAccessTime; diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java index 01be4752b9..c8ac88c451 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java @@ -22,6 +22,7 @@ import net.osmand.aidlapi.contextmenu.ContextMenuButtonsParams; import net.osmand.aidlapi.contextmenu.RemoveContextMenuButtonsParams; import net.osmand.aidlapi.contextmenu.UpdateContextMenuButtonsParams; import net.osmand.aidlapi.copyfile.CopyFileParams; +import net.osmand.aidlapi.customization.MapMarginsParams; import net.osmand.aidlapi.info.AppInfoParams; import net.osmand.aidlapi.customization.CustomizationInfoParams; import net.osmand.aidlapi.customization.OsmandSettingsInfoParams; @@ -1307,6 +1308,18 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener return null; } } + + @Override + public boolean setMapMargins(MapMarginsParams params) { + try { + OsmandAidlApi api = getApi("setMapMargins"); + return api != null && api.setMapMargins(params.getAppModeKey(), params.getLeftMargin(), params.getTopMargin(), + params.getBottomMargin(), params.getRightMargin()); + } catch (Exception e) { + handleException(e); + return false; + } + } }; private void setCustomization(OsmandAidlApi api, CustomizationInfoParams params) {