From 5a25ad165cdbf394067e250e2f81dac82a289967 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 1 Nov 2015 18:29:10 +0300 Subject: [PATCH 1/4] Fixed bug with wrong time left in context menu when adding parking --- .../plus/mapcontextmenu/MenuController.java | 5 ++ .../builders/WptPtMenuBuilder.java | 36 +++++++++ .../controllers/WptPtMenuController.java | 77 +++++++++++++++++++ .../parkingpoint/ParkingPositionPlugin.java | 18 +++-- 4 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java 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(); } } From c7402109fce3a13820d467c7caf84e90b7e69f4d Mon Sep 17 00:00:00 2001 From: 8c6311e901274f6baef2068792c8ab Date: Sun, 1 Nov 2015 15:16:45 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 74.4% (1346 of 1809 strings) --- OsmAnd/res/values-nb/strings.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 + From 857ae7efa50422ae78d59d7896eeedae0d9d9a4d Mon Sep 17 00:00:00 2001 From: 8c6311e901274f6baef2068792c8ab Date: Sun, 1 Nov 2015 15:34:38 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 8.9% (197 of 2190 strings) --- OsmAnd/res/values-nb/phrases.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nb/phrases.xml b/OsmAnd/res/values-nb/phrases.xml index 5de29e142b..dfbb31a0be 100644 --- a/OsmAnd/res/values-nb/phrases.xml +++ b/OsmAnd/res/values-nb/phrases.xml @@ -208,4 +208,8 @@ Historisk jernbane - +Bading: nei + +Temperatur + Bading: ja + From 40ce8a59b829dfe68f06c6ee0a175ad262880679 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 1 Nov 2015 18:52:08 +0300 Subject: [PATCH 4/4] Fix classes location --- OsmAnd/res/layout/fragment_data_storage_place_dialog.xml | 2 +- OsmAnd/src/net/osmand/plus/download/DownloadActivity.java | 4 ++-- .../ui/{popups => }/DownloadResourceGroupFragment.java | 4 +--- .../src/net/osmand/plus/download/ui/SearchDialogFragment.java | 1 - .../ui/{ => popups}/DataStoragePlaceDialogFragment.java | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) rename OsmAnd/src/net/osmand/plus/download/ui/{popups => }/DownloadResourceGroupFragment.java (98%) rename OsmAnd/src/net/osmand/plus/download/ui/{ => popups}/DataStoragePlaceDialogFragment.java (99%) 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">