Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cfa489ee90
20 changed files with 388 additions and 274 deletions
|
@ -12,7 +12,6 @@ import java.text.Collator;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -146,6 +145,8 @@ public class BinaryMapIndexReader {
|
|||
mapIndex.length = readInt();
|
||||
mapIndex.filePointer = codedIS.getTotalBytesRead();
|
||||
int oldLimit = codedIS.pushLimit(mapIndex.length);
|
||||
// FIXME
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
readMapIndex(mapIndex);
|
||||
basemap = basemap || mapIndex.isBaseMap();
|
||||
codedIS.popLimit(oldLimit);
|
||||
|
@ -159,6 +160,8 @@ public class BinaryMapIndexReader {
|
|||
region.filePointer = codedIS.getTotalBytesRead();
|
||||
if(addressAdapter != null){
|
||||
oldLimit = codedIS.pushLimit(region.length);
|
||||
// FIXME
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
addressAdapter.readAddressIndex(region);
|
||||
if(region.name != null){
|
||||
addressIndexes.add(region);
|
||||
|
@ -174,6 +177,8 @@ public class BinaryMapIndexReader {
|
|||
ind.filePointer = codedIS.getTotalBytesRead();
|
||||
if (transportAdapter != null) {
|
||||
oldLimit = codedIS.pushLimit(ind.length);
|
||||
// FIXME
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
transportAdapter.readTransportIndex(ind);
|
||||
codedIS.popLimit(oldLimit);
|
||||
transportIndexes.add(ind);
|
||||
|
@ -187,6 +192,8 @@ public class BinaryMapIndexReader {
|
|||
routeReg.filePointer = codedIS.getTotalBytesRead();
|
||||
if (routeAdapter != null) {
|
||||
oldLimit = codedIS.pushLimit(routeReg.length);
|
||||
// FIXME
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
routeAdapter.readRouteIndex(routeReg);
|
||||
codedIS.popLimit(oldLimit);
|
||||
routingIndexes.add(routeReg);
|
||||
|
@ -200,6 +207,8 @@ public class BinaryMapIndexReader {
|
|||
poiInd.filePointer = codedIS.getTotalBytesRead();
|
||||
if (poiAdapter != null) {
|
||||
oldLimit = codedIS.pushLimit(poiInd.length);
|
||||
// FIXME
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
poiAdapter.readPoiIndex(poiInd);
|
||||
codedIS.popLimit(oldLimit);
|
||||
poiIndexes.add(poiInd);
|
||||
|
|
|
@ -47,6 +47,9 @@ public class Amenity extends MapObject {
|
|||
this.site = entity.getTag(OSMTagKey.CONTACT_WEBSITE);
|
||||
}
|
||||
}
|
||||
if (this.site.indexOf("://") == -1){
|
||||
this.site = "http://"+this.site;
|
||||
}
|
||||
}
|
||||
this.description = entity.getTag(OSMTagKey.DESCRIPTION);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<!-- Types : string, int, boolean; possibleValues comma separated possible values for int/string -->
|
||||
<renderingProperty attr="hmRendered" name="Show more map detail" description="Increase amount of map detail shown"
|
||||
type="boolean" possibleValues=""/>
|
||||
<renderingProperty attr="viRendered" name="New colors" description="Experiment with road colors"
|
||||
type="boolean" possibleValues=""/>
|
||||
<renderingProperty attr="contourLines" name="Show contour lines" description="Select minimum zoom level to display in map if available. Separate SRTM-file may be needed."
|
||||
type="string" possibleValues="never,13,12,11"/>
|
||||
<renderingProperty attr="appMode" name="Rendering mode" description="Map optimization for respective User Profile"
|
||||
|
@ -1007,12 +1009,16 @@
|
|||
<filter minzoom="1" tag="natural" value="coastline_broken" color="#111111" strokeWidth="1"/>
|
||||
<group>
|
||||
<filter hmRendered="true" tag="highway" value="motorway" maxzoom="13" color="#809bff"/>
|
||||
<filter viRendered="true" tag="highway" value="motorway" maxzoom="13" color="#6666CC"/>
|
||||
<filter tag="highway" value="motorway" maxzoom="13" color="#a58dff"/>
|
||||
<filter hmRendered="true" tag="highway" value="motorway_link" maxzoom="13" color="#809bff"/>
|
||||
<filter viRendered="true" tag="highway" value="motorway_link" maxzoom="13" color="#6666CC"/>
|
||||
<filter tag="highway" value="motorway_link" maxzoom="13" color="#a58dff"/>
|
||||
<filter hmRendered="true" tag="highway" value="trunk" maxzoom="13" color="#df1346"/>
|
||||
<filter viRendered="true" tag="highway" value="trunk" maxzoom="13" color="#A02067"/>
|
||||
<filter tag="highway" value="trunk" maxzoom="13" color="#ffaf80"/>
|
||||
<filter hmRendered="true" tag="highway" value="trunk_link" maxzoom="13" color="#df1346"/>
|
||||
<filter viRendered="true" tag="highway" value="trunk_link" maxzoom="13" color="#A02067"/>
|
||||
<filter tag="highway" value="trunk_link" maxzoom="13" color="#ffaf80"/>
|
||||
<groupFilter cap="ROUND">
|
||||
<filter minzoom="5" maxzoom="9" strokeWidth="5"/>
|
||||
|
@ -1024,9 +1030,11 @@
|
|||
</group>
|
||||
|
||||
<group>
|
||||
<filter tag="highway" value="primary" maxzoom="13"/>
|
||||
<filter tag="highway" value="primary_link" maxzoom="13"/>
|
||||
<groupFilter color="#eb989a" cap="ROUND">
|
||||
<filter viRendered="true" tag="highway" value="primary" color="#C04D61" maxzoom="13"/>
|
||||
<filter tag="highway" value="primary" color="#eb989a" maxzoom="13"/>
|
||||
<filter viRendered="true" tag="highway" value="primary_link" color="#C04D61" maxzoom="13"/>
|
||||
<filter tag="highway" value="primary_link" color="#eb989a" maxzoom="13"/>
|
||||
<groupFilter cap="ROUND">
|
||||
<filter minzoom="7" maxzoom="9" strokeWidth="4"/>
|
||||
<filter minzoom="10" maxzoom="10" strokeWidth="5"/>
|
||||
<filter minzoom="11" maxzoom="11" strokeWidth="6"/>
|
||||
|
@ -1036,9 +1044,11 @@
|
|||
</group>
|
||||
|
||||
<group>
|
||||
<filter tag="highway" value="secondary" maxzoom="13"/>
|
||||
<filter tag="highway" value="secondary_link" maxzoom="13"/>
|
||||
<groupFilter color="#fdd6a4" color_2="#fdd6a4" shadowRadius="1" cap="ROUND">
|
||||
<filter viRendered="true" tag="highway" value="secondary" color="#F7D131" maxzoom="13"/>
|
||||
<filter tag="highway" value="secondary" color="#fdd6a4" maxzoom="13"/>
|
||||
<filter viRendered="true" tag="highway" value="secondary_link" color="#F7D131" maxzoom="13"/>
|
||||
<filter tag="highway" value="secondary_link" color="#fdd6a4" maxzoom="13"/>
|
||||
<groupFilter shadowRadius="1" cap="ROUND">
|
||||
<filter minzoom="9" maxzoom="9" strokeWidth="3"/>
|
||||
<filter minzoom="10" maxzoom="10" strokeWidth="4"/>
|
||||
<filter minzoom="11" maxzoom="11" strokeWidth="5"/>
|
||||
|
@ -1049,17 +1059,26 @@
|
|||
|
||||
<group>
|
||||
<filter hmRendered="true" tag="highway" value="motorway" color="#809bff"/>
|
||||
<filter viRendered="true" tag="highway" value="motorway" color="#6666CC"/>
|
||||
<filter tag="highway" value="motorway" color="#a58dff"/>
|
||||
<filter hmRendered="true" tag="highway" value="motorway_link" color="#809bff"/>
|
||||
<filter viRendered="true" tag="highway" value="motorway_link" color="#6666CC"/>
|
||||
<filter tag="highway" value="motorway_link" color="#a58dff"/>
|
||||
<filter hmRendered="true" tag="highway" value="trunk" color="#df1346"/>
|
||||
<filter viRendered="true" tag="highway" value="trunk" color="#A02067"/>
|
||||
<filter tag="highway" value="trunk" color="#ffaf80"/>
|
||||
<filter hmRendered="true" tag="highway" value="trunk_link" color="#df1346"/>
|
||||
<filter viRendered="true" tag="highway" value="trunk_link" color="#A02067"/>
|
||||
<filter tag="highway" value="trunk_link" color="#ffaf80"/>
|
||||
<filter viRendered="true" tag="highway" value="primary" color="#C04D61"/>
|
||||
<filter tag="highway" value="primary" color="#eb989a"/>
|
||||
<filter viRendered="true" tag="highway" value="primary_link" color="#C04D61"/>
|
||||
<filter tag="highway" value="primary_link" color="#eb989a"/>
|
||||
<filter viRendered="true" tag="highway" value="secondary" color="#F7D131"/>
|
||||
<filter tag="highway" value="secondary" color="#fdd6a4"/>
|
||||
<filter viRendered="true" tag="highway" value="secondary_link" color="#F7D131"/>
|
||||
<filter tag="highway" value="secondary_link" color="#fdd6a4"/>
|
||||
|
||||
<groupFilter shadowRadius="1" cap="ROUND">
|
||||
<filter>
|
||||
<filter minzoom="14" maxzoom="14" strokeWidth="10"/>
|
||||
|
@ -1082,9 +1101,11 @@
|
|||
</group>
|
||||
|
||||
<group>
|
||||
<filter tag="highway" value="tertiary"/>
|
||||
<filter tag="highway" value="tertiary_link"/>
|
||||
<groupFilter color="#fefeb3" shadowRadius="1" cap="ROUND">
|
||||
<filter tag="highway" value="tertiary" color="#fefeb3"/>
|
||||
<filter viRendered="true" tag="tertiary" value="trunk_link" color="#F0CE30"/>
|
||||
<filter tag="highway" value="tertiary_link" color="#fefeb3"/>
|
||||
<filter viRendered="true" tag="tertiary_link" value="trunk_link" color="#F0CE30"/>
|
||||
<groupFilter shadowRadius="1" cap="ROUND">
|
||||
<filter minzoom="10" maxzoom="10" strokeWidth="3"/>
|
||||
<filter minzoom="11" maxzoom="11" strokeWidth="4"/>
|
||||
<filter minzoom="12" maxzoom="12" strokeWidth="5"/>
|
||||
|
|
BIN
OsmAnd/res/drawable-hdpi/list_activities_config.png
Normal file
BIN
OsmAnd/res/drawable-hdpi/list_activities_config.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
OsmAnd/res/drawable-large/list_activities_config.png
Normal file
BIN
OsmAnd/res/drawable-large/list_activities_config.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/list_activities_config.png
Normal file
BIN
OsmAnd/res/drawable-mdpi/list_activities_config.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group android:id="@+id/map_context_menu" android:menuCategory="container">
|
||||
|
||||
<item android:title="@string/where_am_i" android:id="@+id/map_where_am_i" android:icon="@android:drawable/ic_menu_mylocation"></item>
|
||||
<item android:id="@+id/map_layers" android:title="@string/menu_layers" android:icon="@android:drawable/ic_menu_mapmode"></item>
|
||||
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
|
||||
|
||||
<!-- not visible by default -->
|
||||
<item android:id="@+id/map_navigate_to_point" android:title="@string/stop_navigation" android:visible="false" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
|
||||
<item android:id="@+id/map_mute" android:title="@string/menu_mute_off" android:visible="false"></item>
|
||||
|
||||
<item android:id="@+id/map_get_directions" android:title="@string/get_directions" android:icon="@android:drawable/ic_menu_directions"></item>
|
||||
<item android:title="@string/search_button" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>
|
||||
|
||||
<item android:id="@+id/map_animate_route" android:title="@string/animate_route" android:visible="false"></item>
|
||||
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
|
||||
<item android:id="@+id/map_show_point_options" android:title="@string/show_point_options"></item>
|
||||
</group>
|
||||
|
||||
|
||||
</menu>
|
|
@ -907,14 +907,14 @@
|
|||
<string name="map_widget_distance">Цель</string>
|
||||
<string name="map_widget_altitude">Высота</string>
|
||||
<string name="map_widget_time">Время в пути</string>
|
||||
<string name="map_widget_next_turn">Следующий поворот</string>
|
||||
<string name="map_widget_next_turn_small">Следующий поворот (маленький)</string>
|
||||
<string name="map_widget_next_next_turn">Второй следующий поворот</string>
|
||||
<string name="map_widget_next_turn">След. поворот</string>
|
||||
<string name="map_widget_next_turn_small">След. поворот (мал.)</string>
|
||||
<string name="map_widget_next_next_turn">Второй след. поворот</string>
|
||||
<string name="map_widget_mini_route">Малая карта маршрута</string>
|
||||
<string name="bg_service_screen_lock">Заблокировать/Разблокировать экран</string>
|
||||
<string name="bg_service_screen_unlock">Unlock screen</string>
|
||||
<string name="bg_service_sleep_mode_off">Disable Sleep mode</string>
|
||||
<string name="bg_service_sleep_mode_on">Enable Sleep mode</string>
|
||||
<string name="bg_service_screen_lock">Блокировка экрана</string>
|
||||
<string name="bg_service_screen_unlock">Блокировать экран</string>
|
||||
<string name="bg_service_sleep_mode_off">Отключить спящий режим</string>
|
||||
<string name="bg_service_sleep_mode_on">Включить спящий режим</string>
|
||||
<string name="bg_service_screen_lock_toast">Экран заблокирован</string>
|
||||
<string name="bg_service_interval">Установить интервал просыпания</string>
|
||||
</resources>
|
|
@ -9,25 +9,29 @@
|
|||
1. All your modified/created strings are in the top of the file (to make easier find what's translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="avoid_in_routing_title">Avoid..</string>
|
||||
<string name="layer_map_appearance">Configure screen…</string>
|
||||
<string name="show_lanes">Show lanes</string>
|
||||
<string name="avoid_unpaved">Avoid unpaved roads</string>
|
||||
<string name="avoid_ferries">Avoid ferries</string>
|
||||
<string name="avoid_in_routing_title">Avoid…</string>
|
||||
<string name="avoid_in_routing_descr">Avoid toll roads, unpaved, ferries</string>
|
||||
<string name="show_warnings_title">Show alarms</string>
|
||||
<string name="show_warnings_descr">Show speed limits, speed cameras and traffic bumps</string>
|
||||
<string name="map_widget_fluorescent">Fluorescent colors</string>
|
||||
<string name="show_warnings_title">Show alarms…</string>
|
||||
<string name="show_warnings_descr">Show speed limits, speed cameras, and traffic bumps</string>
|
||||
<string name="map_widget_fluorescent">Fluorescent routes</string>
|
||||
<string name="map_widget_show_ruler">Ruler</string>
|
||||
<string name="map_widget_appearance">Appearance</string>
|
||||
<string name="map_widget_view_direction">View direction</string>
|
||||
<string name="map_widget_transparent">Transparent views</string>
|
||||
<string name="monitoring_mode_off">GPX rec</string>
|
||||
<string name="monitoring_mode_on">GPX off</string>
|
||||
<string name="bg_service_sleep_mode_off">Run in background</string>
|
||||
<string name="bg_service_sleep_mode_on">Stop background</string>
|
||||
<string name="gps_wakeup_interval">GPS wakeup interval : %s</string>
|
||||
<string name="map_widget_appearance">Miscellaneous</string>
|
||||
<string name="map_widget_view_direction">Viewing direction</string>
|
||||
<string name="map_widget_transparent">Transparent skin</string>
|
||||
<string name="monitoring_mode_off">Record GPX</string>
|
||||
<string name="monitoring_mode_on">Stop GPX rec.</string>
|
||||
<string name="bg_service_sleep_mode_off">Enable sleep mode</string>
|
||||
<string name="bg_service_sleep_mode_on">Stop sleep mode</string>
|
||||
<string name="gps_wakeup_interval">GPS wake-up interval : %s</string>
|
||||
<string name="int_continuosly">Continuously</string>
|
||||
<string name="screen_is_locked">To unlock screen press lock icon</string>
|
||||
<string name="map_widget_top_text">Street name</string>
|
||||
<string name="map_widget_config">Configuration</string>
|
||||
<string name="map_widget_map_select">Map selection</string>
|
||||
<string name="map_widget_config">Configure screen</string>
|
||||
<string name="map_widget_map_select">Map source</string>
|
||||
<string name="map_widget_back_to_loc">Where am I</string>
|
||||
<string name="map_widget_lock_screen">Lock screen</string>
|
||||
<string name="map_widget_compass">Compass</string>
|
||||
|
@ -49,15 +53,13 @@
|
|||
<string name="bg_service_screen_unlock">Unlock screen</string>
|
||||
<string name="bg_service_screen_lock_toast">The screen is locked</string>
|
||||
<string name="bg_service_interval">Set wake-up interval:</string>
|
||||
<string name="show_cameras_descr">Show speed cameras (may be forbidden in some countries)</string>
|
||||
<string name="show_speed_limits_descr">Show speed limits and traffic bumps</string>
|
||||
<string name="avoid_toll_roads_descr">Avoid toll roads for route calculation</string>
|
||||
<string name="show_cameras">Show speed cameras</string>
|
||||
<string name="show_speed_limits">Show speed limits</string>
|
||||
<string name="avoid_toll_roads">Avoid toll roads</string>
|
||||
<string name="tip_recent_changes_0_8_2_t">Changes in 0.8.2 :
|
||||
\n\t* Improved Routing
|
||||
\n\t* Dynamic map widgets
|
||||
\n\t* Map settings moved to map screen
|
||||
</string>
|
||||
<string name="continue_follow_previous_route_auto">Previous navigation was unfinished. Continue following it? (%1$s seconds)</string>
|
||||
<string name="route_updated_loc_found">Route will be recalculated when location will be found</string>
|
||||
|
@ -181,11 +183,9 @@ You can enable (online or cached) tile map sources, tracking settings, and many
|
|||
</string>
|
||||
<string name="osm_editing_plugin_description">Show settings needed for OSM feedback like collecting / modifying OSM POI objects, opening / commenting OSM bugs, and contributing recorded GPX files (requires OSM credentials).</string>
|
||||
<string name="vector_maps_may_display_faster_on_some_devices">Vector maps likely display faster. May not work well on some devices.</string>
|
||||
<string name="simulate_route_progression_manually">Simulate route progression manually</string>
|
||||
<string name="play_commands_of_currently_selected_voice">Play commands of currently selected voice</string>
|
||||
<string name="debugging_and_development">OsmAnd development</string>
|
||||
<string name="native_rendering">Native rendering</string>
|
||||
<string name="animate_routing">Animate navigation</string>
|
||||
<string name="test_voice_prompts">Test voice prompts</string>
|
||||
<string name="switch_to_raster_map_to_see">No offline vector map present for this location. You can download one in Settings (Offline data), or switch to online maps.</string>
|
||||
<string name="tip_recent_changes_0_7_2_t">Changes in 0.7.2 :
|
||||
|
|
|
@ -22,18 +22,9 @@
|
|||
<ListPreference android:key="auto_follow_route" android:title="@string/choose_auto_follow_route"
|
||||
android:summary="@string/choose_auto_follow_route_descr"></ListPreference>
|
||||
<CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference>
|
||||
|
||||
<CheckBoxPreference android:summary="@string/show_speed_limits_descr" android:title="@string/show_speed_limits"
|
||||
android:key="show_speed_limits"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:summary="@string/show_cameras_descr" android:title="@string/show_cameras"
|
||||
android:key="show_cameras"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:summary="@string/avoid_toll_roads_descr" android:title="@string/avoid_toll_roads"
|
||||
android:key="avoid_toll_roads"></CheckBoxPreference>
|
||||
<!--
|
||||
<Preference android:title="@string/show_warnings_title" android:summary="@string/show_warnings_descr" android:key="show_routing_alarms"/>
|
||||
<Preference android:title="@string/avoid_in_routing_title" android:summary="@string/avoid_in_routing_descr" android:key="avoid_in_routing"/>
|
||||
-->
|
||||
|
||||
<CheckBoxPreference android:summary="@string/use_compass_navigation_descr" android:title="@string/use_compass_navigation"
|
||||
android:key="use_compass_navigation"></CheckBoxPreference>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -1,32 +1,82 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class OptionsMenuHelper {
|
||||
|
||||
private final Menu menu;
|
||||
|
||||
public OptionsMenuHelper(Menu menu) {
|
||||
this.menu = menu;
|
||||
public interface OnOptionsMenuClick {
|
||||
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item);
|
||||
|
||||
public boolean onClick(MenuItem item);
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, int resIcon, boolean visibility) {
|
||||
if (resIcon != -1) {
|
||||
menu.add(Menu.CATEGORY_CONTAINER, resItemId, Menu.NONE, resName).setVisible(visibility).setIcon(resIcon);
|
||||
} else {
|
||||
menu.add(Menu.CATEGORY_CONTAINER, resItemId, Menu.NONE, resName).setVisible(visibility);
|
||||
final TIntArrayList items = new TIntArrayList();
|
||||
final TIntArrayList itemNames = new TIntArrayList();
|
||||
final TIntArrayList visible = new TIntArrayList();
|
||||
final ArrayList<OnOptionsMenuClick> listeners = new ArrayList<OnOptionsMenuClick>();
|
||||
final TIntArrayList iconList = new TIntArrayList();
|
||||
|
||||
public OptionsMenuHelper() {
|
||||
}
|
||||
|
||||
public void registerOptionsMenu(Menu menu) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
int resItemId = items.get(i);
|
||||
int resName = itemNames.get(i);
|
||||
int resIcon = iconList.get(i);
|
||||
boolean visibility = visible.get(i) > 0;
|
||||
if (resIcon != -1) {
|
||||
menu.add(Menu.CATEGORY_CONTAINER, resItemId, Menu.NONE, resName).setVisible(visibility).setIcon(resIcon);
|
||||
} else {
|
||||
menu.add(Menu.CATEGORY_CONTAINER, resItemId, Menu.NONE, resName).setVisible(visibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, int resIcon) {
|
||||
registerOptionsMenuItem(resItemId, resName, resIcon, true);
|
||||
public boolean onClick(MenuItem mi) {
|
||||
int id = mi.getItemId();
|
||||
int ind = items.indexOf(id);
|
||||
if(ind >= 0 && ind < listeners.size() && listeners.get(ind) != null) {
|
||||
return listeners.get(ind).onClick(mi);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void prepareOptionsMenu(Menu menu) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
int resItemId = items.get(i);
|
||||
OnOptionsMenuClick l = listeners.get(i);
|
||||
if (l != null) {
|
||||
l.prepareOptionsMenu(menu, menu.findItem(resItemId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, boolean visibility) {
|
||||
registerOptionsMenuItem(resItemId, resName, -1, visibility);
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, int resIcon, boolean visibility, OnOptionsMenuClick onClick) {
|
||||
items.add(resItemId);
|
||||
itemNames.add(resName);
|
||||
visible.add(visibility ? 1 : 0);
|
||||
listeners.add(onClick);
|
||||
iconList.add(resIcon);
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName) {
|
||||
registerOptionsMenuItem(resItemId, resName, -1, true);
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, int resIcon, OnOptionsMenuClick onClick) {
|
||||
registerOptionsMenuItem(resItemId, resName, resIcon, true, onClick);
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, boolean visibility, OnOptionsMenuClick onClick) {
|
||||
registerOptionsMenuItem(resItemId, resName, -1, visibility, onClick);
|
||||
}
|
||||
|
||||
public void registerOptionsMenuItem(int resItemId, int resName, OnOptionsMenuClick onClick) {
|
||||
registerOptionsMenuItem(resItemId, resName, -1, true, onClick);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.view.Menu;
|
||||
|
||||
public abstract class OsmandPlugin {
|
||||
|
||||
|
@ -120,10 +119,6 @@ public abstract class OsmandPlugin {
|
|||
|
||||
public void registerOptionsMenuItems(MapActivity mapActivity, OptionsMenuHelper helper) {}
|
||||
|
||||
public void prepareOptionsMenuItems(MapActivity mapActivity, Menu menu) {}
|
||||
|
||||
public boolean onOptionsItemSelected(MapActivity mapActivity, int itemId) { return false; }
|
||||
|
||||
public static void refreshLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||
for (OsmandPlugin plugin : activePlugins) {
|
||||
plugin.updateLayers(mapView, activity);
|
||||
|
@ -216,21 +211,6 @@ public abstract class OsmandPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
public static void registerOnPrepareOptionsMenu(MapActivity mapActivity, Menu menu) {
|
||||
for (OsmandPlugin plugin : activePlugins) {
|
||||
plugin.prepareOptionsMenuItems(mapActivity, menu);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean registerOnOptionsMenuItemSelected(MapActivity mapActivity, int itemId) {
|
||||
for (OsmandPlugin plugin : activePlugins) {
|
||||
if (plugin.onOptionsItemSelected(mapActivity, itemId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void installParkingPlugin(OsmandApplication app) {
|
||||
Intent parkingIntent = new Intent();
|
||||
parkingIntent.setComponent(new ComponentName(PARKING_PLUGIN_COMPONENT, PARKING_PLUGIN_ACTIVITY));
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.content.SharedPreferences.Editor;
|
|||
import android.content.pm.ActivityInfo;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.location.LocationManager;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
@ -579,14 +578,13 @@ public class OsmandSettings {
|
|||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SHOW_CAMERAS = new BooleanPreference("show_cameras", true).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SHOW_SPEED_LIMITS = new BooleanPreference("show_speed_limits", true).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_LANES = new BooleanPreference("show_lanes", true).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> AVOID_UNPAVED_ROADS = new BooleanPreference("avoid_unpaved_roads", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> AVOID_FERRIES = new BooleanPreference("avoid_ferries", false).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<Integer> SAVE_TRACK_INTERVAL = new IntPreference("save_track_interval", 5).makeProfile();
|
||||
|
@ -1226,10 +1224,6 @@ public class OsmandSettings {
|
|||
// for background service
|
||||
public final OsmandPreference<Boolean> MAP_ACTIVITY_ENABLED = new BooleanPreference("map_activity_enabled", false).makeGlobal();
|
||||
|
||||
// test animate routing
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> TEST_ANIMATE_ROUTING = new BooleanPreference("animate_routing", false).makeGlobal();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> NATIVE_RENDERING = new BooleanPreference("native_rendering", true).makeGlobal();
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ import net.osmand.plus.ContextMenuAdapter;
|
|||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.OptionsMenuHelper;
|
||||
import net.osmand.plus.OptionsMenuHelper.OnOptionsMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.ResourceManager;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.routing.RouteAnimation;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParams;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.BaseMapLayer;
|
||||
|
@ -57,7 +57,6 @@ import android.location.Location;
|
|||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.Html;
|
||||
import android.util.FloatMath;
|
||||
|
@ -100,7 +99,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
private final MapActivity mapActivity;
|
||||
private OsmandSettings settings;
|
||||
private RoutingHelper routingHelper;
|
||||
private RouteAnimation routeAnimation = new RouteAnimation();
|
||||
private OptionsMenuHelper optionsMenuHelper;
|
||||
|
||||
|
||||
public MapActivityActions(MapActivity mapActivity){
|
||||
this.mapActivity = mapActivity;
|
||||
|
@ -844,138 +844,166 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// NOTE: delete not a "menu.xml" because all id-resources are generated to R-class from there
|
||||
OptionsMenuHelper helper = new OptionsMenuHelper(menu);
|
||||
helper.registerOptionsMenuItem(R.id.map_where_am_i, R.string.where_am_i, android.R.drawable.ic_menu_mylocation);
|
||||
helper.registerOptionsMenuItem(R.id.map_layers, R.string.menu_layers, android.R.drawable.ic_menu_mapmode);
|
||||
helper.registerOptionsMenuItem(R.id.map_show_settings, R.string.settings_Button, android.R.drawable.ic_menu_preferences);
|
||||
helper.registerOptionsMenuItem(R.id.map_navigate_to_point, R.string.stop_navigation, android.R.drawable.ic_menu_close_clear_cancel, false);
|
||||
helper.registerOptionsMenuItem(R.id.map_mute, R.string.menu_mute_off, false);
|
||||
helper.registerOptionsMenuItem(R.id.map_get_directions, R.string.get_directions, android.R.drawable.ic_menu_directions);
|
||||
helper.registerOptionsMenuItem(R.id.map_animate_route, R.string.animate_route, false);
|
||||
helper.registerOptionsMenuItem(R.id.map_specify_point, R.string.search_button, android.R.drawable.ic_menu_search);
|
||||
helper.registerOptionsMenuItem(R.id.map_show_gps_status, R.string.show_gps_status, android.R.drawable.ic_menu_compass);
|
||||
helper.registerOptionsMenuItem(R.id.map_show_point_options, R.string.show_point_options);
|
||||
OsmandPlugin.registerOptionsMenu(mapActivity, helper);
|
||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
optionsMenuHelper = new OptionsMenuHelper();
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.where_am_i, R.string.where_am_i, android.R.drawable.ic_menu_mylocation,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
if (getMyApplication().accessibilityEnabled()) {
|
||||
whereAmIDialog();
|
||||
} else {
|
||||
mapActivity.backToLocationImpl();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.menu_layers, R.string.menu_layers, android.R.drawable.ic_menu_mapmode,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
mapActivity.getMapLayers().openLayerSelectionDialog(mapView);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.settings_Button, R.string.settings_Button, android.R.drawable.ic_menu_preferences,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
final Intent intentSettings = new Intent(mapActivity, OsmandIntents.getSettingsActivity());
|
||||
mapActivity.startActivity(intentSettings);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.stop_navigation, R.string.stop_navigation, android.R.drawable.ic_menu_close_clear_cancel, false,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem navigateToPointMenu) {
|
||||
if (settings.getPointToNavigate() != null) {
|
||||
navigateToPointMenu.setTitle((routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() ||
|
||||
routingHelper.isRouteBeingCalculated()) ? R.string.stop_routing : R.string.stop_navigation);
|
||||
navigateToPointMenu.setVisible(true);
|
||||
} else {
|
||||
navigateToPointMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
if (mapActivity.getMapLayers().getNavigationLayer().getPointToNavigate() != null) {
|
||||
if (routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() || routingHelper.isRouteBeingCalculated()) {
|
||||
routingHelper.setFinalAndCurrentLocation(null, routingHelper.getCurrentLocation(), routingHelper.getCurrentGPXRoute());
|
||||
// restore default mode
|
||||
boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get());
|
||||
mapActivity.updateApplicationModeSettings();
|
||||
mapView.refreshMap(changed);
|
||||
} else {
|
||||
mapActivity.navigateToPoint(null);
|
||||
}
|
||||
} else {
|
||||
mapActivity.navigateToPoint(new LatLon(mapView.getLatitude(), mapView.getLongitude()));
|
||||
}
|
||||
mapView.refreshMap();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.menu_mute_off, R.string.menu_mute_off, false, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem muteMenu) {
|
||||
if (routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode()) {
|
||||
boolean mute = routingHelper.getVoiceRouter().isMute();
|
||||
muteMenu.setTitle(mute ? R.string.menu_mute_on : R.string.menu_mute_off);
|
||||
muteMenu.setIcon(mute ? R.drawable.ic_menu_soundoff : R.drawable.ic_menu_soundon);
|
||||
muteMenu.setVisible(true);
|
||||
} else {
|
||||
muteMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.get_directions, R.string.get_directions, android.R.drawable.ic_menu_directions,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem directions) {
|
||||
if(routingHelper.isRouteCalculated()){
|
||||
directions.setTitle(R.string.show_route);
|
||||
} else {
|
||||
directions.setTitle(R.string.get_directions);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
if (routingHelper.isRouteCalculated()) {
|
||||
aboutRoute();
|
||||
} else {
|
||||
Location loc = mapActivity.getLastKnownLocation();
|
||||
getDirections(loc, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.search_button, R.string.search_button, android.R.drawable.ic_menu_search, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
Intent newIntent = new Intent(mapActivity, OsmandIntents.getSearchActivity());
|
||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
LatLon loc = mapActivity.getMapLocation();
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(newIntent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.show_gps_status, R.string.show_gps_status, android.R.drawable.ic_menu_compass, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
startGpsStatusIntent();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
optionsMenuHelper.registerOptionsMenuItem(R.string.show_point_options, R.string.show_point_options, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem item) {
|
||||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
||||
|
||||
optionsMenuHelper.registerOptionsMenu(menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
MenuItem navigateToPointMenu = menu.findItem(R.id.map_navigate_to_point);
|
||||
if (navigateToPointMenu != null) {
|
||||
if (settings.getPointToNavigate() != null) {
|
||||
navigateToPointMenu.setTitle((routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() ||
|
||||
routingHelper.isRouteBeingCalculated()) ? R.string.stop_routing : R.string.stop_navigation);
|
||||
navigateToPointMenu.setVisible(true);
|
||||
} else {
|
||||
navigateToPointMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
MenuItem muteMenu = menu.findItem(R.id.map_mute);
|
||||
if(muteMenu != null){
|
||||
if (routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode()) {
|
||||
boolean mute = routingHelper.getVoiceRouter().isMute();
|
||||
muteMenu.setTitle(mute ? R.string.menu_mute_on : R.string.menu_mute_off);
|
||||
muteMenu.setIcon(mute ? R.drawable.ic_menu_soundoff : R.drawable.ic_menu_soundon);
|
||||
muteMenu.setVisible(true);
|
||||
} else {
|
||||
muteMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
MenuItem directions = menu.findItem(R.id.map_get_directions);
|
||||
if(routingHelper.isRouteCalculated()){
|
||||
directions.setTitle(R.string.show_route);
|
||||
} else {
|
||||
directions.setTitle(R.string.get_directions);
|
||||
}
|
||||
|
||||
MenuItem animateMenu = menu.findItem(R.id.map_animate_route);
|
||||
|
||||
if (animateMenu != null) {
|
||||
if(settings.TEST_ANIMATE_ROUTING.get()){
|
||||
animateMenu.setTitle(routeAnimation.isRouteAnimating() ? R.string.animate_route_off
|
||||
: R.string.animate_route);
|
||||
animateMenu.setVisible("1".equals(Secure.getString(
|
||||
mapActivity.getContentResolver(), Secure.ALLOW_MOCK_LOCATION))
|
||||
&& settings.getPointToNavigate() != null
|
||||
&& routingHelper.isRouteCalculated());
|
||||
animateMenu.setVisible(true);
|
||||
} else {
|
||||
animateMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
OsmandPlugin.registerOnPrepareOptionsMenu(mapActivity, menu);
|
||||
optionsMenuHelper.prepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
final int itemId = item.getItemId();
|
||||
OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
if (itemId == R.id.map_show_settings) {
|
||||
final Intent intentSettings = new Intent(mapActivity, OsmandIntents.getSettingsActivity());
|
||||
mapActivity.startActivity(intentSettings);
|
||||
return true;
|
||||
} else if (itemId == R.id.map_where_am_i) {
|
||||
if (getMyApplication().accessibilityEnabled()) {
|
||||
whereAmIDialog();
|
||||
} else {
|
||||
mapActivity.backToLocationImpl();
|
||||
}
|
||||
return true;
|
||||
} else if (itemId == R.id.map_show_gps_status) {
|
||||
startGpsStatusIntent();
|
||||
return true;
|
||||
} else if (itemId == R.id.map_specify_point) {
|
||||
Intent newIntent = new Intent(mapActivity, OsmandIntents.getSearchActivity());
|
||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
LatLon loc = mapActivity.getMapLocation();
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
|
||||
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(newIntent);
|
||||
return true;
|
||||
} else {
|
||||
if (itemId == R.id.map_get_directions) {
|
||||
if (routingHelper.isRouteCalculated()) {
|
||||
aboutRoute();
|
||||
} else {
|
||||
Location loc = mapActivity.getLastKnownLocation();
|
||||
getDirections(loc, true);
|
||||
}
|
||||
return true;
|
||||
} else if (itemId == R.id.map_layers) {
|
||||
mapActivity.getMapLayers().openLayerSelectionDialog(mapView);
|
||||
return true;
|
||||
} else if (itemId == R.id.map_mute) {
|
||||
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
||||
return true;
|
||||
} else if (itemId == R.id.map_navigate_to_point) {
|
||||
if (mapActivity.getMapLayers().getNavigationLayer().getPointToNavigate() != null) {
|
||||
if (routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() || routingHelper.isRouteBeingCalculated()) {
|
||||
routingHelper.setFinalAndCurrentLocation(null, routingHelper.getCurrentLocation(), routingHelper.getCurrentGPXRoute());
|
||||
// restore default mode
|
||||
boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get());
|
||||
mapActivity.updateApplicationModeSettings();
|
||||
mapView.refreshMap(changed);
|
||||
} else {
|
||||
mapActivity.navigateToPoint(null);
|
||||
}
|
||||
} else {
|
||||
mapActivity.navigateToPoint(new LatLon(mapView.getLatitude(), mapView.getLongitude()));
|
||||
}
|
||||
mapView.refreshMap();
|
||||
return true;
|
||||
} else if (itemId == R.id.map_show_point_options) {
|
||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
return true;
|
||||
} else if (itemId == R.id.map_animate_route) {
|
||||
// animate moving on route
|
||||
routeAnimation.startStopRouteAnimation(routingHelper, mapActivity);
|
||||
return true;
|
||||
} else {
|
||||
return OsmandPlugin.registerOnOptionsMenuItemSelected(mapActivity, itemId);
|
||||
}
|
||||
}
|
||||
return optionsMenuHelper.onClick(item);
|
||||
}
|
||||
|
||||
private void startGpsStatusIntent() {
|
||||
|
|
|
@ -241,6 +241,8 @@ public class MapActivityLayers {
|
|||
settings.SHOW_POI_OVER_MAP.set(isChecked);
|
||||
} else if(itemId == R.string.layer_poi_label){
|
||||
settings.SHOW_POI_LABEL.set(isChecked);
|
||||
} else if(itemId == R.string.layer_map_appearance){
|
||||
getMapInfoLayer().openViewConfigureDialog();
|
||||
} else if(itemId == R.string.layer_favorites){
|
||||
settings.SHOW_FAVORITES.set(isChecked);
|
||||
} else if(itemId == R.string.layer_gpx_layer){
|
||||
|
@ -265,6 +267,8 @@ public class MapActivityLayers {
|
|||
public void openLayerSelectionDialog(final OsmandMapTileView mapView){
|
||||
final OsmandSettings settings = getApplication().getSettings();
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||
adapter.registerItem(R.string.layer_map_appearance,
|
||||
R.drawable.list_activities_config);
|
||||
adapter.registerSelectedItem(R.string.layer_poi, settings.SHOW_POI_OVER_MAP.get() ? 1 : 0,
|
||||
R.drawable.list_activities_poi);
|
||||
adapter.registerSelectedItem(R.string.layer_poi_label, settings.SHOW_POI_LABEL.get() ? 1 : 0,
|
||||
|
|
|
@ -38,6 +38,7 @@ import android.app.AlertDialog.Builder;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -69,6 +70,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
|
||||
private Preference bidforfix;
|
||||
private Preference plugins;
|
||||
private Preference avoidRouting;
|
||||
private Preference showAlarms;
|
||||
|
||||
private EditTextPreference applicationDir;
|
||||
private ListPreference applicationModePreference;
|
||||
|
@ -273,9 +276,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
registerBooleanPreference(osmandSettings.USE_COMPASS_IN_NAVIGATION, screen);
|
||||
registerBooleanPreference(osmandSettings.LEFT_SIDE_NAVIGATION, screen);
|
||||
|
||||
registerBooleanPreference(osmandSettings.SHOW_CAMERAS, screen);
|
||||
registerBooleanPreference(osmandSettings.SHOW_SPEED_LIMITS, screen);
|
||||
registerBooleanPreference(osmandSettings.AVOID_TOLL_ROADS, screen);
|
||||
// registerBooleanPreference(osmandSettings.SHOW_CAMERAS, screen);
|
||||
// registerBooleanPreference(osmandSettings.SHOW_SPEED_LIMITS, screen);
|
||||
// registerBooleanPreference(osmandSettings.AVOID_TOLL_ROADS, screen);
|
||||
|
||||
|
||||
CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen);
|
||||
|
@ -375,8 +378,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
bidforfix.setOnPreferenceClickListener(this);
|
||||
plugins = (Preference) screen.findPreference("plugins");
|
||||
plugins.setOnPreferenceClickListener(this);
|
||||
|
||||
|
||||
avoidRouting = (Preference) screen.findPreference("avoid_in_routing");
|
||||
avoidRouting.setOnPreferenceClickListener(this);
|
||||
showAlarms = (Preference) screen.findPreference("show_routing_alarms");
|
||||
showAlarms.setOnPreferenceClickListener(this);
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
@ -744,6 +749,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if(preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)){
|
||||
|
@ -759,9 +765,39 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
} else if(preference == plugins){
|
||||
startActivity(new Intent(this, PluginsActivity.class));
|
||||
return true;
|
||||
} else if (preference == avoidRouting) {
|
||||
showBooleanSettings(new String[] { getString(R.string.avoid_toll_roads), getString(R.string.avoid_ferries),
|
||||
getString(R.string.avoid_unpaved) }, new OsmandPreference[] { osmandSettings.AVOID_TOLL_ROADS,
|
||||
osmandSettings.AVOID_FERRIES, osmandSettings.AVOID_UNPAVED_ROADS });
|
||||
return true;
|
||||
} else if(preference == showAlarms){
|
||||
showBooleanSettings(new String[] { getString(R.string.show_cameras), getString(R.string.show_speed_limits),
|
||||
getString(R.string.show_lanes) },
|
||||
new OsmandPreference[] { osmandSettings.SHOW_CAMERAS, osmandSettings.SHOW_SPEED_LIMITS,
|
||||
osmandSettings.SHOW_LANES});
|
||||
return true;
|
||||
} else if(preference.getKey().equals("show_routing_alarms")){
|
||||
startActivity(new Intent(this, PluginsActivity.class));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showBooleanSettings(String[] vals, final OsmandPreference<Boolean>[] prefs) {
|
||||
Builder bld = new AlertDialog.Builder(this);
|
||||
boolean[] checkedItems = new boolean[prefs.length];
|
||||
for(int i=0; i<prefs.length; i++) {
|
||||
checkedItems[i] = prefs[i].get();
|
||||
}
|
||||
bld.setMultiChoiceItems(vals, checkedItems, new OnMultiChoiceClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||
prefs[which].set(isChecked);
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
}
|
||||
|
||||
|
||||
public static void installMapLayers(final Activity activity, final ResultMatcher<TileSourceTemplate> result){
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package net.osmand.plus.development;
|
||||
|
||||
import net.osmand.plus.OptionsMenuHelper;
|
||||
import net.osmand.plus.OptionsMenuHelper.OnOptionsMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
import net.osmand.plus.routing.RouteAnimation;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import android.content.Intent;
|
||||
import android.os.Debug;
|
||||
import android.os.Debug.MemoryInfo;
|
||||
|
@ -14,11 +18,14 @@ import android.preference.Preference;
|
|||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||
private static final String ID = "osmand.development";
|
||||
private OsmandSettings settings;
|
||||
private OsmandApplication app;
|
||||
private RouteAnimation routeAnimation = new RouteAnimation();
|
||||
|
||||
public OsmandDevelopmentPlugin(OsmandApplication app) {
|
||||
this.app = app;
|
||||
|
@ -44,8 +51,29 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
|||
}
|
||||
@Override
|
||||
public void registerLayers(MapActivity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOptionsMenuItems(final MapActivity mapActivity, OptionsMenuHelper helper) {
|
||||
helper.registerOptionsMenuItem(R.string.animate_route, R.string.animate_route, false, new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem animateMenu) {
|
||||
animateMenu.setTitle(routeAnimation.isRouteAnimating() ? R.string.animate_route_off : R.string.animate_route);
|
||||
animateMenu.setVisible(settings.getPointToNavigate() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
// animate moving on route
|
||||
routeAnimation.startStopRouteAnimation(routingHelper, mapActivity);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) {
|
||||
|
@ -58,9 +86,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
|||
CheckBoxPreference dbg = activity.createCheckBoxPreference(settings.DEBUG_RENDERING_INFO,
|
||||
R.string.trace_rendering, R.string.trace_rendering_descr);
|
||||
cat.addPreference(dbg);
|
||||
CheckBoxPreference animate = activity.createCheckBoxPreference(settings.TEST_ANIMATE_ROUTING,
|
||||
R.string.animate_routing, R.string.simulate_route_progression_manually);
|
||||
cat.addPreference(animate);
|
||||
|
||||
Preference pref = new Preference(app);
|
||||
pref.setTitle(R.string.test_voice_prompts);
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.osmand.osm.LatLon;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.OptionsMenuHelper;
|
||||
import net.osmand.plus.OptionsMenuHelper.OnOptionsMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -333,31 +334,26 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerOptionsMenuItems(MapActivity mapActivity, OptionsMenuHelper helper) {
|
||||
public void registerOptionsMenuItems(final MapActivity mapActivity, OptionsMenuHelper helper) {
|
||||
if (parkingLayer != null) {
|
||||
//NOTE: R.id.parking_lim_text - is used just as a stub
|
||||
helper.registerOptionsMenuItem(R.id.parking_lim_text, R.string.osmand_parking_delete, android.R.drawable.ic_menu_mylocation);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MapActivity mapActivity, int itemId) {
|
||||
if (itemId == R.id.parking_lim_text) {
|
||||
showDeleteDialog(mapActivity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareOptionsMenuItems(MapActivity mapActivity, Menu menu) {
|
||||
MenuItem deleteParkingItem = menu.findItem(R.id.parking_lim_text);
|
||||
if (deleteParkingItem != null) {
|
||||
if (settings.getParkingPosition() != null) {
|
||||
deleteParkingItem.setVisible(true);
|
||||
} else {
|
||||
deleteParkingItem.setVisible(false);
|
||||
}
|
||||
helper.registerOptionsMenuItem(R.string.osmand_parking_delete, R.string.osmand_parking_delete, android.R.drawable.ic_menu_mylocation,
|
||||
new OnOptionsMenuClick() {
|
||||
@Override
|
||||
public void prepareOptionsMenu(Menu menu, MenuItem deleteParkingItem) {
|
||||
if (settings.getParkingPosition() != null) {
|
||||
deleteParkingItem.setVisible(true);
|
||||
} else {
|
||||
deleteParkingItem.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
showDeleteDialog(mapActivity);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,8 +199,8 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
NextTurnInfoControl nextNextInfoControl = ric.createNextNextInfoControl(routingHelper, view.getApplication(), view.getSettings(),
|
||||
paintSmallText, paintSmallSubText, true);
|
||||
mapInfoControls.registerSideWidget(nextNextInfoControl, R.drawable.widget_next_turn, R.string.map_widget_next_next_turn, "next_next_turn",true, all, none, 15);
|
||||
MiniMapControl miniMap = ric.createMiniMapControl(routingHelper, view);
|
||||
mapInfoControls.registerSideWidget(miniMap, R.drawable.widget_next_turn, R.string.map_widget_mini_route, "mini_route", true, none, none, 20);
|
||||
//MiniMapControl miniMap = ric.createMiniMapControl(routingHelper, view);
|
||||
//mapInfoControls.registerSideWidget(miniMap, R.drawable.widget_next_turn, R.string.map_widget_mini_route, "mini_route", true, none, none, 20);
|
||||
// right stack
|
||||
TextInfoControl dist = ric.createDistanceControl(map, paintText, paintSubText);
|
||||
mapInfoControls.registerSideWidget(dist, R.drawable.info_target, R.string.map_widget_distance, "distance", false, all, none, 5);
|
||||
|
|
Loading…
Reference in a new issue