From 86cf8de1e9bc5cf1320ddadffdabccda8771c739 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Sun, 25 Oct 2015 16:09:12 +0100 Subject: [PATCH 01/10] Translated using Weblate (Danish) Currently translated at 100.0% (2117 of 2117 strings) --- OsmAnd/res/values-da/phrases.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index c47371ead2..6ee3dd5942 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -2304,7 +2304,7 @@ Historiskperiode: Arkaisk tid Historiskperiode: Jernalderen Historiskperiode: Romerske republik (508 f.kr. - 27 f.kr.) - Historiskperiode: hellenistisk Grækenland + Historiskperiode: Hellenistisk Grækenland Historiskperiode: nye Kongerige (1550-1069 f.kr.) Historiskperiode: mellemste rige (2055 -1650 f.kr.) Historiskperiode: prædynastiske Egypten @@ -2314,7 +2314,7 @@ Historiskperiode: anden mellemliggende periode (1650 – 1550 f.Kr.) "Historiskperiode: tredje mellemliggende periode (1069 - 664 f.Kr.) " Historiskperiode: første persiske periode - Historiskperiode: sene periode (664 -332 f.Kr.) + Historiskperiode: sene periode (664 - 332 f.Kr.) Historiskperiode: anden Persiske periode Historiskperiode: Alexander den Store Historiskperiode: ptolemæiske Egypten (305 f.kr. – 30 f.kr.) @@ -2325,8 +2325,8 @@ Historiskperiode: romersk græsk (146 f.Kr. – 330 e.Kr) Historiskperiode: det romerske Kongerige (753 f.Kr. – 509 f.Kr.) Historiskperiode: Dominatet (285 e.Kr. – 476 e.Kr) - Historiskperiode: landsbybeboer (epoke I, II, 1580 f.Kr. - 133 e.Kr.) - Historiskperiode: urban (epoke III, 133 e.Kr. - 374 e.Kr.) + Historiskperiode: landsbyboere (epoke I, II, 1580 f.Kr. - 133 e.Kr.) + Historiskperiode: bymæssig (epoke III, 133 e.Kr. - 374 e.Kr.) Historiskperiode: klassisk (epoke IV, 374 e.Kr. - 900 e.Kr.) Historiskperiode: imperial (epoke V, 900 e.Kr. - 1200 e.Kr.) From 3c953d048a811f5611d7fa5625d786eb268fbac8 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 25 Oct 2015 19:58:13 +0300 Subject: [PATCH 02/10] Context menu refactoring --- .../mapcontextmenu/BaseMenuController.java | 3 +- .../plus/mapcontextmenu/MapContextMenu.java | 6 +-- .../plus/mapcontextmenu/MenuBuilder.java | 19 +++++++- .../plus/mapcontextmenu/MenuController.java | 15 ++++-- .../details/AmenityMenuBuilder.java | 7 +-- .../details/AmenityMenuController.java | 8 ++-- .../details/FavouritePointMenuBuilder.java | 9 ++-- .../details/FavouritePointMenuController.java | 9 ---- .../details/HistoryMenuBuilder.java | 29 ------------ .../details/HistoryMenuController.java | 12 +---- .../details/MyLocationMenuController.java | 47 +++++++++++++++++++ .../details/ParkingPositionBuilder.java | 26 ---------- .../details/ParkingPositionController.java | 11 +---- .../details/PointDescriptionMenuBuilder.java | 29 ------------ .../PointDescriptionMenuController.java | 16 ++----- .../other/ObjectSelectionMenu.java | 2 +- 16 files changed, 98 insertions(+), 150 deletions(-) delete mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuBuilder.java create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java delete mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionBuilder.java delete mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuBuilder.java diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java index 5ea9bf997f..536a333198 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java @@ -65,7 +65,6 @@ public abstract class BaseMenuController { protected Drawable getIcon(int iconId, int colorLightId, int colorDarkId) { IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache(); - return iconsCache.getIcon(iconId, - isLight() ? colorLightId : colorDarkId); + return iconsCache.getIcon(iconId, isLight() ? colorLightId : colorDarkId); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 1e2801438f..46193bac7e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -125,7 +125,7 @@ public class MapContextMenu extends MenuTitleController { initTitle(); if (menuController != null) { - menuController.addPlainMenuItems(typeStr, this.pointDescription); + menuController.addPlainMenuItems(typeStr, this.pointDescription, this.latLon); } if (mapPosition != 0) { @@ -190,7 +190,7 @@ public class MapContextMenu extends MenuTitleController { } private void acquireMenuController() { - menuController = MenuController.getMenuController(mapActivity, latLon, pointDescription, object); + menuController = MenuController.getMenuController(mapActivity, pointDescription, object); } public void onSingleTapOnMap() { @@ -313,7 +313,7 @@ public class MapContextMenu extends MenuTitleController { acquireIcons(); if (menuController != null) { - menuController.addPlainMenuItems(typeStr, this.pointDescription); + menuController.addPlainMenuItems(typeStr, pointDescription, latLon); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 9a4013848a..aa1cc77a0d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -23,7 +23,7 @@ import java.util.LinkedList; import static android.util.TypedValue.COMPLEX_UNIT_DIP; -public abstract class MenuBuilder { +public class MenuBuilder { public static final float SHADOW_HEIGHT_TOP_DP = 16f; public static final float SHADOW_HEIGHT_BOTTOM_DP = 6f; @@ -59,6 +59,19 @@ public abstract class MenuBuilder { public void build(View view) { firstRow = true; + if (needBuildPlainMenuItems()) { + buildPlainMenuItems(view); + } + } + + protected void buildPlainMenuItems(View view) { + for (PlainMenuItem item : plainMenuItems) { + buildRow(view, item.getIconId(), item.getText(), 0); + } + } + + protected boolean needBuildPlainMenuItems() { + return true; } protected boolean isFirstRow() { @@ -69,6 +82,10 @@ public abstract class MenuBuilder { firstRow = false; } + private void buildRow(View view, int iconId, String text, int textColor) { + buildRow(view, getRowIcon(iconId), text, textColor); + } + protected void buildRow(final View view, Drawable icon, String text, int textColor) { LinearLayout ll = new LinearLayout(view.getContext()); ll.setOrientation(LinearLayout.HORIZONTAL); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 58cc1b433d..c8de77e6c7 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -8,7 +8,6 @@ import net.osmand.data.Amenity; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; -import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -41,7 +40,7 @@ public abstract class MenuController extends BaseMenuController { } public static MenuController getMenuController(MapActivity mapActivity, - LatLon latLon, PointDescription pointDescription, Object object) { + PointDescription pointDescription, Object object) { OsmandApplication app = mapActivity.getMyApplication(); MenuController menuController = null; if (object != null) { @@ -57,7 +56,7 @@ public abstract class MenuController extends BaseMenuController { } } } else { - menuController = new PointDescriptionMenuController(app, mapActivity, pointDescription, latLon); + menuController = new PointDescriptionMenuController(app, mapActivity, pointDescription); } return menuController; } @@ -66,7 +65,15 @@ public abstract class MenuController extends BaseMenuController { builder.addPlainMenuItem(iconId, text); } - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { + public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { + addMyLocationToPlainItems(pointDescription, latLon); + } + + protected void addMyLocationToPlainItems(PointDescription pointDescription, LatLon latLon) { + if (pointDescription != null) { + addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), + latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", "")); + } } public int getInitialMenuState() { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuBuilder.java index 8b98946497..65bfdf7532 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuBuilder.java @@ -119,14 +119,9 @@ public class AmenityMenuBuilder extends MenuBuilder { super.build(view); boolean hasWiki = false; - - for (PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getText(), 0, false); - } - MapPoiTypes poiTypes = app.getPoiTypes(); for (Map.Entry e : amenity.getAdditionalInfo().entrySet()) { - int iconId = 0; + int iconId; Drawable icon = null; int textColor = 0; boolean isWiki = false; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java index bed82d1dab..451491444d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java @@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.details; import android.os.Bundle; import net.osmand.data.Amenity; +import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiType; @@ -74,14 +75,11 @@ public class AmenityMenuController extends MenuController { } @Override - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { + public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { if (!Algorithms.isEmpty(typeStr)) { addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr); } - if (pointDescription != null) { - addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), - amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true).replaceAll("\n", "")); - } + addMyLocationToPlainItems(pointDescription, amenity.getLocation()); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuBuilder.java index 5b2ac02cb3..5c0c6cfdd5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuBuilder.java @@ -21,6 +21,11 @@ public class FavouritePointMenuBuilder extends MenuBuilder { buildRow(view, getRowIcon(iconId), text, textColor); } + @Override + protected boolean needBuildPlainMenuItems() { + return false; + } + @Override public void build(View view) { super.build(view); @@ -29,8 +34,6 @@ public class FavouritePointMenuBuilder extends MenuBuilder { buildRow(view, R.drawable.ic_action_note_dark, fav.getDescription(), 0); } - for (PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getText(), 0); - } + buildPlainMenuItems(view); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java index e4d6f284be..b7f7862865 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java @@ -5,7 +5,6 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import net.osmand.data.FavouritePoint; -import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -79,14 +78,6 @@ public class FavouritePointMenuController extends MenuController { return fav.getName(); } - @Override - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { - if (pointDescription != null) { - addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), - fav.getLatitude(), fav.getLongitude(), true).replaceAll("\n", "")); - } - } - @Override public void saveEntityState(Bundle bundle, String key) { bundle.putSerializable(key, fav); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuBuilder.java deleted file mode 100644 index 1d96351211..0000000000 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.osmand.plus.mapcontextmenu.details; - -import android.view.View; - -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; -import net.osmand.plus.mapcontextmenu.MenuBuilder; - -public class HistoryMenuBuilder extends MenuBuilder { - private final HistoryEntry entry; - - public HistoryMenuBuilder(OsmandApplication app, final HistoryEntry entry) { - super(app); - this.entry = entry; - } - - private void buildRow(View view, int iconId, String text, int textColor) { - buildRow(view, getRowIcon(iconId), text, textColor); - } - - @Override - public void build(View view) { - super.build(view); - - for (PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getText(), 0); - } - } -} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuController.java index 24b1edf6f6..1376c5d110 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/HistoryMenuController.java @@ -3,12 +3,12 @@ package net.osmand.plus.mapcontextmenu.details; import android.graphics.drawable.Drawable; import android.os.Bundle; -import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.search.SearchHistoryFragment; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; +import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; public class HistoryMenuController extends MenuController { @@ -16,7 +16,7 @@ public class HistoryMenuController extends MenuController { private HistoryEntry entry; public HistoryMenuController(OsmandApplication app, MapActivity mapActivity, final HistoryEntry entry) { - super(new HistoryMenuBuilder(app, entry), mapActivity); + super(new MenuBuilder(app), mapActivity); this.entry = entry; } @@ -69,14 +69,6 @@ public class HistoryMenuController extends MenuController { return !entry.getName().isAddress(); } - @Override - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { - if (pointDescription != null) { - addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), - entry.getLat(), entry.getLon(), true).replaceAll("\n", "")); - } - } - @Override public void saveEntityState(Bundle bundle, String key) { bundle.putSerializable(key, entry); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java new file mode 100644 index 0000000000..89cab3ae0a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java @@ -0,0 +1,47 @@ +package net.osmand.plus.mapcontextmenu.details; + +import android.graphics.drawable.Drawable; +import android.os.Bundle; + +import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; +import net.osmand.plus.ApplicationMode; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.search.SearchHistoryFragment; +import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.mapcontextmenu.MenuController; + +public class MyLocationMenuController extends MenuController { + + public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity) { + super(new MenuBuilder(app), mapActivity); + } + + @Override + protected int getInitialMenuStatePortrait() { + return MenuState.HEADER_ONLY; + } + + @Override + protected int getSupportedMenuStatesPortrait() { + return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN; + } + + @Override + public Drawable getLeftIcon() { + ApplicationMode appMode = getMapActivity().getMyApplication().getSettings().getApplicationMode(); + return getMapActivity().getResources().getDrawable(appMode.getResourceLocation()); + } + + @Override + public String getNameStr() { + return getMapActivity().getString(R.string.shared_string_my_location); + } + + @Override + public void saveEntityState(Bundle bundle, String key) { + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionBuilder.java deleted file mode 100644 index 76bcf121c6..0000000000 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.osmand.plus.mapcontextmenu.details; - -import android.view.View; - -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.mapcontextmenu.MenuBuilder; - -public class ParkingPositionBuilder extends MenuBuilder { - - public ParkingPositionBuilder(OsmandApplication app) { - super(app); - } - - private void buildRow(View view, int iconId, String text, int textColor) { - buildRow(view, getRowIcon(iconId), text, textColor); - } - - @Override - public void build(View view) { - super.build(view); - - for (PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getText(), 0); - } - } -} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionController.java index 92f79b33df..8ef8e891e5 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/ParkingPositionController.java @@ -9,6 +9,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.parkingpoint.ParkingPositionPlugin; import net.osmand.util.Algorithms; @@ -21,7 +22,7 @@ public class ParkingPositionController extends MenuController { String parkingDescription = ""; public ParkingPositionController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription, LatLon latLon) { - super(new ParkingPositionBuilder(app), mapActivity); + super(new MenuBuilder(app), mapActivity); this.pointDescription = pointDescription; this.latLon = latLon; plugin = OsmandPlugin.getPlugin(ParkingPositionPlugin.class); @@ -88,14 +89,6 @@ public class ParkingPositionController extends MenuController { return false; } - @Override - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { - if (pointDescription != null) { - addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), - latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", "")); - } - } - @Override public void saveEntityState(Bundle bundle, String key) { bundle.putSerializable(key, latLon); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuBuilder.java deleted file mode 100644 index e20af03aa6..0000000000 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.osmand.plus.mapcontextmenu.details; - -import android.view.View; - -import net.osmand.data.PointDescription; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.mapcontextmenu.MenuBuilder; - -public class PointDescriptionMenuBuilder extends MenuBuilder { - private final PointDescription pointDescription; - - public PointDescriptionMenuBuilder(OsmandApplication app, final PointDescription pointDescription) { - super(app); - this.pointDescription = pointDescription; - } - - private void buildRow(View view, int iconId, String text, int textColor) { - buildRow(view, getRowIcon(iconId), text, textColor); - } - - @Override - public void build(View view) { - super.build(view); - - for (MenuBuilder.PlainMenuItem item : plainMenuItems) { - buildRow(view, item.getIconId(), item.getText(), 0); - } - } -} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuController.java index d9993b6561..370625ebcb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/PointDescriptionMenuController.java @@ -3,23 +3,21 @@ package net.osmand.plus.mapcontextmenu.details; import android.graphics.drawable.Drawable; import android.os.Bundle; -import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.search.SearchHistoryFragment; +import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; public class PointDescriptionMenuController extends MenuController { private PointDescription pointDescription; - private LatLon latLon; - public PointDescriptionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription, LatLon latLon) { - super(new PointDescriptionMenuBuilder(app, pointDescription), mapActivity); + public PointDescriptionMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription) { + super(new MenuBuilder(app), mapActivity); this.pointDescription = pointDescription; - this.latLon = latLon; } @Override @@ -71,14 +69,6 @@ public class PointDescriptionMenuController extends MenuController { return !pointDescription.isAddress(); } - @Override - public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { - if (pointDescription != null) { - addPlainMenuItem(R.drawable.map_my_location, PointDescription.getLocationName(getMapActivity(), - latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", "")); - } - } - @Override public void saveEntityState(Bundle bundle, String key) { } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ObjectSelectionMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ObjectSelectionMenu.java index 016bb76c71..5866f7f1b1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ObjectSelectionMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ObjectSelectionMenu.java @@ -47,7 +47,7 @@ public class ObjectSelectionMenu extends BaseMenuController { } protected void init() { - controller = MenuController.getMenuController(mapActivity, latLon, pointDescription, object); + controller = MenuController.getMenuController(mapActivity, pointDescription, object); initTitle(); } From 9e31b9356144b0092be00f227f4e650936f6b076 Mon Sep 17 00:00:00 2001 From: 8c6311e901274f6baef2068792c8ab Date: Sun, 25 Oct 2015 17:57:10 +0100 Subject: [PATCH 03/10] =?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 73.4% (1304 of 1776 strings) --- OsmAnd/res/values-nb/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 5cddbb85f7..275a49239d 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -91,7 +91,7 @@ Rute blir beregnet når posisjon blir funnet Timer Minutter - Bilen ble parkert her: + Bilen ble parkert Opptegningsmodus Vis koter Øk mengden av kartdetaljer vist From 618765046ea69f9cebfc287f7ef300a7c998dd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Sok=C3=B3=C5=82?= Date: Sun, 25 Oct 2015 17:15:05 +0100 Subject: [PATCH 04/10] Translated using Weblate (Polish) Currently translated at 99.6% (1769 of 1776 strings) --- OsmAnd/res/values-pl/strings.xml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 2a23ee5897..b117d7f66b 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -821,10 +821,10 @@ Europa Europa - Francja Europa - Niemcy - Europa/Azja - Rosja + Rosja Afryka Azja - Oceania + Australia i Oceania Mapy świata i tematyczne Wikipedia dla POI Komunikaty głosowe (nagrane, ograniczone możliwości) @@ -2282,9 +2282,16 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant Proszę aktywuj plugin latarni morskich Proszę aktywuj plugin SRTM Później - Pobierz pełną wersję + Pełna wersja Pobierz Dodaj nową kategorię Nazwa kategorii Taka nazwa kategorii już istnieje. Proszę wybrać inną. + Udostępnij położenie + Wyślij + %.1f MB + Uaktualnij wszystko (%1$s MB) + Wykorzystano darmowe pobrania + Proszę wybrać położenie zapisywania plików map. +%1$.1f z %2$.1f MB From f9d6b4de57680ec5d82e6cade2ed91e72d450055 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 25 Oct 2015 21:20:48 +0300 Subject: [PATCH 05/10] Added my location to context menu --- .../src/net/osmand/data/PointDescription.java | 5 ++ .../plus/mapcontextmenu/MenuController.java | 3 + .../details/MyLocationMenuController.java | 13 ++-- .../osmand/plus/views/PointLocationLayer.java | 67 +++++++++++++++++-- 4 files changed, 77 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/data/PointDescription.java b/OsmAnd/src/net/osmand/data/PointDescription.java index ff8459ee7a..0b1eaca61b 100644 --- a/OsmAnd/src/net/osmand/data/PointDescription.java +++ b/OsmAnd/src/net/osmand/data/PointDescription.java @@ -37,6 +37,7 @@ public class PointDescription implements Serializable { public static final String POINT_TYPE_VIDEO_NOTE = "videonote"; public static final String POINT_TYPE_PHOTO_NOTE = "photonote"; public static final String POINT_TYPE_LOCATION = "location"; + public static final String POINT_TYPE_MY_LOCATION = "my_location"; public static final String POINT_TYPE_ALARM = "alarm"; public static final String POINT_TYPE_TARGET = "destination"; public static final String POINT_TYPE_OSM_BUG = "bug"; @@ -188,6 +189,10 @@ public class PointDescription implements Serializable { return POINT_TYPE_PARKING_MARKER.equals(type); } + public boolean isMyLocation() { + return POINT_TYPE_MY_LOCATION.equals(type); + } + @Override public int hashCode() { final int prime = 31; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index c8de77e6c7..1fda77762f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -15,6 +15,7 @@ import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.mapcontextmenu.details.AmenityMenuController; import net.osmand.plus.mapcontextmenu.details.FavouritePointMenuController; import net.osmand.plus.mapcontextmenu.details.HistoryMenuController; +import net.osmand.plus.mapcontextmenu.details.MyLocationMenuController; import net.osmand.plus.mapcontextmenu.details.ParkingPositionController; import net.osmand.plus.mapcontextmenu.details.PointDescriptionMenuController; @@ -53,6 +54,8 @@ public abstract class MenuController extends BaseMenuController { } else if (object instanceof LatLon) { if (pointDescription.isParking()) { menuController = new ParkingPositionController(app, mapActivity, pointDescription, (LatLon) object); + } else if (pointDescription.isMyLocation()) { + menuController = new MyLocationMenuController(app, mapActivity, pointDescription, (LatLon) object); } } } else { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java index 89cab3ae0a..75b86b388b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MyLocationMenuController.java @@ -7,17 +7,19 @@ import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandSettings; -import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.search.SearchHistoryFragment; import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; public class MyLocationMenuController extends MenuController { - public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity) { + private LatLon latLon; + private PointDescription pointDescription; + + public MyLocationMenuController(OsmandApplication app, MapActivity mapActivity, final PointDescription pointDescription, LatLon latLon) { super(new MenuBuilder(app), mapActivity); + this.pointDescription = pointDescription; + this.latLon = latLon; } @Override @@ -38,10 +40,11 @@ public class MyLocationMenuController extends MenuController { @Override public String getNameStr() { - return getMapActivity().getString(R.string.shared_string_my_location); + return pointDescription.getTypeName(); } @Override public void saveEntityState(Bundle bundle, String key) { + bundle.putSerializable(key, latLon); } } diff --git a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java index eb0786a0ee..8cd21bd5a4 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java @@ -2,6 +2,8 @@ package net.osmand.plus.views; import net.osmand.Location; +import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; import net.osmand.data.RotatedTileBox; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmAndLocationProvider; @@ -12,9 +14,12 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Style; +import android.graphics.PointF; import android.graphics.RectF; -public class PointLocationLayer extends OsmandMapLayer { +import java.util.List; + +public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider { protected final static int RADIUS = 7; protected final static float HEADING_ANGLE = 60; @@ -124,11 +129,8 @@ public class PointLocationLayer extends OsmandMapLayer { } } - public boolean isLocationVisible(RotatedTileBox tb, Location l){ - if(l == null ){ - return false; - } - return tb.containsLatLon(l.getLatitude(), l.getLongitude()); + public boolean isLocationVisible(RotatedTileBox tb, Location l) { + return l != null && tb.containsLatLon(l.getLatitude(), l.getLongitude()); } @@ -150,4 +152,57 @@ public class PointLocationLayer extends OsmandMapLayer { } + @Override + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + getMyLocationFromPoint(tileBox, point, o); + } + + @Override + public LatLon getObjectLocation(Object o) { + return getMyLocation(); + } + + @Override + public String getObjectDescription(Object o) { + return view.getResources().getString(R.string.shared_string_my_location); + } + + @Override + public PointDescription getObjectName(Object o) { + return new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION, + view.getContext().getString(R.string.shared_string_my_location), ""); + } + + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + + private LatLon getMyLocation() { + Location location = locationProvider.getLastKnownLocation(); + if (location != null) { + return new LatLon(location.getLatitude(), location.getLongitude()); + } else { + return null; + } + } + + private void getMyLocationFromPoint(RotatedTileBox tb, PointF point, List myLocation) { + LatLon location = getMyLocation(); + if (location != null && view != null) { + int ex = (int) point.x; + int ey = (int) point.y; + int x = (int) tb.getPixXFromLatLon(location.getLatitude(), location.getLongitude()); + int y = (int) tb.getPixYFromLatLon(location.getLatitude(), location.getLongitude()); + int rad = (int) (18 * tb.getDensity()); + if (Math.abs(x - ex) <= rad && (ey - y) <= rad && (y - ey) <= 2.5 * rad) { + myLocation.add(location); + } + } + } } From 3a33ff932f0d2566ea387ed995485d36007ecf4e Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Sun, 25 Oct 2015 19:14:32 +0100 Subject: [PATCH 06/10] Translated using Weblate (Sardinian) Currently translated at 61.8% (1309 of 2117 strings) --- OsmAnd/res/values-sc/phrases.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OsmAnd/res/values-sc/phrases.xml b/OsmAnd/res/values-sc/phrases.xml index e24f829a01..19ab90aa94 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -1401,4 +1401,16 @@ Obeliscu Colunna Stupa + Casta: campusantu de gherra + Casta: tùmulu + Casta: rupestre (iscavada in sa roca) + Casta: conchedda + Casta: tumba a bòveda + Casta: columbàriu + Casta: mausoleu + Casta: sarcòfagu + Casta: cripta + Casta: piràmide + + Iscalas From 0b1eb5de5801b4bf68bab93a5ea79de8dd056ea4 Mon Sep 17 00:00:00 2001 From: josep constanti Date: Sun, 25 Oct 2015 21:16:13 +0100 Subject: [PATCH 07/10] Translated using Weblate (Catalan) Currently translated at 100.0% (1776 of 1776 strings) --- OsmAnd/res/values-ca/strings.xml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 04778aa61e..201d734284 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -32,7 +32,7 @@ La navegació anterior no ha estat finalitzada. Desitgeu continuar-la? (%1$s segons) Hores Minuts -El cotxe es va aparcar a: +El cotxe es va aparcar a Usa la brúixola quan no es pugui determinar la direcció Usa la brúixola Localització compartida @@ -2164,7 +2164,7 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu Mapes del món Regions del món Mes tard - Obteniu la versió completa + Versió completa Baixades Activeu el connector de cartes marines Activeu el connector de corbes de nivell @@ -2177,4 +2177,11 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu Actualitzeu tot (%1$s MB) Baixades gratuïtes realitzades Podeu veure quantes baixades gratuïtes heu fet +Restaura el senyalitzador de primera engegada, mantenint altres paràmetres en l\'estat original + Simula engegada inicial + geo: + Comparteix la posició + Envia + Hola fragment buit + Trieu on voleu desar els fitxers de mapes. From f87f5153c0c1113fffea7a091e6b08b3b48f71d8 Mon Sep 17 00:00:00 2001 From: xmd5a Date: Sun, 25 Oct 2015 23:29:02 +0300 Subject: [PATCH 08/10] Update phrases --- OsmAnd/res/values-ru/phrases.xml | 59 +++++++++++++++++++++++++++++- OsmAnd/res/values/phrases.xml | 63 +++++++++++++++++++++++++++++--- 2 files changed, 115 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 8967e446cb..12ecd8020d 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -44,7 +44,7 @@ Ксерокопия, полиграфия Шторы, портьеры Ткани - Постельное бельё + Снаряжение для дайвинга Инструменты и стройматериалы Двери @@ -863,7 +863,7 @@ Жилой район Религиозное землепользование - Достопримечательность (тип неизвестен) + Парк атракционов Лесной домик Охотничий домик @@ -2278,4 +2278,59 @@ Исторический период: классический (период IV, 374 – 900 г. н.э.) Исторический период: имперский (период V, 900 – 1200 г. н.э.) + Эра: палеолит (2.6 млн. лет до н.э. – 10000 лет до н.э.) + Эра: мезолит + Эра: неолит + Эра: халколит (медный век) (IV—III тысячелетия до н.э.) + + Исторический камень + Тип: примирительный крест + Тип: герб + + Материал: дерево + Материал: металл + Материал: железобетон + Материал: бетон + Материал: сталь + Материал: камень + Материал: каменная кладка + Материал: кирпич + Материал: пластик + Материал: песчаник + Материал: гранит + Материал: металл, дерево + Материал: стекло + Материал: бронза + Материал: земля + Материал: составной + Материал: известняк + Материал: мрамор + Материал: алюминий + + Тип: мегалит + Тип: тумулус + Тип: укрепление + Тип: поселение + Тип: город + Тип: круг из хижин + Тип: некрополь + Тип: петроглиф + Тип: земляное укрепление + Тип мегалита: менгир + Тип мегалита: дольмен + Тип мегалита: нураги + Тип мегалита: каменный круг + Тип мегалита: коридорная гробница + Тип укрепления: городище + Тип укрепления: лимес + Тип укрепления: шанец + Тип укрепления: рондела (кольцевая канава) + + Па (укреплённое поселение маори) + + Историческая ферма + Историческая железнодорожная станция + + Туристический объект + \ No newline at end of file diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 5c78462053..38ce22ab3c 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -78,7 +78,7 @@ Baby goods Bag shop Bathroom furnishings - Bed room furnishings + Bedding store Fashion boutique Cameras and lenses Carpet shop @@ -92,7 +92,7 @@ Copy shop Curtain shop Drapery shop - Bedding store + Diving equipment Home improvement store Doors @@ -606,8 +606,8 @@ Theme park Tourist attraction - Tourist attraction - General tourist attraction + + Touristic object Amusement ride Animal (attraction) Ferris wheel @@ -723,7 +723,7 @@ Internet access: no Monastery - Historic monastery + Religious area Wayside cross Wayside shrine @@ -2284,4 +2284,57 @@ Historic period: classical (epoch IV, 374 AC – 900 AC) Historic period: imperial (epoch V, 900 AC – 1200 AC) + Historic era: paleolithic (2.6 million years – 10000 BP) + Historic era: mesolithic + Historic era: neolithic + Historic era: chalcolithic (IV-III millennium BC.) + + Historic stone + Type: conciliation cross + Type: coat of arms + + Material: wood + Material: metal + Material: reinforced concrete + Material: concrete + Material: steel + Material: stone + Material: masonry + Material: brick + Material: plastic + Material: sandstone + Material: granite stone + Material: metal;wood + Material: glass + Material: bronze + Material: earth + Material: composite + Material: limestone + Material: marble + Material: aluminium + + Type: megalith + Type: tumulus + Type: fortification + Type: settlement + Type: city + Type: hut circle + Type: necropolis + Type: petroglyph + Type: earthwork + Megalith type: menhir + Megalith type: dolmen + Megalith type: nuraghe + Megalith type: stone circle + Megalith type: passage grave + Fortification type: hill fort + Fortification type: limes + Fortification type: sconce + Fortification type: ring ditch + + Pa (maori fortified settlement) + + Historic farm + Historic railway station + From 965ce2177bf5e0ff53d42cf2a73db42e9e223836 Mon Sep 17 00:00:00 2001 From: josep constanti Date: Sun, 25 Oct 2015 21:29:28 +0100 Subject: [PATCH 09/10] Translated using Weblate (Catalan) Currently translated at 62.3% (1321 of 2117 strings) --- OsmAnd/res/values-ca/phrases.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OsmAnd/res/values-ca/phrases.xml b/OsmAnd/res/values-ca/phrases.xml index 1c7e0b00c3..819387bc3e 100644 --- a/OsmAnd/res/values-ca/phrases.xml +++ b/OsmAnd/res/values-ca/phrases.xml @@ -1409,4 +1409,22 @@ Tipus: excavació a la roca Tipus: subterrani Tipus: volta + Nectariner + Mango + Data + Café + Refugi d\'animals + Cobert + Descobert + + Prohibit fumar + Només es permet fumar a l\'exterior + Es permet fumar + Es permet fumar a una sala separada + Es permet fumar a una sala aïllada + Exclusiu per fumadors + + Peatge + Sense peatge + Peatge de vehicles pesants From db7d3bc1fbc8e73efc51ca1bc188799356548d81 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Sun, 25 Oct 2015 21:52:31 +0100 Subject: [PATCH 10/10] Translated using Weblate (Danish) Currently translated at 100.0% (2161 of 2161 strings) --- OsmAnd/res/values-da/phrases.xml | 56 +++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index 6ee3dd5942..c1d5dd8d09 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -25,7 +25,7 @@ Babyudstryr Tasker Badeværelsesinventar - Soveværelsesmøbler + sengetøjsbutik Modebutik Tæpper Materialist @@ -2330,4 +2330,58 @@ Historiskperiode: klassisk (epoke IV, 374 e.Kr. - 900 e.Kr.) Historiskperiode: imperial (epoke V, 900 e.Kr. - 1200 e.Kr.) +Turistmæssige objekt + Historisk æra: Palæolitisk (2,6 millioner år-10000 BP) + Historisk æra: Mesolitikum + Historisk æra: neolitiske + Historisk æra: kalkolitiske (IV-III årtusinde f.Kr.) + + Historisk sten + Type: forlig cross + Type: coat of arms + + Materiale: træ + Materiale: metal + Materiale: armeret beton + Materiale: beton + Materiale: stål + Materiale: sten + Materiale: murværk + Materiale: mursten + Materiale: plastik + Materiale: sandsten + Materiale: granitsten + Materiale: metal, træ + Materiale: glas + Materiale: bronze + Materiale: jord + Materiale: composit + Materiale: kalksten + Materiale: marmor + Materiale: aluminium + + Type: megalith + Type: gravhøj + Type: befæstning + Type: afregning + Type: by + Type: hyttecirkel + Type: necropolis + Type: petroglyph + Type: jordvold + Megalith type: bautasten + Megalith type: dolmen + Megalith type: nuraghe + Megalith type: sten cirkel + Megalith type: jættestue + Befæstning type: hill fort + Befæstning type: kalk + Befæstning type: sconce + Befæstning type: ring grøft + + Pa (maori befæstet bosættelse) + + Historisk gård + Historisk jernbanestation +