This commit is contained in:
GaidamakUA 2015-09-07 13:01:13 +03:00
commit 4577a4585c
18 changed files with 184 additions and 92 deletions

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bottom_shadow" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bottom_shadow" />
</item>
<item>
<shape>
<solid
android:color="@color/bg_color_light" />
</shape>
</item>
</layer-list>

View file

@ -25,14 +25,13 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@android:color/white"
android:background="?attr/bg_map_context_menu"
android:orientation="vertical">
<LinearLayout
android:id="@+id/context_menu_top_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="horizontal">
<LinearLayout
@ -43,12 +42,12 @@
<ImageView
android:id="@+id/context_menu_icon_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="14dp"
android:layout_marginLeft="14dp"
android:tint="@color/color_unknown"
android:scaleType="center"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
@ -68,6 +67,7 @@
android:layout_marginRight="12dp"
android:text="@string/search_address_building"
android:textSize="@dimen/default_list_text_size_large"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"/>
<TextView
@ -78,7 +78,7 @@
android:layout_marginRight="12dp"
android:layout_marginTop="3dp"
android:text="@string/other_location"
android:textColor="@color/secondary_text_disabled_material_light"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"/>
@ -107,8 +107,7 @@
android:layout_weight="1"
android:scaleType="center"
android:background="?attr/dashboard_button"
android:src="@drawable/map_directions"
android:tint="@color/actionbar_dark_color"/>
android:src="@drawable/map_directions"/>
<View
android:layout_width="1px"
@ -123,8 +122,7 @@
android:layout_weight="1"
android:scaleType="center"
android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_fav_dark"
android:tint="@color/actionbar_dark_color"/>
android:src="@drawable/ic_action_fav_dark"/>
<View
android:layout_width="1px"
@ -139,8 +137,7 @@
android:layout_weight="1"
android:scaleType="center"
android:background="?attr/dashboard_button"
android:src="@drawable/abc_ic_menu_share_mtrl_alpha"
android:tint="@color/actionbar_dark_color"/>
android:src="@drawable/abc_ic_menu_share_mtrl_alpha"/>
<View
android:layout_width="1px"
@ -155,8 +152,7 @@
android:layout_weight="1"
android:scaleType="center"
android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_core_overflow_dark"
android:tint="@color/actionbar_dark_color"/>
android:src="@drawable/ic_action_core_overflow_dark"/>
</LinearLayout>
</LinearLayout>

View file

@ -1139,4 +1139,6 @@
<string name="poi_denomination_maronite">Maronita</string>
<string name="poi_denomination_mahayana">Budisme mahayana</string>
<string name="poi_landfill_waste_nuclear">Residus radioactius</string>
<string name="poi_brownfield">Camp per rehabilitar</string>
</resources>

View file

@ -1165,14 +1165,14 @@
<string name="poi_content_sewage">Spildevand (indhold)</string>
<string name="poi_content_gas">Gas (indhold)</string>
<string name="poi_content_biomass">Biomasse (indhold)</string>
<string name="poi_content_wastewater">Spildevand (indhold)</string>
<string name="poi_content_wastewater">Afløbsvand (indhold)</string>
<string name="poi_content_crop">Afgrøde (indhold)</string>
<string name="poi_content_fodder">Foder (indhold)</string>
<string name="poi_content_beer">Øl (indhold)</string>
<string name="poi_content_salt">Salt (indhold)</string>
<string name="poi_content_grain">Korn (indhold)</string>
<string name="poi_bunker_silo">Bunker silo</string>
<string name="poi_bunker_silo">Plansilo</string>
<string name="poi_brownfield">Forladt industrigrund</string>
<string name="poi_greenfield">Byggemodning</string>
</resources>

View file

@ -72,7 +72,7 @@
<string name="poi_boutique">Boutique de moda</string>
<string name="poi_carpet">Alfombras</string>
<string name="poi_charity">Negocio benéfico</string>
<string name="poi_chemist">Perfumería</string>
<string name="poi_chemist">Higiene personal</string>
<string name="poi_clothes">Negocio de ropa</string>
<string name="poi_child_clothes">Ropa infantil</string>
<string name="poi_shoes">Zapatería</string>
@ -92,7 +92,7 @@
<string name="poi_gas">Gas líquido</string>
<string name="poi_general">Pulpería</string>
<string name="poi_gift">Regalería</string>
<string name="poi_glaziery">Cristalería</string>
<string name="poi_glaziery">Vidriería</string>
<string name="poi_hardware">Ferretería</string>
<string name="poi_hearing_aids">Audífonos</string>
<string name="poi_herbalist">Herboristería</string>
@ -861,7 +861,7 @@
<string name="poi_furnace">Artículos de calefacción</string>
<string name="poi_garden_furniture">Almacén de jardinería</string>
<string name="poi_leather">Marroquinería</string>
<string name="poi_tyres">Gomería</string>
<string name="poi_tyres">Neumáticos</string>
<string name="poi_watches">Relojería (watches)</string>
<string name="poi_games">Juegos</string>
<string name="poi_model">Modelos a escala</string>

View file

@ -517,14 +517,14 @@
\n\nPuede elegir \'Iniciar Navegación\', lo que implica que OsmAnd te guiará, te dará indicaciones vocales (si están activas), etc. O puede elegir \'Mostrar ruta\', y solamente mostrará la ruta, sin indicaciones ni reajustes según se mueva.
\n\nPara mostrar una ruta al destino desde cualquier punto diferente de la posición actual, selecciónelo posteriormente en el mapa y pulsa \'Ir desde\'.
\n\nSi usa \'Ir desde\' y luego \'Iniciar Navegación\', OsmAnd cambiará a su ubicación actual tan pronto como la conozca (por lo que se puede usar para iniciar la ruta antes de conocer la ubicación real). Por otro lado, \'Ir desde\' y \'Mostrar ruta\' no realizará actualizaciones de la ruta mostrada. "</string>
<string name="tip_search_t">"Puede buscar lugares directamente en el mapa vía \'Usar ubicación\'→\'Buscar cerca de aquí\', o mediante la pantalla de búsqueda vía \'Menú\'→\'Buscar\'.
<string name="tip_search_t">"Puede buscar lugares directamente en el mapa vía \'Usar ubicación\'→\'Buscar cerca\', o mediante la pantalla de búsqueda vía \'Menú\'→\'Buscar\'.
\n\nLa pantalla de búsqueda proporciona plantillas para buscar:
\n\t* por dirección
\n\t* por coordenadas
\n\t* como PDI (por tipo o por nombre)
\n\t* por su historial de búsquedas
\n\t* o en sus favoritos predefinidos.
\n\nPara los puntos encontrados, se ofrece un menú contextual o barra de acciones con opciones como \'Indicaciones a\' o \'Mostrar en mapa\', etc. "</string>
\n\nPara los puntos encontrados, se ofrece un menú contextual o barra de acciones con opciones como \'Ir hasta\' o \'Mostrar en mapa\', etc. "</string>
<string name="background_service_is_enabled_question">El modo reposo, aún está funcionando. ¿Quiere interrumpirlo también?</string>
<string name="sleep_mode_stop_dialog">¿Interrumpir el modo reposo del GPS?</string>
<string name="save_global_track_interval_descr">Elige el intervalo de registro para la grabación de trazas general (activar mediante el control de grabación GPX en el mapa)</string>
@ -712,8 +712,8 @@
<string name="clear_intermediate_points">Quitar puntos intermedios</string>
<string name="keep_intermediate_points">Mantener puntos intermedios</string>
<string name="new_directions_point_dialog">Ya definió puntos intermedios.</string>
<string name="context_menu_item_directions_to">Indicaciones a</string>
<string name="context_menu_item_directions_from">Indicaciones desde</string>
<string name="context_menu_item_directions_to">Ir hasta</string>
<string name="context_menu_item_directions_from">Ir desde</string>
<string name="route_descr_map_location">"Mapa: "</string>
<string name="route_descr_lat_lon">Lat %1$.3f, Lon %2$.3f</string>
<string name="route_descr_current_location">Posición actual</string>
@ -1196,7 +1196,7 @@
<string name="vector_maps_may_display_faster_on_some_devices">Los mapas vectoriales pueden mostrarse más rápido. Puede no funcionar correctamente en algunos dispositivos.</string>
<string name="play_commands_of_currently_selected_voice">Reproduce indicaciones de voz elegidas</string>
<string name="native_rendering">Dibujo nativo</string>
<string name="test_voice_prompts">Probar indicaciones de voz</string>
<string name="test_voice_prompts">Probar avisos de voz</string>
<string name="switch_to_raster_map_to_see">No existe mapa vectorial sin conexión presente en esta ubicación. Puede descargar uno en Opciones (Gestionar mapas), o cambiar al mapa en línea (para esto, activar el complemento de mapas en línea).</string>
<string name="tip_recent_changes_0_7_2_t">"Cambios en 0.7.2 :
\n\t- Dibujo nativo para todos los dispositivos
@ -1313,8 +1313,8 @@
<string name="index_name_oceania">Oceanía</string>
<string name="index_name_other">Mapas mundiales y temáticos</string>
<string name="index_name_wiki">Wikipedia mundial</string>
<string name="index_name_voice">Indicaciones de voz (grabado, funciones limitadas)</string>
<string name="index_name_tts_voice">Indicaciones de voz (sintetizado TTS, preferido)</string>
<string name="index_name_voice">Avisos de voz (grabado, funciones limitadas)</string>
<string name="index_name_tts_voice">Avisos de voz (sintetizado TTS, preferido)</string>
<string name="amenity_type_osmwiki">Wikipedia (sin conexión)</string>
<string name="amenity_type_user_defined">Definido por el usuario</string>
<string name="fav_export_confirmation">Ya existe un archivo anterior con favoritos exportados. ¿Quiere sustituirlo?</string>
@ -1409,7 +1409,7 @@
<string name="search_position_current_location">Ubicación actual…</string>
<string name="search_position_map_view">Vista actual del mapa</string>
<string name="select_search_position">Origen:</string>
<string name="context_menu_item_search">Buscar cerca de aquí</string>
<string name="context_menu_item_search">Buscar cerca</string>
<string name="tip_recent_changes_0_6_7_t">"Cambios en 0.6.7 :
\n\t- Gestor de datos descargados (descargar, borrar, activar/desactivar datos descargados directamente en OsmAnd)
\n\t- Puntos y grupos favoritos (categorizar, borrar, gestionar favoritos)
@ -1634,7 +1634,7 @@
<string name="transport_searching_route">Resultados de transporte ({0} al destino):</string>
<string name="transport_search_again">Reiniciar búsqueda de transporte</string>
<string name="voice">Voz grabada</string>
<string name="voices">Indicaciones de voz</string>
<string name="voices">Avisos de voz</string>
<string name="no_vector_map_loaded">Los mapas vectoriales no están cargados</string>
<string name="map_route_by_gpx">Navegar usando GPX</string>
<string name="gpx_files_not_found">Sin archivos GPX en la carpeta de trazas</string>

View file

@ -2213,4 +2213,6 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
<string name="offline_maps_and_navigation">Mapy offline\ni nawigacja</string>
<string name="please_specify_poi_type">Proszę określić typ POI.</string>
<string name="number_of_rows_in_dash">Ilość wierszy na ekranie głównym %1$s</string>
<string name="description">Opis</string>
<string name="poi_dialog_poi_type">Rodzaj POI</string>
</resources>

View file

@ -2077,4 +2077,15 @@
<string name="commit_poi">Зафиксировать POI</string>
<string name="tab_title_basic">Основные</string>
<string name="tab_title_advanced">Расширенные</string>
</resources>
<string name="next_proceed">Следующий</string>
<string name="opening_at">Открытие в</string>
<string name="closing_at">Закрытие в</string>
<string name="tag_poi_name">название</string>
<string name="contact_info">Контактная информация</string>
<string name="description">Описание</string>
<string name="add_opening_hours">Добавить часы работы</string>
<string name="poi_dialog_poi_type">Тип POI</string>
<string name="number_of_rows_in_dash">Количество строк на странице %1$s</string>
<string name="please_specify_poi_type">Пожалуйста, укажите тип POI.</string>
<string name="rendering_value_boldOutline_name">Жирный контур</string>
</resources>

View file

@ -1132,4 +1132,21 @@
<string name="poi_denomination_maronite">馬若恩教派</string>
<string name="poi_denomination_mahayana">大乘佛教</string>
<string name="poi_landfill_waste_nuclear">核廢料</string>
<string name="poi_brownfield">棕地</string>
<string name="poi_greenfield">未開發地</string>
<string name="poi_bunker_silo">燃料貯塔</string>
<string name="poi_start_date">開始日期</string>
<string name="poi_wheelchair">輪椅</string>
<string name="poi_content_silage">青貯飼料 (庫容)</string>
<string name="poi_content_water">水 (庫容)</string>
<string name="poi_content_slurry">礦泥 (庫容)</string>
<string name="poi_content_oil">油 (庫容)</string>
<string name="poi_content_fuel">燃料 (庫容)</string>
<string name="poi_content_manure">肥料 (庫容)</string>
<string name="poi_content_wine">酒 (庫容)</string>
<string name="poi_content_sewage">污水 (庫容)</string>
<string name="poi_content_gas">瓦斯 (庫容)</string>
<string name="poi_content_biomass">生物質 (庫容)</string>
</resources>

View file

@ -11,7 +11,8 @@
<attr name="expandable_list_background" format="color"/>
<attr name="bg_color" format="reference" />
<attr name="bg_card" format="reference" />
<attr name="bg_map_context_menu" format="reference" />
<attr name="dashboard_divider" format="reference" />
<attr name="dashboard_button" format="reference" />

View file

@ -66,6 +66,7 @@
<item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="bg_color">@color/bg_color_light</item>
<item name="bg_card">@drawable/bg_card_light</item>
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
<item name="dashboard_divider">@color/dashboard_divider_light</item>
<item name="dashboard_button">@drawable/dashboard_button_light</item>
<item name="search_background">@color/search_background_dark</item>
@ -160,6 +161,7 @@
<item name="actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="bg_color">@color/bg_color_dark</item>
<item name="bg_card">@drawable/bg_card_dark</item>
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_dark</item>
<item name="dashboard_divider">@color/dashboard_divider_dark</item>
<item name="dashboard_button">@drawable/dashboard_button_dark</item>
<item name="search_background">@color/color_white</item>

View file

@ -106,7 +106,7 @@ public class MapActivityActions implements DialogProvider {
new ShareLocation(mapActivity).run();
}
public void showNavigationContextMenuPoint(final double latitude, final double longitude, Object selectedObj) {
public void showNavigationContextMenuPoint(final double latitude, final double longitude) {
final ContextMenuAdapter adapter = new ContextMenuAdapter(mapActivity);
if(!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {

View file

@ -171,23 +171,23 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
addButton(ll, "New route has been calculated (150m & 2m5sec)", builder(p).newRouteCalculated(150, 125));
addButton(ll, "Route recalculated (23150m & 350sec)", builder(p).routeRecalculated(23150, 350));
addButton(ll, "In 1520m turn slightly left", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_SL, 1520, street(p, "")));
addButton(ll, "After 850m turn sharply left onto 'Hauptstra"+"\u00df"+"e', then bear right", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT_SH, 850, street(p, "Hauptstrasse")).then().bearRight(street(p, "")));
addButton(ll, "Turn left, then after 100m turn slightly right", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT, street(p, "")).then().turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 100, street(p, "")));
addButton(ll, "In 3100 turn right onto 'SR 80'", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_RIGHT, 3100, street(p, "SR 80")));
addButton(ll, "After 370m turn slightly right onto 'F23' 'Main Street', then bear left", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 370, street(p, "Main Street", "F23")).then().bearLeft(street(p, "")));
addButton(ll, "After 1520m turn slightly left", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_SL, 1520, street(p, "")));
addButton(ll, "In 450m turn sharply left onto 'Hauptstra"+"\u00df"+"e', then bear right", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT_SH, 450, street(p, "Hauptstra<EFBFBD>e")).then().bearRight(street(p, "")));
addButton(ll, "Turn left, then in 100m turn slightly right", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT, street(p, "")).then().turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 100, street(p, "")));
addButton(ll, "After 3100 turn right onto 'SR 80'", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_RIGHT, 3100, street(p, "SR 80")));
addButton(ll, "In 370m turn slightly right onto 'F23' 'Main Street', then bear left", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SL, 370, street(p, "Main Street", "F23")).then().bearLeft(street(p, "")));
addButton(ll, "Turn sharply right onto 'Main Street'", builder(p).turn(AbstractPrologCommandPlayer.A_RIGHT_SH, street(p, "Main Street")));
addButton(ll, "In 1810m keep left ' '", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 1810, street(p, "")));
addButton(ll, "After 400m keep left ' ' then after 80m keep right 'A1'", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 400, street(p, "")).then().turn(AbstractPrologCommandPlayer.A_RIGHT_KEEP, 80, street(p,"", "A1")));
addButton(ll, "After 1810m keep left ' '", builder(p).prepareTurn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 1810, street(p, "")));
addButton(ll, "In 400m keep left ' ' then in 80m keep right 'A1'", builder(p).turn(AbstractPrologCommandPlayer.A_LEFT_KEEP, 400, street(p, "")).then().turn(AbstractPrologCommandPlayer.A_RIGHT_KEEP, 80, street(p,"", "A1")));
addButton(ll, "In 640m make a U-turn", builder(p).prepareMakeUT(640, street(p, "")));
addButton(ll, "After 400m make a U-turn", builder(p).makeUT(400, street(p, "")));
addButton(ll, "After 640m make a U-turn", builder(p).prepareMakeUT(640, street(p, "")));
addButton(ll, "In 400m make a U-turn", builder(p).makeUT(400, street(p, "")));
addButton(ll, "Make a U-turn on 'Riviera'", builder(p).makeUT(street(p, "Riviera")));
addButton(ll, "When possible, make a U-turn", builder(p).makeUTwp());
addButton(ll, "In 1250m enter a roundabout [and take the 3rd exit onto 'Liberty']", builder(p).prepareRoundAbout(1250, 3, street(p,"Liberty")));
addButton(ll, "After 450m enter the roundabout and take the 1st exit onto 'Market Square'", builder(p).roundAbout(450, 0, 1, street(p,"", "", "Market Square")));
addButton(ll, "After 1250m enter a roundabout [and take the 3rd exit onto 'Liberty']", builder(p).prepareRoundAbout(1250, 3, street(p,"Liberty")));
addButton(ll, "In 450m enter the roundabout and take the 1st exit onto 'Market Square'", builder(p).roundAbout(450, 0, 1, street(p,"", "", "Market Square")));
addButton(ll, "Roundabout: Take the 2nd exit onto 'Bridge Avenue'", builder(p).roundAbout(0, 2, street(p, "Bridge Avenue")));
addButton(ll, "Follow the road for 2350m to ' '", builder(p).goAhead(2350, street(p, "")));

View file

@ -14,6 +14,7 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.util.Algorithms;
public class MapContextMenu {
@ -24,7 +25,6 @@ public class MapContextMenu {
private PointDescription pointDescription;
private Object object;
private ContextMenuAdapter menuAdapter;
private String foundStreetName;
@ -59,14 +59,13 @@ public class MapContextMenu {
}
public void show(PointDescription pointDescription, Object object, ContextMenuAdapter menuAdapter) {
public void show(PointDescription pointDescription, Object object) {
if (isMenuVisible())
hide();
this.pointDescription = pointDescription;
this.object = object;
this.menuAdapter = menuAdapter;
acquireStretName();
@ -92,34 +91,37 @@ public class MapContextMenu {
}
public int getLeftIconId() {
if (object instanceof Amenity) {
String id = null;
Amenity o = (Amenity)object;
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
if (st != null) {
if (RenderingIcons.containsSmallIcon(st.getIconKeyName())) {
id = st.getIconKeyName();
} else if (RenderingIcons.containsSmallIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
id = st.getOsmTag() + "_" + st.getOsmValue();
if (object != null) {
if (object instanceof Amenity) {
String id = null;
Amenity o = (Amenity) object;
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
if (st != null) {
if (RenderingIcons.containsSmallIcon(st.getIconKeyName())) {
id = st.getIconKeyName();
} else if (RenderingIcons.containsSmallIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
id = st.getOsmTag() + "_" + st.getOsmValue();
}
}
}
if (id != null) {
Integer resId = RenderingIcons.getResId(id);
if (resId != null) {
return resId;
if (id != null) {
Integer resId = RenderingIcons.getResId(id);
if (resId != null) {
return resId;
}
}
}
}
return 0;
}
public String getAddressStr() {
String res = null;
if (object instanceof Amenity) {
Amenity amenity = (Amenity) object;
res = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.MAP_PREFERRED_LOCALE.get());
if (object != null) {
if (object instanceof Amenity) {
Amenity amenity = (Amenity) object;
res = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.MAP_PREFERRED_LOCALE.get());
}
}
if (Algorithms.isEmpty(res)) {
@ -132,7 +134,7 @@ public class MapContextMenu {
res = typeName;
}
return Algorithms.isEmpty(res) ? "???" : res;
return Algorithms.isEmpty(res) ? "Address is unknown yet" : res;
}
public String getLocationStr() {
@ -143,11 +145,11 @@ public class MapContextMenu {
}
public void buttonNavigatePressed() {
mapActivity.getMapActions().showNavigationContextMenuPoint(pointDescription.getLat(), pointDescription.getLon(), object);
mapActivity.getMapActions().showNavigationContextMenuPoint(pointDescription.getLat(), pointDescription.getLon());
}
public void buttonFavoritePressed() {
if (object instanceof FavouritePoint) {
if (object != null && object instanceof FavouritePoint) {
mapActivity.getMapActions().editFavoritePoint((FavouritePoint)object);
} else {
mapActivity.getMapActions().addFavouritePoint(pointDescription.getLat(), pointDescription.getLon());
@ -159,6 +161,13 @@ public class MapContextMenu {
}
public void buttonMorePressed() {
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter(mapActivity);
if (object != null) {
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
layer.populateObjectContextMenu(object, menuAdapter);
}
}
mapActivity.getMapActions().contextMenuPoint(pointDescription.getLat(), pointDescription.getLon(), menuAdapter, object);
}
}

View file

@ -10,14 +10,18 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.PlatformUtil;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchActivity;
import org.apache.commons.logging.Log;
@ -122,6 +126,9 @@ public class MapContextMenuFragment extends Fragment {
}
});
IconsCache iconsCache = getMyApplication().getIconsCache();
boolean light = getMyApplication().getSettings().isLightContent();
int iconId = MapContextMenu.getInstance().getLeftIconId();
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
@ -129,7 +136,8 @@ public class MapContextMenuFragment extends Fragment {
if (iconId == 0) {
iconLayout.setVisibility(View.GONE);
} else {
iconView.setImageResource(iconId);
iconView.setImageDrawable(iconsCache.getIcon(iconId,
light ? R.color.icon_color : R.color.icon_color_light));
}
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
@ -139,6 +147,8 @@ public class MapContextMenuFragment extends Fragment {
line2.setText(MapContextMenu.getInstance().getLocationStr());
final ImageButton buttonNavigate = (ImageButton) view.findViewById(R.id.context_menu_route_button);
buttonNavigate.setImageDrawable(iconsCache.getIcon(R.drawable.map_directions,
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
buttonNavigate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -147,6 +157,8 @@ public class MapContextMenuFragment extends Fragment {
});
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
buttonFavorite.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_fav_dark,
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
buttonFavorite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -155,6 +167,8 @@ public class MapContextMenuFragment extends Fragment {
});
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.abc_ic_menu_share_mtrl_alpha,
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
buttonShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -163,6 +177,8 @@ public class MapContextMenuFragment extends Fragment {
});
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_core_overflow_dark,
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
buttonMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -215,6 +231,13 @@ public class MapContextMenuFragment extends Fragment {
getActivity().getSupportFragmentManager().popBackStack();
}
public OsmandApplication getMyApplication() {
if (getActivity() == null) {
return null;
}
return (OsmandApplication) getActivity().getApplication();
}
public static void showInstance(final MapActivity mapActivity) {
MapContextMenuFragment fragment = new MapContextMenuFragment();
mapActivity.getSupportFragmentManager().beginTransaction()

View file

@ -128,7 +128,7 @@ public class VoiceRouter {
PREPARE_DISTANCE = 1500; // [125 sec]
PREPARE_DISTANCE_END = 1200; // [100 sec]
TURN_IN_DISTANCE = 300; // 23 sec
TURN_IN_DISTANCE_END = 195; // 15 sec
TURN_IN_DISTANCE_END = 210; // 16 sec
TURN_DISTANCE = 50; // 7 sec
TURN_DEFAULT_SPEED = 7f; // 25 km/h
DEFAULT_SPEED = 13; // 48 km/h
@ -164,7 +164,7 @@ public class VoiceRouter {
PREPARE_DISTANCE = (int) (DEFAULT_SPEED * 115);
PREPARE_DISTANCE_END = (int) (DEFAULT_SPEED * 92);
TURN_IN_DISTANCE = (int) (DEFAULT_SPEED * 23);
TURN_IN_DISTANCE_END = (int) (DEFAULT_SPEED * 15);
TURN_IN_DISTANCE_END = (int) (DEFAULT_SPEED * 16);
TURN_DISTANCE = (int) (DEFAULT_SPEED * 7);
}
}

View file

@ -271,12 +271,20 @@ public class ContextMenuLayer extends OsmandMapLayer {
}
LatLon latLon = selectObjectsForContextMenu(tileBox, point);
if (latLon != null) {
String description = getSelectedObjectDescription();
setLocation(latLon, description);
if (selectedObjects.size() == 1) {
setLocation(null, "");
Object selectedObj = selectedObjects.keySet().iterator().next();
showMapContextMenu(selectedObj, latLon);
} else {
String description = getSelectedObjectDescription();
setLocation(latLon, description);
}
} else {
setLocation(null, "");
final double lat = tileBox.getLatFromPixel((int) point.x, (int) point.y);
final double lon = tileBox.getLonFromPixel((int) point.x, (int) point.y);
setLocation(new LatLon(lat, lon), null);
showMapContextMenu(null, new LatLon(lat, lon));
//setLocation(new LatLon(lat, lon), null);
}
view.refreshMap();
return true;
@ -337,7 +345,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
}
public int pressedInTextView(RotatedTileBox tb, float px, float py) {
if (latLon != null) {
if (latLon != null && textView.getText().length() > 0) {
Rect bs = textView.getBackground().getBounds();
Rect closes = closeButton.getDrawable().getBounds();
int dx = (int) (px - tb.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()));
@ -429,8 +437,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
LatLon latLon = selectObjectsForContextMenu(tileBox, point);
if (latLon != null) {
if (selectedObjects.size() == 1) {
setLocation(null, "");
Object selectedObj = selectedObjects.keySet().iterator().next();
showMapContextMenu(selectedObj, latLon, null);
showMapContextMenu(selectedObj, latLon);
} else {
String description = getSelectedObjectDescription();
setLocation(latLon, description);
@ -459,33 +468,29 @@ public class ContextMenuLayer extends OsmandMapLayer {
@Override
public void onClick(DialogInterface dialog, int which) {
Object selectedObj = s.get(which);
for (OsmandMapLayer layer : view.getLayers()) {
layer.populateObjectContextMenu(selectedObj, menuAdapter);
}
showMapContextMenu(selectedObj, l, menuAdapter);
//activity.getMapActions().contextMenuPoint(l.getLatitude(), l.getLongitude(), menuAdapter, selectedObj);
showMapContextMenu(selectedObj, l);
}
});
builder.show();
} else {
Object selectedObj = selectedObjects.keySet().iterator().next();
for (OsmandMapLayer layer : view.getLayers()) {
layer.populateObjectContextMenu(selectedObj, menuAdapter);
}
showMapContextMenu(selectedObj, l, menuAdapter);
//activity.getMapActions().contextMenuPoint(l.getLatitude(), l.getLongitude(), menuAdapter, selectedObj);
showMapContextMenu(selectedObj, l);
}
}
private void showMapContextMenu(Object obj, LatLon latLon, final ContextMenuAdapter menuAdapter) {
PointDescription pointDescription = selectedObjects.get(obj).getObjectName(obj);
pointDescription.setLat(latLon.getLatitude());
pointDescription.setLon(latLon.getLongitude());
private void showMapContextMenu(Object obj, LatLon latLon) {
PointDescription pointDescription;
if (obj != null) {
pointDescription = selectedObjects.get(obj).getObjectName(obj);
pointDescription.setLat(latLon.getLatitude());
pointDescription.setLon(latLon.getLongitude());
} else {
pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude());
}
this.latLon = latLon;
showMapContextMenuMarker();
MapContextMenu.getInstance().show(pointDescription, obj, menuAdapter);
MapContextMenu.getInstance().show(pointDescription, obj);
}