Skip to content

Commit

Permalink
Fix #3280
Browse files Browse the repository at this point in the history
  • Loading branch information
crimean committed Nov 21, 2016
1 parent 5bc6cb9 commit 53434d7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
5 changes: 5 additions & 0 deletions OsmAnd/res/values/strings.xml
Expand Up @@ -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>
Expand Down
4 changes: 3 additions & 1 deletion OsmAnd/src/net/osmand/plus/OsmandSettings.java
Expand Up @@ -1119,7 +1119,9 @@ protected Integer getDefaultValue() {
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();

Expand Down
33 changes: 21 additions & 12 deletions OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
Expand Up @@ -628,22 +628,31 @@ public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int ite
@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() {
Expand Down
Expand Up @@ -86,6 +86,8 @@ public boolean onPreferenceClick(Preference preference) {
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,
Expand Down

0 comments on commit 53434d7

Please sign in to comment.