From c823231d7e832e9f39424ccac6df9d9c1418e160 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Wed, 8 Jan 2020 16:17:31 +0200 Subject: [PATCH] Add address extension to gpx --- OsmAnd/src/net/osmand/data/FavouritePoint.java | 5 +++++ .../net/osmand/plus/activities/FavoritesTreeFragment.java | 6 +----- .../plus/routepreparationmenu/cards/HomeWorkCard.java | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/data/FavouritePoint.java b/OsmAnd/src/net/osmand/data/FavouritePoint.java index e8693f9a3e..e514bf97ac 100644 --- a/OsmAnd/src/net/osmand/data/FavouritePoint.java +++ b/OsmAnd/src/net/osmand/data/FavouritePoint.java @@ -17,6 +17,7 @@ public class FavouritePoint implements Serializable, LocationPoint { private static final long serialVersionUID = 729654300829771466L; private static final String HIDDEN = "hidden"; + private static final String ADDRESS_EXTENSION = "address"; @@ -294,6 +295,7 @@ public class FavouritePoint implements Serializable, LocationPoint { } fp.setColor(pt.getColor(0)); fp.setVisible(!pt.getExtensionsToRead().containsKey(HIDDEN)); + fp.setAddress(pt.getExtensionsToRead().get(ADDRESS_EXTENSION)); return fp; } @@ -304,6 +306,9 @@ public class FavouritePoint implements Serializable, LocationPoint { if (!isVisible()) { pt.getExtensionsToWrite().put(HIDDEN, "true"); } + if (isAddressSpecified()) { + pt.getExtensionsToWrite().put(ADDRESS_EXTENSION, getAddress()); + } if (getColor() != 0) { pt.setColor(getColor()); } diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 885abef02a..a069e938bb 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -44,7 +44,6 @@ import net.osmand.plus.FavouritesDbHelper.FavoritesListener; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.FavoriteImageDrawable; @@ -53,7 +52,6 @@ import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.myplaces.FavoritesFragmentStateHolder; -import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -953,9 +951,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen name.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor)); distanceText.setText(distance); if (model.isAddressSpecified()) { - String distanceWithAddress = String.format(getString(R.string.distance_and_address), distance.trim(), - model.getDescription() != null ? model.getDescription() : ""); - distanceText.setText(distanceWithAddress); + distanceText.setText(String.format(getString(R.string.distance_and_address), distance.trim(), model.getAddress())); } icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), visible ? model.getColor() : getResources().getColor(disabledIconColor), false, model)); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/HomeWorkCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/HomeWorkCard.java index f89db9d4cf..da4dd2f1c6 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/HomeWorkCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/HomeWorkCard.java @@ -32,8 +32,8 @@ public class HomeWorkCard extends BaseCard { TextView homeDescr = view.findViewById(R.id.home_button_descr); final TextView workDescr = view.findViewById(R.id.work_button_descr); - homeDescr.setText(homePoint != null ? homePoint.getDescription() : mapActivity.getString(R.string.shared_string_add)); - workDescr.setText(workPoint != null ? workPoint.getDescription() : mapActivity.getString(R.string.shared_string_add)); + homeDescr.setText(homePoint != null ? homePoint.getAddress() : mapActivity.getString(R.string.shared_string_add)); + workDescr.setText(workPoint != null ? workPoint.getAddress() : mapActivity.getString(R.string.shared_string_add)); View homeButton = view.findViewById(R.id.home_button); homeButton.setOnClickListener(new View.OnClickListener() {