Merge branch 'r3.4'

This commit is contained in:
Chumva 2019-08-02 17:14:44 +03:00
commit 58f1ca1888
25 changed files with 766 additions and 34 deletions

View file

@ -3,6 +3,7 @@ package net.osmand.aidl;
import net.osmand.aidl.search.SearchResult; import net.osmand.aidl.search.SearchResult;
import net.osmand.aidl.gpx.AGpxBitmap; import net.osmand.aidl.gpx.AGpxBitmap;
import net.osmand.aidl.navigation.ADirectionInfo; import net.osmand.aidl.navigation.ADirectionInfo;
import net.osmand.aidl.navigation.OnVoiceNavigationParams;
interface IOsmAndAidlCallback { interface IOsmAndAidlCallback {
@ -37,5 +38,17 @@ interface IOsmAndAidlCallback {
*/ */
void updateNavigationInfo(in ADirectionInfo directionInfo); void updateNavigationInfo(in ADirectionInfo directionInfo);
/**
* Callback for {@link IOsmAndAidlInterface} buttons set with addContextMenuButtons() method.
*
* @param buttonId - id of custom button
* @param pointId - id of point button associated with
* @param layerId - id of layer point and button associated with
*/
void onContextMenuButtonClicked(in int buttonId, String pointId, String layerId); void onContextMenuButtonClicked(in int buttonId, String pointId, String layerId);
/**
* Callback for {@link IOsmAndAidlInterface} registerForVoiceRouterMessages() method.
*/
void onVoiceRouterNotify(in OnVoiceNavigationParams params);
} }

View file

@ -71,10 +71,13 @@ import net.osmand.aidl.navigation.NavigateSearchParams;
import net.osmand.aidl.customization.SetWidgetsParams; import net.osmand.aidl.customization.SetWidgetsParams;
import net.osmand.aidl.customization.OsmandSettingsParams; import net.osmand.aidl.customization.OsmandSettingsParams;
import net.osmand.aidl.customization.OsmandSettingsInfoParams;
import net.osmand.aidl.customization.CustomizationInfoParams;
import net.osmand.aidl.gpx.AGpxFile; import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.AGpxFileDetails; import net.osmand.aidl.gpx.AGpxFileDetails;
import net.osmand.aidl.gpx.CreateGpxBitmapParams; import net.osmand.aidl.gpx.CreateGpxBitmapParams;
import net.osmand.aidl.gpx.GpxColorParams;
import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.tiles.ASqliteDbFile;
@ -82,11 +85,13 @@ import net.osmand.aidl.plugins.PluginParams;
import net.osmand.aidl.copyfile.CopyFileParams; import net.osmand.aidl.copyfile.CopyFileParams;
import net.osmand.aidl.navigation.ANavigationUpdateParams; import net.osmand.aidl.navigation.ANavigationUpdateParams;
import net.osmand.aidl.navigation.ANavigationVoiceRouterMessageParams;
import net.osmand.aidl.contextmenu.ContextMenuButtonsParams; import net.osmand.aidl.contextmenu.ContextMenuButtonsParams;
import net.osmand.aidl.contextmenu.UpdateContextMenuButtonsParams; import net.osmand.aidl.contextmenu.UpdateContextMenuButtonsParams;
import net.osmand.aidl.contextmenu.RemoveContextMenuButtonsParams; import net.osmand.aidl.contextmenu.RemoveContextMenuButtonsParams;
import net.osmand.aidl.mapmarker.RemoveMapMarkersParams;
// NOTE: Add new methods at the end of file!!! // NOTE: Add new methods at the end of file!!!
@ -102,16 +107,23 @@ interface IOsmAndAidlInterface {
boolean addMapMarker(in AddMapMarkerParams params); boolean addMapMarker(in AddMapMarkerParams params);
/** /**
* Add map marker at given location. * Remove map marker.
*
* If ignoreCoordinates is false the marker is only removed if lat/lon match the currently set values of the marker.
* If ignoreCoordinates is true the marker is removed if the name matches, the values of lat/lon are ignored.
* *
* @param lat (double) - latitude. * @param lat (double) - latitude.
* @param lon (double) - longitude. * @param lon (double) - longitude.
* @param name (String)- name of marker. * @param name (String)- name of marker.
* @param ignoreCoordinates (boolean) - flag to determine whether lat/lon shall be ignored
*/ */
boolean removeMapMarker(in RemoveMapMarkerParams params); boolean removeMapMarker(in RemoveMapMarkerParams params);
/** /**
* Update map marker at given location with name. * Update map marker.
*
* If ignoreCoordinates is false the marker gets updated only if latPrev/lonPrev match the currently set values of the marker.
* If ignoreCoordinates is true the marker gets updated if the name matches, the values of latPrev/lonPrev are ignored.
* *
* @param latPrev (double) - latitude (current marker). * @param latPrev (double) - latitude (current marker).
* @param lonPrev (double) - longitude (current marker). * @param lonPrev (double) - longitude (current marker).
@ -119,6 +131,7 @@ interface IOsmAndAidlInterface {
* @param latNew (double) - latitude (new marker). * @param latNew (double) - latitude (new marker).
* @param lonNew (double) - longitude (new marker). * @param lonNew (double) - longitude (new marker).
* @param nameNew (String) - name (new marker). * @param nameNew (String) - name (new marker).
* @param ignoreCoordinates (boolean) - flag to determine whether latPrev/lonPrev shall be ignored
*/ */
boolean updateMapMarker(in UpdateMapMarkerParams params); boolean updateMapMarker(in UpdateMapMarkerParams params);
@ -190,6 +203,7 @@ interface IOsmAndAidlInterface {
* *
* @param layerId (String) - layer id. * @param layerId (String) - layer id.
* @param pointId (String) - point id. * @param pointId (String) - point id.
* @param updateOpenedMenuAndMap (boolean) - flag to enable folowing mode and menu updates for point
* @param shortName (String) - short name (single char). Displayed on the map. * @param shortName (String) - short name (single char). Displayed on the map.
* @param fullName (String) - full name. Displayed in the context menu on first row. * @param fullName (String) - full name. Displayed in the context menu on first row.
* @param typeName (String) - type name. Displayed in context menu on second row. * @param typeName (String) - type name. Displayed in context menu on second row.
@ -686,17 +700,150 @@ interface IOsmAndAidlInterface {
*/ */
int copyFile(in CopyFileParams filePart); int copyFile(in CopyFileParams filePart);
/** /**
* Method to register for updates during navgation. Notifies user about distance to the next turn and its type. * Method to register for updates during navgation. Notifies user about distance to the next turn and its type.
* *
* @params subscribeToUpdates (boolean) - boolean flag to subscribe or unsubscribe from updates * @param subscribeToUpdates (boolean) - subscribe or unsubscribe from updates
* @params callbackId (long) - id of callback, needed to unsubscribe from updates * @param callbackId (long) - id of callback, needed to unsubscribe from updates
* @params callback (IOsmAndAidlCallback) - callback to notify user on navigation data change * @param callback (IOsmAndAidlCallback) - callback to notify user on navigation data change
*/ */
long registerForNavigationUpdates(in ANavigationUpdateParams params, IOsmAndAidlCallback callback); long registerForNavigationUpdates(in ANavigationUpdateParams params, IOsmAndAidlCallback callback);
/**
* Method to add Context Menu buttons to OsmAnd Context menu.
*
* {@link ContextMenuButtonsParams } is a wrapper class for params:
*
* @param leftButton (AContextMenuButton) - parameters for left context button:
* @param buttonId (String at AContextMenuButton) - id of button in View
* @param leftTextCaption (String at AContextMenuButton) - left-side button text
* @param rightTextCaption (String at AContextMenuButton) - right-side button text
* @param String leftIconName (String at AContextMenuButton) - name of left-side icon
* @param String rightIconName (String at AContextMenuButton) - name of right-side icon
* @param boolean needColorizeIcon (booleanat AContextMenuButton) - flag to apply color to icon
* @param boolean enabled (boolean at AContextMenuButton) - enable button flag
*
* @param rightButton (AContextMenuButton) - parameters for right context button, see <i>leftButton</i> param for details.
* @param id (String) - button id;
* @param appPackage (String) - clinet's app package name
* @param layerId (String) - id of Osmand's map layer
* @param callbackId (long) - {@link IOsmAndAidlCallback} id
* @param pointsIds (List<String>) - list of point Ids to which this rules applies to.
*
* @param callback (IOsmAndAidlCallback) - AIDL callback;
*
* @return long - callback's Id;
*/
long addContextMenuButtons(in ContextMenuButtonsParams params, IOsmAndAidlCallback callback); long addContextMenuButtons(in ContextMenuButtonsParams params, IOsmAndAidlCallback callback);
/**
* Method to remove Context Menu buttons from OsmAnd Context menu.
*
* {@link RemoveContextMenuButtonsParams} is a wrapper class for params:
*
* @param paramsId (String) - id of {@link ContextMenuButtonsParams} of button you want to remove;
* @param callbackId (long) - id of {@ling IOsmAndAidlCallback} of button you want to remove;
*
*/
boolean removeContextMenuButtons(in RemoveContextMenuButtonsParams params); boolean removeContextMenuButtons(in RemoveContextMenuButtonsParams params);
/**
* Method to update params on already set custom Context Button.
*
* {@link UpdateContextMenuButtonsParams } is a wrapper class for params:
*
* @param leftButton (AContextMenuButton) - parameters for left context button:
* @param buttonId (String at AContextMenuButton) - id of button in View
* @param leftTextCaption (String at AContextMenuButton) - left-side button text
* @param rightTextCaption (String at AContextMenuButton) - right-side button text
* @param String leftIconName (String at AContextMenuButton) - name of left-side icon
* @param String rightIconName (String at AContextMenuButton) - name of right-side icon
* @param boolean needColorizeIcon (booleanat AContextMenuButton) - flag to apply color to icon
* @param boolean enabled (boolean at AContextMenuButton) - enable button flag
*
* @param rightButton (AContextMenuButton) - parameters for right context button, see <i>leftButton</i> param for details.
* @param id (String) - button id;
* @param appPackage (String) - clinet's app package name
* @param layerId (String) - id of Osmand's map layer
* @param callbackId (long) - {@link IOsmAndAidlCallback} id
* @param pointsIds (List<String>) - list of point Ids to which this rules applies to.
*
*/
boolean updateContextMenuButtons(in UpdateContextMenuButtonsParams params); boolean updateContextMenuButtons(in UpdateContextMenuButtonsParams params);
}
/**
* Method to check if there is a customized setting in OsmAnd Settings.
*
* {@link OsmandSettingsInfoParams} is a wrapper class for params:
*
* @param sharedPreferencesName (String at OsmandSettingInfoParams) - key of setting in OsmAnd's preferences.
*
* @return boolean - true if setting is already set in SharedPreferences
*
*/
boolean areOsmandSettingsCustomized(in OsmandSettingsInfoParams params);
/**
* Method to customize parameters of OsmAnd.
*
* @param params (CustomizationInfoParams) - wrapper class for custom settings and ui.
*
* @param settingsParams (OsmandSettingsParams) - wrapper class for OsmAnd shared preferences params.
* See {@link #customizeOsmandSettings(in OsmandSettingsParams params) customizeOsmandSettings}
* method description for details.
* @param navDrawerHeaderParams (NavDrawerHeaderParams) - wrapper class for OsmAnd navdrawer header params.
* See {@link #setNavDrawerLogoWithParams(in NavDrawerHeaderParams params) setNavDrawerLogoWithParams}
* method description for details.
* @param navDrawerFooterParams (NavDrawerFooterParams) - wrapper class for OsmAnd navdrawer footer params.
* See {@link #setNavDrawerFooterWithParams(in NavDrawerFooterParams params) setNavDrawerFooterWithParams}
* method description for details.
* @param visibilityWidgetsParams (ArrayList<SetWidgetsParams>) - wrapper class for OsmAnd widgets visibility.
* See {@link #regWidgetVisibility(in SetWidgetsParams params) regWidgetVisibility}
* method description for details.
* @param availabilityWidgetsParams (ArrayList<SetWidgetsParams>) - wrapper class for OsmAnd widgets availability.
* See {@link #regWidgetAvailability(in SetWidgetsParams params) regWidgetAvailability}
* method description for details.
* @param pluginsParams (ArrayList<PluginParams>) - wrapper class for OsmAnd plugins states params.
* See {@link #changePluginState(in PluginParams params) changePluginState}
* method description for details.
* @param featuresEnabledIds (List<String>) - list of UI elements (like QuickSearch button) to show.
* See {@link #setEnabledIds(in List<String> ids) setEnabledIds}
* @param featuresDisabledIds (List<String>) - list of UI elements (like QuickSearch button) to hide.
* See {@link #setDisabledIds(in List<String> ids) setDisabledIds}
* @param featuresEnabledPatterns (List<String>) - list of NavDrawer menu items to show.
* See {@link #setEnabledPatterns(in List<String> patterns) setEnabledPatterns}
* @param featuresDisabledPatterns (List<String>) - list of NavDrawer menu items to hide.
* See {@link #setDisabledPatterns(in List<String> patterns) setDisabledPatterns}
*
*/
boolean setCustomization(in CustomizationInfoParams params);
/**
* Method to register for Voice Router voice messages during navigation. Notifies user about voice messages.
*
* @params subscribeToUpdates (boolean) - boolean flag to subscribe or unsubscribe from messages
* @params callbackId (long) - id of callback, needed to unsubscribe from messages
* @params callback (IOsmAndAidlCallback) - callback to notify user on voice message
*/
long registerForVoiceRouterMessages(in ANavigationVoiceRouterMessageParams params, IOsmAndAidlCallback callback);
/**
* Removes all active map markers (marks them as passed and moves to history)
* Empty class of params
*/
boolean removeAllActiveMapMarkers(in RemoveMapMarkersParams params);
/**
* Method to get color name for gpx.
*
* @param fileName (String) - name of gpx file.
*
* @param gpxColor (String) - color name of gpx. Can be one of: "red", "orange", "lightblue",
* "blue", "purple", "translucent_red", "translucent_orange",
* "translucent_lightblue", "translucent_blue", "translucent_purple"
* Which used in {@link #importGpx(in ImportGpxParams params) importGpx}
* Or color hex if gpx has custom color.
*
*/
boolean getGpxColor(inout GpxColorParams params);
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.customization;
parcelable CustomizationInfoParams;

View file

@ -0,0 +1,172 @@
package net.osmand.aidl.customization;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.plugins.PluginParams;
import java.util.ArrayList;
import java.util.List;
public class CustomizationInfoParams implements Parcelable {
private OsmandSettingsParams settingsParams;
private NavDrawerHeaderParams navDrawerHeaderParams;
private NavDrawerFooterParams navDrawerFooterParams;
private SetNavDrawerItemsParams navDrawerItemsParams;
private ArrayList<SetWidgetsParams> visibilityWidgetsParams = new ArrayList<>();
private ArrayList<SetWidgetsParams> availabilityWidgetsParams = new ArrayList<>();
private ArrayList<PluginParams> pluginsParams = new ArrayList<>();
private List<String> featuresEnabledIds = new ArrayList<>();
private List<String> featuresDisabledIds = new ArrayList<>();
private List<String> featuresEnabledPatterns = new ArrayList<>();
private List<String> featuresDisabledPatterns = new ArrayList<>();
public CustomizationInfoParams(OsmandSettingsParams settingsParams,
NavDrawerHeaderParams navDrawerHeaderParams,
NavDrawerFooterParams navDrawerFooterParams,
SetNavDrawerItemsParams navDrawerItemsParams,
ArrayList<SetWidgetsParams> visibilityWidgetsParams,
ArrayList<SetWidgetsParams> availabilityWidgetsParams,
ArrayList<PluginParams> pluginsParams,
List<String> featuresEnabledIds,
List<String> featuresDisabledIds,
List<String> featuresEnabledPatterns,
List<String> featuresDisabledPatterns) {
this.settingsParams = settingsParams;
this.navDrawerHeaderParams = navDrawerHeaderParams;
this.navDrawerFooterParams = navDrawerFooterParams;
this.navDrawerItemsParams = navDrawerItemsParams;
if (visibilityWidgetsParams != null) {
this.visibilityWidgetsParams.addAll(visibilityWidgetsParams);
}
if (availabilityWidgetsParams != null) {
this.availabilityWidgetsParams.addAll(availabilityWidgetsParams);
}
if (pluginsParams != null) {
this.pluginsParams.addAll(pluginsParams);
}
if (featuresEnabledIds != null) {
this.featuresEnabledIds.addAll(featuresEnabledIds);
}
if (featuresDisabledIds != null) {
this.featuresDisabledIds.addAll(featuresDisabledIds);
}
if (featuresEnabledPatterns != null) {
this.featuresEnabledPatterns.addAll(featuresEnabledPatterns);
}
if (featuresDisabledPatterns != null) {
this.featuresDisabledPatterns.addAll(featuresDisabledPatterns);
}
}
public CustomizationInfoParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<CustomizationInfoParams> CREATOR = new Creator<CustomizationInfoParams>() {
@Override
public CustomizationInfoParams createFromParcel(Parcel in) {
return new CustomizationInfoParams(in);
}
@Override
public CustomizationInfoParams[] newArray(int size) {
return new CustomizationInfoParams[size];
}
};
public OsmandSettingsParams getSettingsParams() {
return settingsParams;
}
public NavDrawerHeaderParams getNavDrawerHeaderParams() {
return navDrawerHeaderParams;
}
public NavDrawerFooterParams getNavDrawerFooterParams() {
return navDrawerFooterParams;
}
public SetNavDrawerItemsParams getNavDrawerItemsParams() {
return navDrawerItemsParams;
}
public ArrayList<SetWidgetsParams> getVisibilityWidgetsParams() {
return visibilityWidgetsParams;
}
public ArrayList<SetWidgetsParams> getAvailabilityWidgetsParams() {
return availabilityWidgetsParams;
}
public ArrayList<PluginParams> getPluginsParams() {
return pluginsParams;
}
public List<String> getFeaturesEnabledIds() {
return featuresEnabledIds;
}
public List<String> getFeaturesDisabledIds() {
return featuresDisabledIds;
}
public List<String> getFeaturesEnabledPatterns() {
return featuresEnabledPatterns;
}
public List<String> getFeaturesDisabledPatterns() {
return featuresDisabledPatterns;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(settingsParams, flags);
out.writeParcelable(navDrawerHeaderParams, flags);
out.writeParcelable(navDrawerFooterParams, flags);
out.writeParcelable(navDrawerItemsParams, flags);
out.writeTypedList(visibilityWidgetsParams);
out.writeTypedList(availabilityWidgetsParams);
out.writeTypedList(pluginsParams);
out.writeStringList(featuresEnabledIds);
out.writeStringList(featuresDisabledIds);
out.writeStringList(featuresEnabledPatterns);
out.writeStringList(featuresDisabledPatterns);
}
@SuppressLint("ParcelClassLoader")
private void readFromParcel(Parcel in) {
settingsParams = in.readParcelable(OsmandSettingsParams.class.getClassLoader());
navDrawerHeaderParams = in.readParcelable(NavDrawerHeaderParams.class.getClassLoader());
navDrawerFooterParams = in.readParcelable(NavDrawerFooterParams.class.getClassLoader());
navDrawerItemsParams = in.readParcelable(SetNavDrawerItemsParams.class.getClassLoader());
in.readTypedList(visibilityWidgetsParams, SetWidgetsParams.CREATOR);
in.readTypedList(availabilityWidgetsParams, SetWidgetsParams.CREATOR);
in.readTypedList(pluginsParams, PluginParams.CREATOR);
in.readStringList(featuresEnabledIds);
in.readStringList(featuresDisabledIds);
in.readStringList(featuresEnabledPatterns);
in.readStringList(featuresDisabledPatterns);
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.customization;
parcelable OsmandSettingsInfoParams;

View file

@ -0,0 +1,50 @@
package net.osmand.aidl.customization;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
public class OsmandSettingsInfoParams implements Parcelable {
private String sharedPreferencesName;
public OsmandSettingsInfoParams(@NonNull String sharedPreferencesName) {
this.sharedPreferencesName = sharedPreferencesName;
}
public OsmandSettingsInfoParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<OsmandSettingsInfoParams> CREATOR = new Creator<OsmandSettingsInfoParams>() {
@Override
public OsmandSettingsInfoParams createFromParcel(Parcel in) {
return new OsmandSettingsInfoParams(in);
}
@Override
public OsmandSettingsInfoParams[] newArray(int size) {
return new OsmandSettingsInfoParams[size];
}
};
public String getSharedPreferencesName() {
return sharedPreferencesName;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(sharedPreferencesName);
}
@SuppressLint("ParcelClassLoader")
private void readFromParcel(Parcel in) {
sharedPreferencesName = in.readString();
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -11,15 +11,13 @@ public class AGpxFile implements Parcelable {
private long modifiedTime; private long modifiedTime;
private long fileSize; private long fileSize;
private boolean active; private boolean active;
private String color;
private AGpxFileDetails details; private AGpxFileDetails details;
public AGpxFile(@NonNull String fileName, long modifiedTime, long fileSize, boolean active, String color, @Nullable AGpxFileDetails details) { public AGpxFile(@NonNull String fileName, long modifiedTime, long fileSize, boolean active, @Nullable AGpxFileDetails details) {
this.fileName = fileName; this.fileName = fileName;
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
this.fileSize = fileSize; this.fileSize = fileSize;
this.active = active; this.active = active;
this.color = color;
this.details = details; this.details = details;
} }
@ -54,10 +52,6 @@ public class AGpxFile implements Parcelable {
return active; return active;
} }
public String getColor() {
return color;
}
public AGpxFileDetails getDetails() { public AGpxFileDetails getDetails() {
return details; return details;
} }
@ -72,7 +66,6 @@ public class AGpxFile implements Parcelable {
if (details != null) { if (details != null) {
out.writeParcelable(details, flags); out.writeParcelable(details, flags);
} }
out.writeString(color);
} }
private void readFromParcel(Parcel in) { private void readFromParcel(Parcel in) {
@ -87,7 +80,6 @@ public class AGpxFile implements Parcelable {
} else { } else {
details = null; details = null;
} }
color = in.readString();
} }
public int describeContents() { public int describeContents() {

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable GpxColorParams;

View file

@ -0,0 +1,66 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
public class GpxColorParams implements Parcelable {
private String fileName;
private String gpxColor;
public GpxColorParams() {
}
public GpxColorParams(@NonNull String fileName) {
this.fileName = fileName;
}
public GpxColorParams(@NonNull String fileName, String gpxColor) {
this.fileName = fileName;
this.gpxColor = gpxColor;
}
public GpxColorParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<GpxColorParams> CREATOR = new
Creator<GpxColorParams>() {
public GpxColorParams createFromParcel(Parcel in) {
return new GpxColorParams(in);
}
public GpxColorParams[] newArray(int size) {
return new GpxColorParams[size];
}
};
public String getFileName() {
return fileName;
}
public String getGpxColor() {
return gpxColor;
}
public void setGpxColor(String gpxColor) {
this.gpxColor = gpxColor;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(fileName);
out.writeString(gpxColor);
}
public void readFromParcel(Parcel in) {
fileName = in.readString();
gpxColor = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.mapmarker;
parcelable RemoveMapMarkersParams;

View file

@ -0,0 +1,37 @@
package net.osmand.aidl.mapmarker;
import android.os.Parcel;
import android.os.Parcelable;
public class RemoveMapMarkersParams implements Parcelable {
public RemoveMapMarkersParams() {
}
public RemoveMapMarkersParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<RemoveMapMarkersParams> CREATOR = new
Creator<RemoveMapMarkersParams>() {
public RemoveMapMarkersParams createFromParcel(Parcel in) {
return new RemoveMapMarkersParams(in);
}
public RemoveMapMarkersParams[] newArray(int size) {
return new RemoveMapMarkersParams[size];
}
};
public void writeToParcel(Parcel out, int flags) {
}
private void readFromParcel(Parcel in) {
}
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navigation;
parcelable ANavigationVoiceRouterMessageParams;

View file

@ -0,0 +1,56 @@
package net.osmand.aidl.navigation;
import android.os.Parcel;
import android.os.Parcelable;
public class ANavigationVoiceRouterMessageParams implements Parcelable{
private boolean subscribeToUpdates = true;
private long callbackId = -1L;
public ANavigationVoiceRouterMessageParams() {
}
public long getCallbackId() {
return callbackId;
}
public void setCallbackId(long callbackId) {
this.callbackId = callbackId;
}
public void setSubscribeToUpdates(boolean subscribeToUpdates) {
this.subscribeToUpdates = subscribeToUpdates;
}
public boolean isSubscribeToUpdates() {
return subscribeToUpdates;
}
protected ANavigationVoiceRouterMessageParams(Parcel in) {
callbackId = in.readLong();
subscribeToUpdates = in.readByte() != 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(callbackId);
dest.writeByte((byte) (subscribeToUpdates ? 1 : 0));
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<ANavigationVoiceRouterMessageParams> CREATOR = new Creator<ANavigationVoiceRouterMessageParams>() {
@Override
public ANavigationVoiceRouterMessageParams createFromParcel(Parcel in) {
return new ANavigationVoiceRouterMessageParams(in);
}
@Override
public ANavigationVoiceRouterMessageParams[] newArray(int size) {
return new ANavigationVoiceRouterMessageParams[size];
}
};
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.navigation;
parcelable OnVoiceNavigationParams;

View file

@ -0,0 +1,57 @@
package net.osmand.aidl.navigation;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;
public class OnVoiceNavigationParams implements Parcelable {
private List<String> cmds;
private List<String> played;
public OnVoiceNavigationParams() {
cmds = new ArrayList<>();
played = new ArrayList<>();
}
public OnVoiceNavigationParams(List<String> cmds, List<String> played) {
this.cmds = cmds;
this.played = played;
}
public OnVoiceNavigationParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<OnVoiceNavigationParams> CREATOR = new Creator<OnVoiceNavigationParams>() {
@Override
public OnVoiceNavigationParams createFromParcel(Parcel in) {
return new OnVoiceNavigationParams(in);
}
@Override
public OnVoiceNavigationParams[] newArray(int size) {
return new OnVoiceNavigationParams[size];
}
};
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeStringList(cmds);
out.writeStringList(played);
}
private void readFromParcel(Parcel in) {
cmds = new ArrayList<>();
in.readStringList(cmds);
played = new ArrayList<>();
in.readStringList(played);
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -127,6 +127,10 @@ class OsmandAidlHelper(private val app: TelegramApplication) {
contextMenuButtonsListener!!.onContextMenuButtonClicked(buttonId, pointId, layerId) contextMenuButtonsListener!!.onContextMenuButtonClicked(buttonId, pointId, layerId)
} }
} }
override fun onVoiceRouterNotify(params: OnVoiceNavigationParams?) {
}
} }
fun setSearchCompleteListener(mSearchCompleteListener: SearchCompleteListener) { fun setSearchCompleteListener(mSearchCompleteListener: SearchCompleteListener) {
@ -1227,4 +1231,18 @@ class OsmandAidlHelper(private val app: TelegramApplication) {
} }
return false return false
} }
fun getGpxColor(filename: String): String? {
if (mIOsmAndAidlInterface != null) {
try {
val gpxColorParams = GpxColorParams(filename)
if (mIOsmAndAidlInterface!!.getGpxColor(gpxColorParams)) {
return gpxColorParams.gpxColor
}
} catch (e: RemoteException) {
e.printStackTrace()
}
}
return null
}
} }

View file

@ -115,7 +115,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
setupMapLayer() setupMapLayer()
osmandAidlHelper.execOsmandApi { osmandAidlHelper.execOsmandApi {
val pointId = item.getMapPointId() val pointId = item.getMapPointId()
val name = item.getVisibleName() val name = item.name
val aLatLon = ALatLon(item.latLon!!.latitude, item.latLon!!.longitude) val aLatLon = ALatLon(item.latLon!!.latitude, item.latLon!!.longitude)
val details = generatePointDetails(item.bearing?.toFloat(), item.altitude?.toFloat(), item.precision?.toFloat()) val details = generatePointDetails(item.bearing?.toFloat(), item.altitude?.toFloat(), item.precision?.toFloat())
val params = generatePointParams(if (stale) item.grayscalePhotoPath else item.photoPath, stale, item.speed?.toFloat(), item.bearing?.toFloat()) val params = generatePointParams(if (stale) item.grayscalePhotoPath else item.photoPath, stale, item.speed?.toFloat(), item.bearing?.toFloat())
@ -301,7 +301,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
val aGpxFile = importedGpxFiles.firstOrNull { it.fileName == name } val aGpxFile = importedGpxFiles.firstOrNull { it.fileName == name }
if (aGpxFile != null) { if (aGpxFile != null) {
val color = aGpxFile.color val color = osmandAidlHelper.getGpxColor(aGpxFile.fileName)
if (!color.isNullOrEmpty()) { if (!color.isNullOrEmpty()) {
gpxFile.extensionsToWrite["color"] = color gpxFile.extensionsToWrite["color"] = color
} }

View file

@ -77,6 +77,7 @@ import net.osmand.aidl.customization.CustomizationInfoParams;
import net.osmand.aidl.gpx.AGpxFile; import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.AGpxFileDetails; import net.osmand.aidl.gpx.AGpxFileDetails;
import net.osmand.aidl.gpx.CreateGpxBitmapParams; import net.osmand.aidl.gpx.CreateGpxBitmapParams;
import net.osmand.aidl.gpx.GpxColorParams;
import net.osmand.aidl.tiles.ASqliteDbFile; import net.osmand.aidl.tiles.ASqliteDbFile;
@ -831,4 +832,18 @@ interface IOsmAndAidlInterface {
* Empty class of params * Empty class of params
*/ */
boolean removeAllActiveMapMarkers(in RemoveMapMarkersParams params); boolean removeAllActiveMapMarkers(in RemoveMapMarkersParams params);
/**
* Method to get color name for gpx.
*
* @param fileName (String) - name of gpx file.
*
* @param gpxColor (String) - color name of gpx. Can be one of: "red", "orange", "lightblue",
* "blue", "purple", "translucent_red", "translucent_orange",
* "translucent_lightblue", "translucent_blue", "translucent_purple"
* Which used in {@link #importGpx(in ImportGpxParams params) importGpx}
* Or color hex if gpx has custom color.
*
*/
boolean getGpxColor(inout GpxColorParams params);
} }

View file

@ -39,6 +39,7 @@ import net.osmand.aidl.gpx.AGpxBitmap;
import net.osmand.aidl.gpx.AGpxFile; import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.AGpxFileDetails; import net.osmand.aidl.gpx.AGpxFileDetails;
import net.osmand.aidl.gpx.ASelectedGpxFile; import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.GpxColorParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams; import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams; import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.maplayer.AMapLayer; import net.osmand.aidl.maplayer.AMapLayer;
@ -1477,17 +1478,12 @@ public class OsmandAidlApi {
boolean active = app.getSelectedGpxHelper().getSelectedFileByPath(file.getAbsolutePath()) != null; boolean active = app.getSelectedGpxHelper().getSelectedFileByPath(file.getAbsolutePath()) != null;
long modifiedTime = dataItem.getFileLastModifiedTime(); long modifiedTime = dataItem.getFileLastModifiedTime();
long fileSize = file.length(); long fileSize = file.length();
int color = dataItem.getColor();
String colorName = "";
if (color != 0) {
colorName = ConfigureMapMenu.GpxAppearanceAdapter.parseTrackColorName(app.getRendererRegistry().getCurrentSelectedRenderer(), color);
}
AGpxFileDetails details = null; AGpxFileDetails details = null;
GPXTrackAnalysis analysis = dataItem.getAnalysis(); GPXTrackAnalysis analysis = dataItem.getAnalysis();
if (analysis != null) { if (analysis != null) {
details = createGpxFileDetails(analysis); details = createGpxFileDetails(analysis);
} }
files.add(new AGpxFile(fileName, modifiedTime, fileSize, active, colorName, details)); files.add(new AGpxFile(fileName, modifiedTime, fileSize, active, details));
} }
//} //}
} }
@ -1496,6 +1492,26 @@ public class OsmandAidlApi {
return false; return false;
} }
boolean getGpxColor(GpxColorParams params) {
if (params != null) {
List<GpxDataItem> gpxDataItems = app.getGpxDatabase().getItems();
for (GpxDataItem dataItem : gpxDataItems) {
File file = dataItem.getFile();
if (file.exists()) {
if (file.getName().equals(params.getFileName())) {
int color = dataItem.getColor();
if (color != 0) {
String colorName = ConfigureMapMenu.GpxAppearanceAdapter.parseTrackColorName(app.getRendererRegistry().getCurrentSelectedRenderer(), color);
params.setGpxColor(colorName);
return true;
}
}
}
}
}
return false;
}
boolean removeGpx(String fileName) { boolean removeGpx(String fileName) {
if (!Algorithms.isEmpty(fileName)) { if (!Algorithms.isEmpty(fileName)) {
final File f = app.getAppPath(IndexConstants.GPX_INDEX_DIR + fileName); final File f = app.getAppPath(IndexConstants.GPX_INDEX_DIR + fileName);

View file

@ -33,6 +33,7 @@ import net.osmand.aidl.gpx.AGpxBitmap;
import net.osmand.aidl.gpx.AGpxFile; import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.ASelectedGpxFile; import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.CreateGpxBitmapParams; import net.osmand.aidl.gpx.CreateGpxBitmapParams;
import net.osmand.aidl.gpx.GpxColorParams;
import net.osmand.aidl.gpx.HideGpxParams; import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ImportGpxParams; import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.RemoveGpxParams; import net.osmand.aidl.gpx.RemoveGpxParams;
@ -1174,6 +1175,17 @@ public class OsmandAidlService extends Service implements AidlCallbackListener {
return false; return false;
} }
} }
@Override
public boolean getGpxColor(GpxColorParams params) throws RemoteException {
try {
OsmandAidlApi api = getApi("getGpxColor");
return api != null && api.getGpxColor(params);
} catch (Exception e) {
handleException(e);
return false;
}
}
}; };
public static class AidlCallbackParams { public static class AidlCallbackParams {

View file

@ -11,15 +11,13 @@ public class AGpxFile implements Parcelable {
private long modifiedTime; private long modifiedTime;
private long fileSize; private long fileSize;
private boolean active; private boolean active;
private String color;
private AGpxFileDetails details; private AGpxFileDetails details;
public AGpxFile(@NonNull String fileName, long modifiedTime, long fileSize, boolean active, String color, @Nullable AGpxFileDetails details) { public AGpxFile(@NonNull String fileName, long modifiedTime, long fileSize, boolean active, @Nullable AGpxFileDetails details) {
this.fileName = fileName; this.fileName = fileName;
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
this.fileSize = fileSize; this.fileSize = fileSize;
this.active = active; this.active = active;
this.color = color;
this.details = details; this.details = details;
} }
@ -54,10 +52,6 @@ public class AGpxFile implements Parcelable {
return active; return active;
} }
public String getColor() {
return color;
}
public AGpxFileDetails getDetails() { public AGpxFileDetails getDetails() {
return details; return details;
} }
@ -72,7 +66,6 @@ public class AGpxFile implements Parcelable {
if (details != null) { if (details != null) {
out.writeParcelable(details, flags); out.writeParcelable(details, flags);
} }
out.writeString(color);
} }
private void readFromParcel(Parcel in) { private void readFromParcel(Parcel in) {
@ -87,7 +80,6 @@ public class AGpxFile implements Parcelable {
} else { } else {
details = null; details = null;
} }
color = in.readString();
} }
public int describeContents() { public int describeContents() {

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable GpxColorParams;

View file

@ -0,0 +1,66 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
public class GpxColorParams implements Parcelable {
private String fileName;
private String gpxColor;
public GpxColorParams() {
}
public GpxColorParams(@NonNull String fileName) {
this.fileName = fileName;
}
public GpxColorParams(@NonNull String fileName, String gpxColor) {
this.fileName = fileName;
this.gpxColor = gpxColor;
}
public GpxColorParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<GpxColorParams> CREATOR = new
Creator<GpxColorParams>() {
public GpxColorParams createFromParcel(Parcel in) {
return new GpxColorParams(in);
}
public GpxColorParams[] newArray(int size) {
return new GpxColorParams[size];
}
};
public String getFileName() {
return fileName;
}
public String getGpxColor() {
return gpxColor;
}
public void setGpxColor(String gpxColor) {
this.gpxColor = gpxColor;
}
public void writeToParcel(Parcel out, int flags) {
out.writeString(fileName);
out.writeString(gpxColor);
}
public void readFromParcel(Parcel in) {
fileName = in.readString();
gpxColor = in.readString();
}
public int describeContents() {
return 0;
}
}

View file

@ -44,7 +44,9 @@ public class OnVoiceNavigationParams implements Parcelable {
} }
private void readFromParcel(Parcel in) { private void readFromParcel(Parcel in) {
cmds = new ArrayList<>();
in.readStringList(cmds); in.readStringList(cmds);
played = new ArrayList<>();
in.readStringList(played); in.readStringList(played);
} }

View file

@ -276,7 +276,7 @@ public class AMapPointMenuController extends MenuController {
} }
ims.close(); ims.close();
} }
} catch (IOException e) { } catch (Exception e) {
// ignore // ignore
} }