diff --git a/OsmAnd/res/layout/search_by_name.xml b/OsmAnd/res/layout/search_by_name.xml index 9b364b3d4b..87c87f696e 100644 --- a/OsmAnd/res/layout/search_by_name.xml +++ b/OsmAnd/res/layout/search_by_name.xml @@ -29,6 +29,7 @@ android:layout_height="wrap_content" android:maxLines="1" android:singleLine="true" + android:inputType="textNoSuggestions" android:lines="1" android:layout_weight="1"/> diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java index bf7d458096..a53df6100c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java @@ -23,7 +23,6 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity createComparator() { @@ -124,7 +123,7 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity extends OsmandListActivity @Override public boolean onCreateOptionsMenu(Menu menu) { if (sequentialSearch) { - OsmandApplication app = ((OsmandApplication) getApplication()); - MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.context_menu_item_directions_to); - MenuItemCompat.setShowAsAction(menuItem, - MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_gdirections_dark)); - menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - select(NAVIGATE_TO); - return true; - } - }); - TargetPointsHelper targets = ((OsmandApplication) getApplication()).getTargetPointsHelper(); - if (targets.getPointToNavigate() != null) { - menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point); - MenuItemCompat.setShowAsAction(menuItem, - MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_flage_dark)); - } else { - menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point); - MenuItemCompat.setShowAsAction(menuItem, - MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - menuItem = menuItem.setIcon(app.getIconsCache().getIcon( R.drawable.ic_action_flag_dark)); - } - menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - select(ADD_WAYPOINT); - return true; - } - }); - menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map); - MenuItemCompat.setShowAsAction(menuItem, - MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_marker_dark)); - - menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - select(SHOW_ON_MAP); - return true; - } - }); - - menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.shared_string_add_to_favorites); - MenuItemCompat.setShowAsAction(menuItem, - MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); - menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_fav_dark)); - - menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - select(ADD_TO_FAVORITE); - return true; - } - }); + createMenuItem(menu, SHOW_ON_MAP, R.string.shared_string_show_on_map, + R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS); } else { createMenuItem(menu, 1, R.string.shared_string_ok, R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS); @@ -600,14 +559,18 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName()); } else if (mode == SHOW_ON_MAP) { - settings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, - ai.getHistoryName()); - MapActivity.launchMapActivityMoveToTop(getActivity()); + showOnMap(searchPoint, ai); } } } + public void showOnMap(LatLon searchPoint, AddressInformation ai) { + settings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, + ai.getHistoryName()); + MapActivity.launchMapActivityMoveToTop(getActivity()); + } + private Activity getActivity() { return this; } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java index 37f985c91a..5ff1c41b44 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java @@ -77,6 +77,6 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity