diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java index bfe39aacef..ebd16dec26 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java @@ -192,6 +192,10 @@ public class SearchAddressFragment extends Fragment { newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude()); newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude()); } + + if(intent != null && getActivity() instanceof SearchAddressActivity) { + newIntent.putExtra(SearchByNameAbstractActivity.SELECT_ADDRESS, true); + } return newIntent; } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java index a53df6100c..dd2bab774e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchBuildingByNameActivity.java @@ -123,7 +123,11 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity extends OsmandListActivity protected static final int MESSAGE_CLEAR_LIST = OsmAndConstants.UI_HANDLER_SEARCH + 2; protected static final int MESSAGE_ADD_ENTITY = OsmAndConstants.UI_HANDLER_SEARCH + 3; - protected static final String SEQUENTIAL_SEARCH = "SEQUENTIAL_SEARCH"; + protected static final String SELECT_ADDRESS = "SEQUENTIAL_SEARCH"; protected ProgressBar progress; protected LatLon locationToSearch; @@ -167,6 +167,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity } }); + selectAddress = getIntent() != null && getIntent().hasExtra(SELECT_ADDRESS); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); if(initializeTask != null){ initializeTask.execute(); @@ -214,7 +215,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity private int MAX_VISIBLE_NAME = 18; - private boolean sequentialSearch; + private boolean selectAddress; public String getCurrentFilter() { return currentFilter; @@ -246,6 +247,10 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity super.onRestoreInstanceState(prevState); } + protected boolean isSelectAddres() { + return selectAddress; + } + private void querySearch(final String filter) { if (!currentFilter.equals(filter) || !initFilter) { currentFilter = filter; @@ -332,6 +337,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity @Override protected void onResume() { super.onResume(); + selectAddress = getIntent() != null && getIntent().getBooleanExtra(SELECT_ADDRESS, false); setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { @@ -340,14 +346,12 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity } }); Intent intent = getIntent(); - sequentialSearch = false; if(intent != null){ if(intent.hasExtra(SearchActivity.SEARCH_LAT) && intent.hasExtra(SearchActivity.SEARCH_LON)){ double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0); double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0); locationToSearch = new LatLon(lat, lon); } - sequentialSearch = intent.hasExtra(SEQUENTIAL_SEARCH) && getAddressInformation() != null; } if(locationToSearch == null){ locationToSearch = settings.getLastKnownMapLocation(); @@ -507,7 +511,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity if(cintent.hasExtra(SearchActivity.SEARCH_LAT) && cintent.hasExtra(SearchActivity.SEARCH_LON)){ intent.putExtra(SearchActivity.SEARCH_LAT, cintent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0)); intent.putExtra(SearchActivity.SEARCH_LON, cintent.getDoubleExtra(SearchActivity.SEARCH_LON, 0)); - intent.putExtra(SEQUENTIAL_SEARCH, true); + intent.putExtra(SELECT_ADDRESS, selectAddress); } } startActivity(intent); @@ -528,9 +532,9 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity @Override public boolean onCreateOptionsMenu(Menu menu) { - if (sequentialSearch) { + if (!selectAddress && getAddressInformation() != null) { createMenuItem(menu, SHOW_ON_MAP, R.string.shared_string_show_on_map, - R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS); + R.drawable.ic_action_marker_dark, MenuItem.SHOW_AS_ACTION_ALWAYS); } else { createMenuItem(menu, 1, R.string.shared_string_ok, R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java index 5ff1c41b44..ee70a86678 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchStreet2ByNameActivity.java @@ -77,6 +77,10 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity