This commit is contained in:
Alexey Kulish 2016-11-21 17:15:36 +03:00
parent 5bc6cb9ad9
commit 53434d7527
4 changed files with 31 additions and 13 deletions

View file

@ -10,6 +10,11 @@
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="legacy_search">Legacy search</string>
<string name="show_legacy_search">Show legacy search</string>
<string name="show_legacy_search_desc">Enable legacy search in the drawer list</string>
<string name="routing_attr_allow_motorway_name">Allow motorways</string>
<string name="routing_attr_allow_motorway_description">Allow motorways</string>
<string name="upload_osm_note_description">You can upload your OSM Note anonymously or using your OpenStreetMap.org profile.</string>
<string name="wiki_around">Nearby Wikipedia articles</string>
<string name="search_map_hint">Search city or region</string>

View file

@ -1119,7 +1119,9 @@ public class OsmandSettings {
public final OsmandPreference<String> OSMO_GROUPS = new StringPreference("osmo_groups", "{}").makeGlobal();
public final OsmandPreference<Boolean> NO_DISCOUNT_INFO = new BooleanPreference("no_discount_info", false).makeGlobal();
public final OsmandPreference<Boolean> SHOW_LEGACY_SEARCH = new BooleanPreference("show_legacy_search", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> DEBUG_RENDERING_INFO = new BooleanPreference("debug_rendering", false).makeGlobal();

View file

@ -628,22 +628,31 @@ public class MapActivityActions implements DialogProvider {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW_IF_EXPIRED, false);
/*
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getSearchActivity());
LatLon loc = mapActivity.getMapLocation();
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
if (mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation()) {
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
*/
return true;
}
}).createItem());
if (settings.SHOW_LEGACY_SEARCH.get()) {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.legacy_search, mapActivity)
.setIcon(R.drawable.ic_action_search_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getSearchActivity());
LatLon loc = mapActivity.getMapLocation();
newIntent.putExtra(SearchActivity.SEARCH_LAT, loc.getLatitude());
newIntent.putExtra(SearchActivity.SEARCH_LON, loc.getLongitude());
if (mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation()) {
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
}
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;
}
}).createItem());
}
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
.setIcon(R.drawable.ic_action_layers_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {

View file

@ -86,6 +86,8 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.NO_DISCOUNT_INFO,
R.string.no_update_info, R.string.no_update_info_desc));
cat.addPreference(createCheckBoxPreference(settings.SHOW_LEGACY_SEARCH,
R.string.show_legacy_search, R.string.show_legacy_search_desc));
// FIXME delete USE_MAP_MARKERS
// cat.addPreference(createCheckBoxPreference(settings.USE_MAP_MARKERS,