diff --git a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml index d41fa844ce..fad749c4e5 100644 --- a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml +++ b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="?attr/bottom_menu_view_bg" - tools:context="net.osmand.plus.download.ui.DataStoragePlaceDialogFragment"> + tools:context="net.osmand.plus.download.ui.popups.DataStoragePlaceDialogFragment"> Historisk jernbane - +Bading: nei + +Temperatur + Bading: ja + diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 80aa4cc724..9e7b5e9095 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -1433,15 +1433,15 @@ Nylige steder Vellykket lagret: %1$s Ny versjon - Begynn med OsmAnd + Første steg med OsmAnd Funksjoner Hjelp oss å forbedre OsmAnd Programtillegg Første bruk - Hvordan laste ned kart, grunnleggende innstillinger + Hvordan laste ned kart, angi grunnleggende innstillinger Hvordan bruke programtillegg Kartvisning - Søk på kartet + Kartsøking Kart med koter og relieffskygger OsmAnd skikart Sjøkart @@ -1449,4 +1449,5 @@ OSM-redigering Versjoner Kontakt oss - +Planlegge en tur + diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index f4a5dce53e..cf0c11a5b6 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -36,11 +36,11 @@ import net.osmand.plus.activities.TabActivity; import net.osmand.plus.base.BasicProgressAsyncTask; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment; -import net.osmand.plus.download.ui.DataStoragePlaceDialogFragment; +import net.osmand.plus.download.ui.popups.DataStoragePlaceDialogFragment; import net.osmand.plus.download.ui.LocalIndexesFragment; import net.osmand.plus.download.ui.UpdatesIndexFragment; import net.osmand.plus.download.ui.popups.AskMapDownloadFragment; -import net.osmand.plus.download.ui.popups.DownloadResourceGroupFragment; +import net.osmand.plus.download.ui.DownloadResourceGroupFragment; import net.osmand.plus.download.ui.popups.GoToMapFragment; import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; import net.osmand.plus.srtmplugin.SRTMPlugin; diff --git a/OsmAnd/src/net/osmand/plus/download/ui/popups/DownloadResourceGroupFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java similarity index 98% rename from OsmAnd/src/net/osmand/plus/download/ui/popups/DownloadResourceGroupFragment.java rename to OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java index 3c2699ea07..dae31b7939 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/popups/DownloadResourceGroupFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java @@ -1,4 +1,4 @@ -package net.osmand.plus.download.ui.popups; +package net.osmand.plus.download.ui; import android.content.res.Resources; import android.graphics.drawable.Drawable; @@ -31,8 +31,6 @@ import net.osmand.plus.download.DownloadResourceGroup; import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType; import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.IndexItem; -import net.osmand.plus.download.ui.ItemViewHolder; -import net.osmand.plus.download.ui.SearchDialogFragment; import net.osmand.util.Algorithms; import java.util.ArrayList; diff --git a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java index 1ba98c7728..1fc18ae165 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java @@ -33,7 +33,6 @@ import net.osmand.plus.download.DownloadResourceGroup; import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType; import net.osmand.plus.download.DownloadResources; import net.osmand.plus.download.IndexItem; -import net.osmand.plus.download.ui.popups.DownloadResourceGroupFragment; import net.osmand.util.Algorithms; import java.util.ArrayList; diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/popups/DataStoragePlaceDialogFragment.java similarity index 99% rename from OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java rename to OsmAnd/src/net/osmand/plus/download/ui/popups/DataStoragePlaceDialogFragment.java index b6abe32cce..87da39700e 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/popups/DataStoragePlaceDialogFragment.java @@ -1,4 +1,4 @@ -package net.osmand.plus.download.ui; +package net.osmand.plus.download.ui.popups; import android.app.Activity; import android.app.Dialog; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 087fe06f7b..776848b020 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -7,6 +7,8 @@ import net.osmand.data.Amenity; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; +import net.osmand.plus.GPXUtilities; +import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; @@ -23,6 +25,7 @@ import net.osmand.plus.mapcontextmenu.controllers.ParkingPositionMenuController; import net.osmand.plus.mapcontextmenu.controllers.PointDescriptionMenuController; import net.osmand.plus.mapcontextmenu.controllers.AudioVideoNoteMenuController; import net.osmand.plus.mapcontextmenu.controllers.TargetPointMenuController; +import net.osmand.plus.mapcontextmenu.controllers.WptPtMenuController; import net.osmand.plus.mapcontextmenu.other.ShareMenu; import net.osmand.plus.osmedit.OsmPoint; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; @@ -99,6 +102,8 @@ public abstract class MenuController extends BaseMenuController { menuController = new AudioVideoNoteMenuController(app, mapActivity, (Recording) object); } else if (object instanceof OsmPoint) { menuController = new EditPOIMenuController(app, mapActivity, pointDescription, (OsmPoint) object); + } else if (object instanceof WptPt) { + menuController = new WptPtMenuController(app, mapActivity, (WptPt) object); } else if (object instanceof LatLon) { if (pointDescription.isParking()) { menuController = new ParkingPositionMenuController(app, mapActivity, pointDescription); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java new file mode 100644 index 0000000000..b327192c76 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java @@ -0,0 +1,36 @@ +package net.osmand.plus.mapcontextmenu.builders; + +import android.view.View; + +import net.osmand.plus.GPXUtilities.WptPt; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.util.Algorithms; + +public class WptPtMenuBuilder extends MenuBuilder { + + private final WptPt wpt; + + public WptPtMenuBuilder(OsmandApplication app, final WptPt wpt) { + super(app); + this.wpt = wpt; + } + + @Override + protected boolean needBuildPlainMenuItems() { + return false; + } + + @Override + public void build(View view) { + super.build(view); + + if (!Algorithms.isEmpty(wpt.desc)) { + buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0); + } + + buildPlainMenuItems(view); + } +} + diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java new file mode 100644 index 0000000000..c454d173e6 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java @@ -0,0 +1,77 @@ +package net.osmand.plus.mapcontextmenu.controllers; + +import android.graphics.drawable.Drawable; + +import net.osmand.plus.GPXUtilities.WptPt; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.base.FavoriteImageDrawable; +import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder; +import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder; +import net.osmand.util.Algorithms; + +public class WptPtMenuController extends MenuController { + + private WptPt wpt; + + public WptPtMenuController(OsmandApplication app, MapActivity mapActivity, final WptPt wpt) { + super(new WptPtMenuBuilder(app, wpt), mapActivity); + this.wpt = wpt; + } + + @Override + protected int getSupportedMenuStatesPortrait() { + return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN; + } + +/* + @Override + public boolean handleSingleTapOnMap() { + Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(FavoritePointEditor.TAG); + if (fragment != null) { + ((FavoritePointEditorFragment)fragment).dismiss(); + return true; + } + return false; + } +*/ + + @Override + public boolean needStreetName() { + return false; + } + + @Override + public boolean needTypeStr() { + return true; + } + + @Override + public Drawable getLeftIcon() { + return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), wpt.getColor(), 0); + } + + @Override + public Drawable getSecondLineIcon() { + return getIcon(R.drawable.ic_small_group); + } + +/* + @Override + public int getFavActionIconId() { + return R.drawable.ic_action_edit_dark; + } +*/ + + @Override + public String getTypeStr() { + return wpt.category != null ? wpt.category : getMapActivity().getString(R.string.shared_string_none); + } + + @Override + public String getNameStr() { + return wpt.name != null ? wpt.name : getMapActivity().getString(R.string.gpx_wpt); + } +} diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 026e3d443c..02f58a814d 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -261,6 +261,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { } addOrRemoveParkingEvent(false); setParkingPosition(mapActivity, latitude, longitude, false); + showContextMenuIfNeeded(mapActivity); mapActivity.getMapView().refreshMap(); } }); @@ -268,7 +269,17 @@ public class ParkingPositionPlugin extends OsmandPlugin { choose.show(); } - + + private void showContextMenuIfNeeded(final MapActivity mapActivity) { + if (parkingLayer != null) { + MapContextMenu menu = mapActivity.getContextMenu(); + if (menu.isVisible()) { + menu.show(new LatLon(parkingPosition.getLatitude(), parkingPosition.getLongitude()), + parkingLayer.getObjectName(parkingPosition), parkingPosition); + } + } + } + /** * Method creates confirmation dialog for deletion of a parking location. */ @@ -361,6 +372,7 @@ public class ParkingPositionPlugin extends OsmandPlugin { } else { addOrRemoveParkingEvent(false); } + showContextMenuIfNeeded(mapActivity); } }); setTime.create(); @@ -412,10 +424,6 @@ public class ParkingPositionPlugin extends OsmandPlugin { setParkingType(isLimited); setParkingStartTime(Calendar.getInstance().getTimeInMillis()); if (parkingLayer != null) { - MapContextMenu menu = mapActivity.getContextMenu(); - if (menu.isVisible()) { - menu.show(new LatLon(latitude, longitude), parkingLayer.getObjectName(parkingPosition), parkingPosition); - } parkingLayer.refresh(); } }