From 8f9839461cdbc415619be526a1f92e1ad1a8b245 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 11:31:43 +0300 Subject: [PATCH 01/18] Fix typo --- OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 85e8bdb963..0e25d29d7c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -467,7 +467,7 @@ public class GpxUiHelper { final ContextMenuItem item = adapter.getItem(position); GPXInfo info = list.get(position); - udpateGpxInfoView(v, item, info, getDataItem(info), showCurrentGpx && position == 0, app); + updateGpxInfoView(v, item, info, getDataItem(info), showCurrentGpx && position == 0, app); if (item.getSelected() == null) { v.findViewById(R.id.check_item).setVisibility(View.GONE); @@ -704,7 +704,7 @@ public class GpxUiHelper { return dlg; } - public static void udpateGpxInfoView(View v, ContextMenuItem item, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) { + public static void updateGpxInfoView(View v, ContextMenuItem item, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) { TextView viewName = ((TextView) v.findViewById(R.id.name)); viewName.setText(item.getTitle().replace("/", " • ").trim()); ImageView icon = (ImageView) v.findViewById(R.id.icon); From 4839b5d4bae21f8ad7b99b3b0eff82bf55bdc198 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 13:40:41 +0300 Subject: [PATCH 02/18] Fix #4251 --- .../src/net/osmand/plus/activities/SavingTrackHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 4fae499777..464c2626fd 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper; import android.text.format.DateFormat; import net.osmand.PlatformUtil; import net.osmand.data.LatLon; +import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.GPXTrackAnalysis; @@ -226,6 +227,11 @@ public class SavingTrackHelper extends SQLiteOpenHelper { warnings.add(warn); return warnings; } + + GPXFile gpx = data.get(f); + GPXTrackAnalysis analysis = gpx.getAnalysis(fout.lastModified()); + GpxDataItem item = new GpxDataItem(fout, analysis); + ctx.getGpxDatabase().add(item); } } } From 6fae2753c7fc9c41632d3f00bedcdf1de8a70c82 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 13:55:44 +0300 Subject: [PATCH 03/18] Move preference to general --- .../net/osmand/plus/activities/SettingsGeneralActivity.java | 1 + .../osmand/plus/development/SettingsDevelopmentActivity.java | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index 3fa6974167..3ad0466430 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -479,6 +479,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR } misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc)); misc.addPreference(createCheckBoxPreference(settings.DO_NOT_USE_ANIMATIONS, R.string.do_not_use_animations, R.string.do_not_use_animations_descr)); + misc.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS, R.string.use_magnetic_sensor, R.string.use_magnetic_sensor_descr)); } diff --git a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java index 200dc58369..a313a2554e 100644 --- a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java @@ -51,11 +51,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.USE_FAST_RECALCULATION, R.string.use_fast_recalculation, R.string.use_fast_recalculation_desc)); - - cat.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS, - R.string.use_magnetic_sensor, - R.string.use_magnetic_sensor_descr)); - final CheckBoxPreference openGlRender = createCheckBoxPreference(settings.USE_OPENGL_RENDER, R.string.use_opengl_render,R.string.use_opengl_render_descr); cat.addPreference(openGlRender); From 56d40a68043c2df47d57ec9885e8ade4a225dead Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 14:14:07 +0300 Subject: [PATCH 04/18] Fix exiting dialog --- .../MeasurementToolFragment.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index d5b5d9a0d8..993bb03000 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1410,21 +1410,25 @@ public class MeasurementToolFragment extends Fragment { builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date()); - String fileName = name + GPX_SUFFIX; - File fout = new File(dir, fileName); - int ind = 1; - while (fout.exists()) { - fileName = name + "_" + (++ind) + GPX_SUFFIX; - fout = new File(dir, fileName); - } - SaveType saveType; - if (editingCtx.isInSnapToRoadMode()) { - saveType = SaveType.SNAP_TO_ROAD; + if (showOnMapToggle.isChecked()) { + final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date()); + String fileName = name + GPX_SUFFIX; + File fout = new File(dir, fileName); + int ind = 1; + while (fout.exists()) { + fileName = name + "_" + (++ind) + GPX_SUFFIX; + fout = new File(dir, fileName); + } + SaveType saveType; + if (editingCtx.isInSnapToRoadMode()) { + saveType = SaveType.SNAP_TO_ROAD; + } else { + saveType = SaveType.LINE; + } + saveNewGpx(dir, fileName, true, saveType, true); } else { - saveType = SaveType.LINE; + dismiss(mapActivity); } - saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType, true); } }); } else { @@ -1441,12 +1445,7 @@ public class MeasurementToolFragment extends Fragment { } builder.setTitle(getString(R.string.exit_without_saving)) .setMessage(getString(R.string.unsaved_changes_will_be_lost)) - .setNegativeButton(R.string.shared_string_cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - dismiss(mapActivity); - } - }); + .setNegativeButton(R.string.shared_string_cancel, null); builder.show(); } } From 3e86975ecfe8f03c538dc1ab63f726b268c2b27c Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 14:51:28 +0300 Subject: [PATCH 05/18] Fix #4332 --- .../src/net/osmand/plus/OsmandSettings.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index e79fc369e2..8dcec70c60 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -256,19 +256,27 @@ public class OsmandSettings { } public boolean isWifiConnected() { - ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo ni = mgr.getActiveNetworkInfo(); - return ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI; + try { + ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo ni = mgr.getActiveNetworkInfo(); + return ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI; + } catch (Exception e) { + return false; + } } private boolean isInternetConnected() { - ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo active = mgr.getActiveNetworkInfo(); - if (active == null) { + try { + ConnectivityManager mgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo active = mgr.getActiveNetworkInfo(); + if (active == null) { + return false; + } else { + NetworkInfo.State state = active.getState(); + return state != NetworkInfo.State.DISCONNECTED && state != NetworkInfo.State.DISCONNECTING; + } + } catch (Exception e) { return false; - } else { - NetworkInfo.State state = active.getState(); - return state != NetworkInfo.State.DISCONNECTED && state != NetworkInfo.State.DISCONNECTING; } } From dde7524a29aae2672f6353cb05b7d03f27fb1699 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 16:02:07 +0300 Subject: [PATCH 06/18] Disable anim in move and zoom --- .../net/osmand/plus/views/AnimateDraggingMapThread.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java index 0d796093cb..2a64976dee 100644 --- a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java +++ b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java @@ -212,8 +212,9 @@ public class AnimateDraggingMapThread { } final float mMoveX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon); final float mMoveY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon); - - final float animationTime = Math.max(450, (Math.abs(mStX) + Math.abs(mStY)) / 1200f * MOVE_MOVE_ANIMATION_TIME); + + final boolean doNotUseAnimations = tileView.getSettings().DO_NOT_USE_ANIMATIONS.get(); + final float animationTime = doNotUseAnimations ? 0 : Math.max(450, (Math.abs(mStX) + Math.abs(mStY)) / 1200f * MOVE_MOVE_ANIMATION_TIME); startThreadAnimating(new Runnable() { @@ -221,7 +222,7 @@ public class AnimateDraggingMapThread { public void run() { setTargetValues(endZoom, finalLat, finalLon); if(moveZoom != startZoom){ - animatingZoomInThread(startZoom, startZoomFP, moveZoom, startZoomFP,ZOOM_MOVE_ANIMATION_TIME, notifyListener); + animatingZoomInThread(startZoom, startZoomFP, moveZoom, startZoomFP, doNotUseAnimations ? 0 : ZOOM_MOVE_ANIMATION_TIME, notifyListener); } if(!stopped){ @@ -232,7 +233,7 @@ public class AnimateDraggingMapThread { } if (!stopped && (moveZoom != endZoom || startZoomFP != 0)) { - animatingZoomInThread(moveZoom, startZoomFP, endZoom, 0, ZOOM_MOVE_ANIMATION_TIME, notifyListener); + animatingZoomInThread(moveZoom, startZoomFP, endZoom, 0, doNotUseAnimations ? 0 : ZOOM_MOVE_ANIMATION_TIME, notifyListener); } tileView.setFractionalZoom(endZoom, 0, notifyListener); From bf84bbbda6f79ac3e06a9eddfe058307af75efe7 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Wed, 30 Aug 2017 16:04:11 +0300 Subject: [PATCH 07/18] Added method for RouteDataObject comparison --- .../net/osmand/binary/RouteDataObject.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index b3298aa8cd..a0b565192e 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -4,6 +4,7 @@ package net.osmand.binary; import gnu.trove.map.hash.TIntObjectHashMap; import java.text.MessageFormat; +import java.util.Arrays; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; @@ -63,6 +64,43 @@ public class RouteDataObject { this.id = copy.id; } + public boolean compareRoute(RouteDataObject thatObj) { + if (this.id == thatObj.id + && Arrays.equals(this.pointNames, thatObj.pointNames) + && Arrays.equals(this.pointsX, thatObj.pointsX) + && Arrays.equals(this.pointsY, thatObj.pointsY) + && Arrays.equals(this.restrictions, thatObj.restrictions)) { + if (this.region == null) { + throw new IllegalStateException("Illegal routing object: " + id); + } + if (thatObj.region == null) { + throw new IllegalStateException("Illegal routing object: " + thatObj.id); + } + boolean equals = true; + if (equals) { + if (this.names != null && thatObj.names != null) { + equals = Arrays.equals(this.names.values(), thatObj.names.values()); + } + } + if (equals) { + if (this.types == null || thatObj.types == null) { + equals = this.types == thatObj.types; + } else if (types.length != thatObj.types.length) { + equals = false; + } else { + for (int i = 0; i < this.types.length && equals; i++) { + String thisTag = region.routeEncodingRules.get(types[i]).getTag(); + String thisValue = region.routeEncodingRules.get(types[i]).getValue(); + String thatTag = thatObj.region.routeEncodingRules.get(thatObj.types[i]).getTag(); + String thatValue = thatObj.region.routeEncodingRules.get(thatObj.types[i]).getValue(); + equals = (thisTag.equals(thatTag) && thisValue.equals(thatValue)); + } + } + } + } + return false; + } + public float[] calculateHeightArray() { if(heightDistanceArray != null) { return heightDistanceArray; From c97595ccc32f9bed1b1f383ef3372cae630ba3c0 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 30 Aug 2017 19:00:25 +0300 Subject: [PATCH 08/18] Fix #4330 --- .../net/osmand/aidl/IOsmAndAidlInterface.aidl | 3 +++ OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 22 +++++++++++++++++++ .../net/osmand/aidl/OsmandAidlService.java | 18 +++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl index 94df40d166..a09b79709b 100644 --- a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl +++ b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl @@ -77,4 +77,7 @@ interface IOsmAndAidlInterface { boolean removeFavorite(in RemoveFavoriteParams params); boolean updateFavorite(in UpdateFavoriteParams params); + boolean startGpxRecording(); + boolean stopGpxRecording(); + } \ 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 41c8037ae5..2a967c5a17 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -29,9 +29,11 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dialogs.ConfigureMapMenu; import net.osmand.plus.helpers.ColorDialogs; +import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.views.AidlMapLayer; import net.osmand.plus.views.MapInfoLayer; import net.osmand.plus.views.OsmandMapLayer; @@ -841,4 +843,24 @@ public class OsmandAidlApi { app.sendBroadcast(intent); return true; } + + boolean startGpxRecording() { + final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); + if (plugin != null) { + plugin.startGPXMonitoring(null); + plugin.updateControl(); + return true; + } + return false; + } + + boolean stopGpxRecording() { + final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); + if (plugin != null) { + plugin.stopRecording(); + plugin.updateControl(); + return true; + } + return false; + } } diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java index ce7152edd8..ec5cd9f335 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java @@ -320,5 +320,23 @@ public class OsmandAidlService extends Service { return true; } } + + @Override + public boolean startGpxRecording() throws RemoteException { + try { + return getApi().startGpxRecording(); + } catch (Exception e) { + return false; + } + } + + @Override + public boolean stopGpxRecording() throws RemoteException { + try { + return getApi().stopGpxRecording(); + } catch (Exception e) { + return false; + } + } }; } From bd1de01665e37074f0ea681cfceb4cd17e72e991 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 30 Aug 2017 18:06:55 +0200 Subject: [PATCH 09/18] Fix route data object' --- .../binary/BinaryMapRouteReaderAdapter.java | 12 +++-- .../net/osmand/binary/RouteDataObject.java | 46 +++++++++++++++++-- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index f17c426343..11de0d4ae1 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -205,9 +205,9 @@ public class BinaryMapRouteReaderAdapter { public static class RouteRegion extends BinaryIndexPart { public int regionsRead; + public List routeEncodingRules = new ArrayList(); List subregions = new ArrayList(); List basesubregions = new ArrayList(); - List routeEncodingRules = new ArrayList(); int nameTypeRule = -1; int refTypeRule = -1; @@ -227,7 +227,7 @@ public class BinaryMapRouteReaderAdapter { return routeEncodingRules.get(id); } - private void initRouteEncodingRule(int id, String tags, String val) { + public void initRouteEncodingRule(int id, String tags, String val) { while (routeEncodingRules.size() <= id) { routeEncodingRules.add(null); } @@ -291,6 +291,12 @@ public class BinaryMapRouteReaderAdapter { } return false; } + + + public RouteDataObject adopt(RouteDataObject obj) { + // TODO Auto-generated method stub + return null; + } } // Used in C++ @@ -360,7 +366,7 @@ public class BinaryMapRouteReaderAdapter { protected void readRouteIndex(RouteRegion region) throws IOException { - int routeEncodingRule =1; + int routeEncodingRule = 1; while(true){ int t = codedIS.readTag(); int tag = WireFormat.getTagFieldNumber(t); diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index a0b565192e..749e14c829 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -66,17 +66,17 @@ public class RouteDataObject { public boolean compareRoute(RouteDataObject thatObj) { if (this.id == thatObj.id - && Arrays.equals(this.pointNames, thatObj.pointNames) && Arrays.equals(this.pointsX, thatObj.pointsX) - && Arrays.equals(this.pointsY, thatObj.pointsY) - && Arrays.equals(this.restrictions, thatObj.restrictions)) { + && Arrays.equals(this.pointsY, thatObj.pointsY)) { if (this.region == null) { throw new IllegalStateException("Illegal routing object: " + id); } if (thatObj.region == null) { throw new IllegalStateException("Illegal routing object: " + thatObj.id); } + boolean equals = true; + equals = equals && Arrays.equals(this.restrictions, thatObj.restrictions); if (equals) { if (this.names != null && thatObj.names != null) { equals = Arrays.equals(this.names.values(), thatObj.names.values()); @@ -97,6 +97,46 @@ public class RouteDataObject { } } } + if (equals) { + if (this.nameIds == null || thatObj.nameIds == null) { + equals = this.nameIds == thatObj.nameIds; + } else if (nameIds.length != thatObj.nameIds.length) { + equals = false; + } else { + for (int i = 0; i < this.nameIds.length && equals; i++) { + String thisTag = region.routeEncodingRules.get(nameIds[i]).getTag(); + String thisValue = names.get(nameIds[i]); + String thatTag = thatObj.region.routeEncodingRules.get(thatObj.nameIds[i]).getTag(); + String thatValue = thatObj.names.get(thatObj.nameIds[i]); + equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue)); + } + } + } + + if (equals) { + if (this.pointNameTypes == null || thatObj.pointNameTypes == null) { + equals = this.pointNameTypes == thatObj.pointNameTypes; + } else if (pointNameTypes.length != thatObj.pointNameTypes.length) { + equals = false; + } else { + for (int i = 0; i < this.pointNameTypes.length && equals; i++) { + if (this.pointNameTypes[i] == null || thatObj.pointNameTypes[i] == null) { + equals = this.pointNameTypes[i] == thatObj.pointNameTypes[i]; + } else if (pointNameTypes[i].length != thatObj.pointNameTypes[i].length) { + equals = false; + } else { + for (int j = 0; j < this.pointNameTypes[i].length && equals; j++) { + String thisTag = region.routeEncodingRules.get(pointNameTypes[i][j]).getTag(); + String thisValue = pointNames[i][j]; + String thatTag = thatObj.region.routeEncodingRules.get(thatObj.pointNameTypes[i][j]).getTag(); + String thatValue = thatObj.pointNames[i][j]; + equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue)); + } + } + } + } + } + } return false; } From 7211a51b6443152d8bde94612e411666f9748dd0 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 30 Aug 2017 22:35:41 +0200 Subject: [PATCH 10/18] Fix issue with diff generation --- .../binary/BinaryMapRouteReaderAdapter.java | 96 ++++++++++++++++++- .../net/osmand/binary/RouteDataObject.java | 24 ++++- 2 files changed, 116 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 11de0d4ae1..9e69c7b7bc 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -16,12 +16,14 @@ import java.util.List; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; +import net.osmand.binary.BinaryMapIndexReader.TagValuePair; import net.osmand.binary.OsmandOdb.IdTable; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteDataBlock; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteDataBox; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteEncodingRule; import net.osmand.binary.OsmandOdb.RestrictionData; import net.osmand.binary.OsmandOdb.RouteData; +import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import net.osmand.util.OpeningHoursParser; @@ -213,6 +215,7 @@ public class BinaryMapRouteReaderAdapter { int refTypeRule = -1; int destinationTypeRule = -1; int destinationRefTypeRule = -1; + private RouteRegion referenceRouteRegion; public String getPartName() { return "Routing"; @@ -223,6 +226,17 @@ public class BinaryMapRouteReaderAdapter { return OsmandOdb.OsmAndStructure.ROUTINGINDEX_FIELD_NUMBER; } + private int searchRouteEncodingRule(String tag, String value) { + // TODO cache; + for(int k = 0; k < routeEncodingRules.size(); k++) { + RouteTypeRule rt = routeEncodingRules.get(k); + if(Algorithms.objectEquals(rt.getTag(), tag) && Algorithms.objectEquals(rt.getValue(), value)) { + return k; + } + } + return -1; + } + public RouteTypeRule quickGetEncodingRule(int id) { return routeEncodingRules.get(id); } @@ -293,10 +307,86 @@ public class BinaryMapRouteReaderAdapter { } - public RouteDataObject adopt(RouteDataObject obj) { - // TODO Auto-generated method stub - return null; + public RouteDataObject adopt(RouteDataObject o) { + if(o.region == this || o.region == referenceRouteRegion) { + return o; + } + + if(routeEncodingRules.isEmpty()) { + routeEncodingRules.addAll(o.region.routeEncodingRules); + referenceRouteRegion= o.region; + return o; + } + RouteDataObject rdo = new RouteDataObject(this); + rdo.pointsX = o.pointsX; + rdo.pointsY = o.pointsY; + rdo.id = o.id; + rdo.restrictions = o.restrictions; + + if (o.types != null) { + rdo.types = new int[o.types.length]; + for (int i = 0; i < o.types.length; i++) { + RouteTypeRule tp = o.region.routeEncodingRules.get(o.types[i]); + int ruleId = searchRouteEncodingRule(tp.getTag(), tp.getValue()); + if(ruleId != -1) { + rdo.types[i] = ruleId; + } else { + ruleId = routeEncodingRules.size() ; + initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue()); + rdo.types[i] = ruleId; + } + } + } + if (o.pointTypes != null) { + rdo.pointTypes = new int[o.pointTypes.length][]; + for (int i = 0; i < o.pointTypes.length; i++) { + if (o.pointTypes[i] != null) { + rdo.pointTypes[i] = new int[o.pointTypes[i].length]; + for (int j = 0; j < o.pointTypes[i].length; j++) { + RouteTypeRule tp = o.region.routeEncodingRules.get(o.pointTypes[i][j]); + int ruleId = searchRouteEncodingRule(tp.getTag(), tp.getValue()); + if(ruleId != -1) { + rdo.pointTypes[i][j] = ruleId; + } else { + ruleId = routeEncodingRules.size() ; + initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue()); + rdo.pointTypes[i][j] = ruleId; + } + } + } + } + } + // TODO + // rdo.nameIds rdo.names; + // rdo.pointNameTypes rdo.pointNames +// BinaryMapDataObject bm = +// new BinaryMapDataObject(o.id, o.coordinates, o.polygonInnerCoordinates, o.objectType, o.area, +// types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray()); +// if (o.namesOrder != null) { +// bm.objectNames = new TIntObjectHashMap<>(); +// bm.namesOrder = new TIntArrayList(); +// for (int i = 0; i < o.namesOrder.size(); i++) { +// int nameType = o.namesOrder.get(i); +// String name = o.objectNames.get(nameType); +// TagValuePair tp = o.mapIndex.decodeType(nameType); +// Integer r = getRule(tp); +// if(r != null) { +// bm.namesOrder.add(r); +// bm.objectNames.put(r, name); +// } else { +// int nid = decodingRules.size() + 1; +// initMapEncodingRule(tp.additionalAttribute, nid, tp.tag, tp.value); +// additionalTypes.add(nid); +// bm.objectNames.put(nid, name); +// } +// } +// } +// return bm; + return rdo; } + + + } // Used in C++ diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index 749e14c829..06d892ae95 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -112,7 +112,29 @@ public class RouteDataObject { } } } - + if (equals) { + if (this.pointTypes == null || thatObj.pointTypes == null) { + equals = this.pointTypes == thatObj.pointTypes; + } else if (pointTypes.length != thatObj.pointTypes.length) { + equals = false; + } else { + for (int i = 0; i < this.pointTypes.length && equals; i++) { + if (this.pointTypes[i] == null || thatObj.pointTypes[i] == null) { + equals = this.pointTypes[i] == thatObj.pointTypes[i]; + } else if (pointTypes[i].length != thatObj.pointTypes[i].length) { + equals = false; + } else { + for (int j = 0; j < this.pointTypes[i].length && equals; j++) { + String thisTag = region.routeEncodingRules.get(pointTypes[i][j]).getTag(); + String thisValue = region.routeEncodingRules.get(pointTypes[i][j]).getValue(); + String thatTag = thatObj.region.routeEncodingRules.get(thatObj.pointTypes[i][j]).getTag(); + String thatValue = thatObj.region.routeEncodingRules.get(thatObj.pointTypes[i][j]).getValue(); + equals = (Algorithms.objectEquals(thisTag, thatTag) && Algorithms.objectEquals(thisValue, thatValue)); + } + } + } + } + } if (equals) { if (this.pointNameTypes == null || thatObj.pointNameTypes == null) { equals = this.pointNameTypes == thatObj.pointNameTypes; From c71b49c514eb2088a9a108633bd5725c2a5cb086 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 30 Aug 2017 23:37:38 +0200 Subject: [PATCH 11/18] Implement adopting of route object --- .../binary/BinaryMapRouteReaderAdapter.java | 84 +++++++++++-------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 9e69c7b7bc..2f1470a65a 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -12,18 +12,17 @@ import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Map; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; -import net.osmand.binary.BinaryMapIndexReader.TagValuePair; import net.osmand.binary.OsmandOdb.IdTable; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteDataBlock; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteDataBox; import net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteEncodingRule; import net.osmand.binary.OsmandOdb.RestrictionData; import net.osmand.binary.OsmandOdb.RouteData; -import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import net.osmand.util.OpeningHoursParser; @@ -208,6 +207,7 @@ public class BinaryMapRouteReaderAdapter { public static class RouteRegion extends BinaryIndexPart { public int regionsRead; public List routeEncodingRules = new ArrayList(); + public Map decodingRules = null; List subregions = new ArrayList(); List basesubregions = new ArrayList(); @@ -227,13 +227,17 @@ public class BinaryMapRouteReaderAdapter { } private int searchRouteEncodingRule(String tag, String value) { - // TODO cache; - for(int k = 0; k < routeEncodingRules.size(); k++) { - RouteTypeRule rt = routeEncodingRules.get(k); - if(Algorithms.objectEquals(rt.getTag(), tag) && Algorithms.objectEquals(rt.getValue(), value)) { - return k; + if(decodingRules == null) { + for(int i = 0; i < routeEncodingRules.size(); i++) { + RouteTypeRule rt = routeEncodingRules.get(i); + String ks = rt.getTag() +"#" + rt.getValue(); + decodingRules.put(ks, i); } } + String k = tag +"#" +value; + if(decodingRules.containsKey(k)) { + return decodingRules.get(k).intValue(); + } return -1; } @@ -242,6 +246,7 @@ public class BinaryMapRouteReaderAdapter { } public void initRouteEncodingRule(int id, String tags, String val) { + decodingRules = null; while (routeEncodingRules.size() <= id) { routeEncodingRules.add(null); } @@ -356,32 +361,45 @@ public class BinaryMapRouteReaderAdapter { } } } - // TODO - // rdo.nameIds rdo.names; - // rdo.pointNameTypes rdo.pointNames -// BinaryMapDataObject bm = -// new BinaryMapDataObject(o.id, o.coordinates, o.polygonInnerCoordinates, o.objectType, o.area, -// types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray()); -// if (o.namesOrder != null) { -// bm.objectNames = new TIntObjectHashMap<>(); -// bm.namesOrder = new TIntArrayList(); -// for (int i = 0; i < o.namesOrder.size(); i++) { -// int nameType = o.namesOrder.get(i); -// String name = o.objectNames.get(nameType); -// TagValuePair tp = o.mapIndex.decodeType(nameType); -// Integer r = getRule(tp); -// if(r != null) { -// bm.namesOrder.add(r); -// bm.objectNames.put(r, name); -// } else { -// int nid = decodingRules.size() + 1; -// initMapEncodingRule(tp.additionalAttribute, nid, tp.tag, tp.value); -// additionalTypes.add(nid); -// bm.objectNames.put(nid, name); -// } -// } -// } -// return bm; + if (o.nameIds != null) { + rdo.nameIds = new int[o.nameIds.length]; + rdo.names = new TIntObjectHashMap<>(); + for (int i = 0; i < o.nameIds.length; i++) { + RouteTypeRule tp = o.region.routeEncodingRules.get(o.nameIds[i]); + int ruleId = searchRouteEncodingRule(tp.getTag(), null); + if(ruleId != -1) { + rdo.nameIds[i] = ruleId; + } else { + ruleId = routeEncodingRules.size() ; + initRouteEncodingRule(ruleId, tp.getTag(), null); + rdo.nameIds[i] = ruleId; + } + rdo.names.put(ruleId, o.names.get(o.nameIds[i])); + } + } + rdo.pointNames = o.pointNames; + if (o.pointNameTypes != null) { + rdo.pointNameTypes = new int[o.pointNameTypes.length][]; + // rdo.pointNames = new String[o.pointNameTypes.length][]; + for (int i = 0; i < o.pointNameTypes.length; i++) { + if (o.pointNameTypes[i] != null) { + rdo.pointNameTypes[i] = new int[o.pointNameTypes[i].length]; + // rdo.pointNames[i] = new String[o.pointNameTypes[i].length]; + for (int j = 0; j < o.pointNameTypes[i].length; j++) { + RouteTypeRule tp = o.region.routeEncodingRules.get(o.pointNameTypes[i][j]); + int ruleId = searchRouteEncodingRule(tp.getTag(), null); + if(ruleId != -1) { + rdo.pointNameTypes[i][j] = ruleId; + } else { + ruleId = routeEncodingRules.size() ; + initRouteEncodingRule(ruleId, tp.getTag(), tp.getValue()); + rdo.pointNameTypes[i][j] = ruleId; + } + // rdo.pointNames[i][j] = o.pointNames[i][j]; + } + } + } + } return rdo; } From e3662b26d4296641e7c308354997e358269cc08f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 30 Aug 2017 23:46:51 +0200 Subject: [PATCH 12/18] Implement adopting of route object --- .../src/net/osmand/binary/BinaryMapRouteReaderAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 2f1470a65a..289415b610 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -226,7 +226,7 @@ public class BinaryMapRouteReaderAdapter { return OsmandOdb.OsmAndStructure.ROUTINGINDEX_FIELD_NUMBER; } - private int searchRouteEncodingRule(String tag, String value) { + public int searchRouteEncodingRule(String tag, String value) { if(decodingRules == null) { for(int i = 0; i < routeEncodingRules.size(); i++) { RouteTypeRule rt = routeEncodingRules.get(i); From 19babbd7307286659144e09cc2aeac63655d754a Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 30 Aug 2017 23:50:55 +0200 Subject: [PATCH 13/18] string improvements --- OsmAnd/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 4933b7ca6b..23918feaa1 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -10,7 +10,7 @@ PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> Do not use animations - It disables animations in app + Disables animations in app Keep showing on map Exit without saving? Line @@ -133,7 +133,7 @@ Do not send anonymous app usage statistics OsmAnd collects information about which parts of the app you open. Your location is never sent, nor is anything you enter into the app or details of areas you view, search, or download. Do not show messages at startup - It displays app discounts & special local events messages + Parking options Thank you for purchasing the full version of OsmAnd! Hilly From 8725040fbe1a3da118b6a84fb698a393c9f2726c Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 31 Aug 2017 00:03:47 +0200 Subject: [PATCH 14/18] Implement adopting of route object --- .../src/net/osmand/binary/BinaryMapRouteReaderAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 289415b610..3f17f3e859 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -230,11 +230,11 @@ public class BinaryMapRouteReaderAdapter { if(decodingRules == null) { for(int i = 0; i < routeEncodingRules.size(); i++) { RouteTypeRule rt = routeEncodingRules.get(i); - String ks = rt.getTag() +"#" + rt.getValue(); + String ks = rt.getTag() +"#" + (rt.getValue() == null ? "" : rt.getValue()); decodingRules.put(ks, i); } } - String k = tag +"#" +value; + String k = tag +"#" + (value == null ? "" : value); if(decodingRules.containsKey(k)) { return decodingRules.get(k).intValue(); } From aa0312c94b9da91849cdef721f13ae7462b799a3 Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 31 Aug 2017 00:05:47 +0200 Subject: [PATCH 15/18] fix build --- OsmAnd/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 23918feaa1..49b412d859 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -10,7 +10,7 @@ PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> Do not use animations - Disables animations in app + Disables animations in the app Keep showing on map Exit without saving? Line @@ -133,7 +133,7 @@ Do not send anonymous app usage statistics OsmAnd collects information about which parts of the app you open. Your location is never sent, nor is anything you enter into the app or details of areas you view, search, or download. Do not show messages at startup - + Suppresses displaying app discounts & special local event messages Parking options Thank you for purchasing the full version of OsmAnd! Hilly From de1f0eac3fe3419d4c098bb20113781b00ea7dcd Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 31 Aug 2017 00:25:32 +0200 Subject: [PATCH 16/18] Implement adopting of route object --- .../src/net/osmand/binary/BinaryMapRouteReaderAdapter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 3f17f3e859..e4ee030db1 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -228,6 +229,7 @@ public class BinaryMapRouteReaderAdapter { public int searchRouteEncodingRule(String tag, String value) { if(decodingRules == null) { + decodingRules = new LinkedHashMap(); for(int i = 0; i < routeEncodingRules.size(); i++) { RouteTypeRule rt = routeEncodingRules.get(i); String ks = rt.getTag() +"#" + (rt.getValue() == null ? "" : rt.getValue()); From 55a0d6710ff809ef84f85f540ea6a003146b03ed Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 31 Aug 2017 00:40:12 +0200 Subject: [PATCH 17/18] Implement adopting of route object --- .../src/net/osmand/binary/BinaryMapRouteReaderAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index e4ee030db1..f4c5323ec0 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -230,7 +230,7 @@ public class BinaryMapRouteReaderAdapter { public int searchRouteEncodingRule(String tag, String value) { if(decodingRules == null) { decodingRules = new LinkedHashMap(); - for(int i = 0; i < routeEncodingRules.size(); i++) { + for(int i = 1; i < routeEncodingRules.size(); i++) { RouteTypeRule rt = routeEncodingRules.get(i); String ks = rt.getTag() +"#" + (rt.getValue() == null ? "" : rt.getValue()); decodingRules.put(ks, i); From 4e715387dff6a0c3bae3e2b192d084af5b0f94bb Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 31 Aug 2017 11:23:27 +0300 Subject: [PATCH 18/18] Add params for start and stop recording --- .../net/osmand/aidl/IOsmAndAidlInterface.aidl | 6 ++- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 6 ++- .../net/osmand/aidl/OsmandAidlService.java | 10 +++-- .../aidl/gpx/StartGpxRecordingParams.aidl | 3 ++ .../aidl/gpx/StartGpxRecordingParams.java | 40 +++++++++++++++++++ .../aidl/gpx/StopGpxRecordingParams.aidl | 3 ++ .../aidl/gpx/StopGpxRecordingParams.java | 40 +++++++++++++++++++ 7 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java diff --git a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl index a09b79709b..089f96c04c 100644 --- a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl +++ b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl @@ -22,6 +22,8 @@ import net.osmand.aidl.calculateroute.CalculateRouteParams; import net.osmand.aidl.gpx.ImportGpxParams; import net.osmand.aidl.gpx.ShowGpxParams; +import net.osmand.aidl.gpx.StartGpxRecordingParams; +import net.osmand.aidl.gpx.StopGpxRecordingParams; import net.osmand.aidl.gpx.HideGpxParams; import net.osmand.aidl.gpx.ASelectedGpxFile; @@ -77,7 +79,7 @@ interface IOsmAndAidlInterface { boolean removeFavorite(in RemoveFavoriteParams params); boolean updateFavorite(in UpdateFavoriteParams params); - boolean startGpxRecording(); - boolean stopGpxRecording(); + boolean startGpxRecording(in StartGpxRecordingParams params); + boolean stopGpxRecording(in StopGpxRecordingParams params); } \ 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 2a967c5a17..7aaeff5eac 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -13,6 +13,8 @@ import net.osmand.IndexConstants; import net.osmand.aidl.favorite.AFavorite; import net.osmand.aidl.favorite.group.AFavoriteGroup; import net.osmand.aidl.gpx.ASelectedGpxFile; +import net.osmand.aidl.gpx.StartGpxRecordingParams; +import net.osmand.aidl.gpx.StopGpxRecordingParams; import net.osmand.aidl.maplayer.AMapLayer; import net.osmand.aidl.maplayer.point.AMapPoint; import net.osmand.aidl.mapmarker.AMapMarker; @@ -844,7 +846,7 @@ public class OsmandAidlApi { return true; } - boolean startGpxRecording() { + boolean startGpxRecording(StartGpxRecordingParams params) { final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); if (plugin != null) { plugin.startGPXMonitoring(null); @@ -854,7 +856,7 @@ public class OsmandAidlApi { return false; } - boolean stopGpxRecording() { + boolean stopGpxRecording(StopGpxRecordingParams params) { final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); if (plugin != null) { plugin.stopRecording(); diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java index ec5cd9f335..e1da642f59 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java @@ -16,6 +16,8 @@ import net.osmand.aidl.gpx.ASelectedGpxFile; import net.osmand.aidl.gpx.HideGpxParams; import net.osmand.aidl.gpx.ImportGpxParams; import net.osmand.aidl.gpx.ShowGpxParams; +import net.osmand.aidl.gpx.StartGpxRecordingParams; +import net.osmand.aidl.gpx.StopGpxRecordingParams; import net.osmand.aidl.map.SetMapLocationParams; import net.osmand.aidl.maplayer.AddMapLayerParams; import net.osmand.aidl.maplayer.RemoveMapLayerParams; @@ -322,18 +324,18 @@ public class OsmandAidlService extends Service { } @Override - public boolean startGpxRecording() throws RemoteException { + public boolean startGpxRecording(StartGpxRecordingParams params) throws RemoteException { try { - return getApi().startGpxRecording(); + return getApi().startGpxRecording(params); } catch (Exception e) { return false; } } @Override - public boolean stopGpxRecording() throws RemoteException { + public boolean stopGpxRecording(StopGpxRecordingParams params) throws RemoteException { try { - return getApi().stopGpxRecording(); + return getApi().stopGpxRecording(params); } catch (Exception e) { return false; } diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl new file mode 100644 index 0000000000..14f4871540 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.gpx; + +parcelable StartGpxRecordingParams; \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java new file mode 100644 index 0000000000..139eac8ea3 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java @@ -0,0 +1,40 @@ +package net.osmand.aidl.gpx; + +import android.os.Parcel; +import android.os.Parcelable; + +public class StartGpxRecordingParams implements Parcelable { + + public StartGpxRecordingParams() { + + } + + public StartGpxRecordingParams(Parcel in) { + readFromParcel(in); + } + + public static final Creator CREATOR = new Creator() { + @Override + public StartGpxRecordingParams createFromParcel(Parcel in) { + return new StartGpxRecordingParams(in); + } + + @Override + public StartGpxRecordingParams[] newArray(int size) { + return new StartGpxRecordingParams[size]; + } + }; + + @Override + public void writeToParcel(Parcel out, int flags) { + } + + private void readFromParcel(Parcel in) { + + } + + @Override + public int describeContents() { + return 0; + } +} diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl new file mode 100644 index 0000000000..db08f1811a --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.gpx; + +parcelable StopGpxRecordingParams; \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java new file mode 100644 index 0000000000..ada47db418 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java @@ -0,0 +1,40 @@ +package net.osmand.aidl.gpx; + +import android.os.Parcel; +import android.os.Parcelable; + +public class StopGpxRecordingParams implements Parcelable { + + public StopGpxRecordingParams() { + + } + + public StopGpxRecordingParams(Parcel in) { + readFromParcel(in); + } + + public static final Creator CREATOR = new Creator() { + @Override + public StopGpxRecordingParams createFromParcel(Parcel in) { + return new StopGpxRecordingParams(in); + } + + @Override + public StopGpxRecordingParams[] newArray(int size) { + return new StopGpxRecordingParams[size]; + } + }; + + @Override + public void writeToParcel(Parcel out, int flags) { + } + + private void readFromParcel(Parcel in) { + + } + + @Override + public int describeContents() { + return 0; + } +}