diff --git a/OsmAnd/src/net/osmand/aidl/navigation/OnVoiceNavigationParams.java b/OsmAnd/src/net/osmand/aidl/navigation/OnVoiceNavigationParams.java index cdffd45110..63781b1cbe 100644 --- a/OsmAnd/src/net/osmand/aidl/navigation/OnVoiceNavigationParams.java +++ b/OsmAnd/src/net/osmand/aidl/navigation/OnVoiceNavigationParams.java @@ -39,13 +39,13 @@ public class OnVoiceNavigationParams implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - out.writeList(cmds); - out.writeList(played); + out.writeStringList(cmds); + out.writeStringList(played); } private void readFromParcel(Parcel in) { - in.readList(cmds, getClass().getClassLoader()); - in.readList(played, getClass().getClassLoader()); + in.readStringList(cmds); + in.readStringList(played); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index 4ebd3d21ad..e0b73de262 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -123,12 +123,14 @@ public class TransportStopController extends MenuController { private void processTransportStop(List routesOnTheSameExit, List routesNearby) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - List reps = mapActivity.getMyApplication() - .getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(), - transportStop.getLocation().getLongitude()); - - boolean useEnglishNames = mapActivity.getMyApplication().getSettings().usingEnglishNames(); + OsmandApplication app = mapActivity.getMyApplication(); + List reps = app.getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(), + transportStop.getLocation().getLongitude()); + boolean useEnglishNames = app.getSettings().usingEnglishNames(); + if (transportStop.getTransportStopAggregated() == null) { + processTransportStopAggregated(app, transportStop); + } for (TransportIndexRepository t : reps) { if (t.acceptTransportStop(transportStop)) { ArrayList transportStopsSameExit = new ArrayList(transportStop.getLocalTransportStops()); @@ -273,6 +275,19 @@ public class TransportStopController extends MenuController { return null; } + public static void processTransportStopAggregated(OsmandApplication app, TransportStop transportStop) { + TransportStopAggregated stopAggregated = new TransportStopAggregated(); + transportStop.setTransportStopAggregated(stopAggregated); + stopAggregated.addLocalTransportStop(transportStop); + + LatLon loc = transportStop.getLocation(); + List transportStops = findTransportStopsAt(app, loc.getLatitude(), loc.getLongitude(), SHOW_STOPS_RADIUS_METERS); + + for (TransportStop stop : transportStops) { + stopAggregated.addNearbyTransportStop(stop); + } + } + public static TransportStopAggregated processTransportStopsForAmenity(List transportStops, Amenity amenity) { TransportStopAggregated stopAggregated = new TransportStopAggregated(); stopAggregated.setAmenity(amenity); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java index 228cf584be..59c48ff48e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java @@ -1,7 +1,5 @@ package net.osmand.plus.osmedit; -import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH; - import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -10,8 +8,6 @@ import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.Editable; import android.text.InputFilter; -import android.text.InputFilter.LengthFilter; -import android.text.Spanned; import android.text.TextUtils; import android.text.TextWatcher; import android.util.TypedValue; @@ -41,6 +37,8 @@ import java.util.Map; import gnu.trove.list.array.TIntArrayList; +import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH; + public class BasicEditPoiFragment extends BaseOsmAndFragment implements EditPoiDialogFragment.OnFragmentActivatedListener { private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class); @@ -167,6 +165,19 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment mOpeningHoursAdapter.setOpeningHoursRule(item, position); } + public void removeUnsavedOpeningHours() { + EditPoiData data = getData(); + if (data != null) { + OpeningHoursParser.OpeningHours openingHours = OpeningHoursParser.parseOpenedHoursHandleErrors(data.getTagValues() + .get(OSMSettings.OSMTagKey.OPENING_HOURS.getValue())); + if (openingHours == null) { + openingHours = new OpeningHoursParser.OpeningHours(); + } + mOpeningHoursAdapter.replaceOpeningHours(openingHours); + mOpeningHoursAdapter.updateViews(); + } + } + private EditPoiData getData() { Fragment parent = getParentFragment(); if (parent != null && parent instanceof EditPoiDialogFragment) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/OpeningHoursHoursDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/OpeningHoursHoursDialogFragment.java index bdbb0e49c9..08fb4c61d7 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/OpeningHoursHoursDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/OpeningHoursHoursDialogFragment.java @@ -83,7 +83,15 @@ public class OpeningHoursHoursDialogFragment extends DialogFragment { } } }) - .setNegativeButton(R.string.shared_string_cancel, null); + .setNegativeButton(R.string.shared_string_cancel, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + BasicEditPoiFragment editPoiFragment = ((BasicEditPoiFragment) getParentFragment()); + if (editPoiFragment != null) { + editPoiFragment.removeUnsavedOpeningHours(); + } + } + }); int paddingInDp = 18; float density = getActivity().getResources().getDisplayMetrics().density; diff --git a/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java b/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java index 7abe7d56ff..bb2cca52ce 100644 --- a/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java +++ b/OsmAnd/src/net/osmand/plus/voice/CommandBuilder.java @@ -54,7 +54,7 @@ public class CommandBuilder { protected final CommandPlayer commandPlayer; protected boolean alreadyExecuted = false; private List listStruct = new ArrayList(); - private List listCommands = new ArrayList(); + protected List listCommands = new ArrayList(); public CommandBuilder(CommandPlayer commandPlayer){ this.commandPlayer = commandPlayer; @@ -71,7 +71,7 @@ public class CommandBuilder { listStruct.add(struct); listCommands.add(name); for(Object o : args) { - if(o == null) { + if(o != null) { listCommands.add(o.toString()); } else { listCommands.add(""); diff --git a/OsmAnd/src/net/osmand/plus/voice/JSCommandBuilder.java b/OsmAnd/src/net/osmand/plus/voice/JSCommandBuilder.java index 24d4865faa..87e340e8b8 100644 --- a/OsmAnd/src/net/osmand/plus/voice/JSCommandBuilder.java +++ b/OsmAnd/src/net/osmand/plus/voice/JSCommandBuilder.java @@ -13,6 +13,7 @@ import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class JSCommandBuilder extends CommandBuilder { @@ -54,7 +55,15 @@ public class JSCommandBuilder extends CommandBuilder { } private JSCommandBuilder addCommand(String name, Object... args){ - Object obj = jsScope.get(name); + listCommands.add(name); + for(Object o : args) { + if(o != null) { + listCommands.add(o.toString()); + } else { + listCommands.add(""); + } + } + Object obj = jsScope.get(name); if (obj instanceof Function) { Function jsFunction = (Function) obj; Object jsResult = jsFunction.call(jsContext, jsScope, jsScope, args);