Fix issue #1945 -requires additional testing and cherry-picking to r2.2
This commit is contained in:
parent
09ef4a7482
commit
c664c58e98
4 changed files with 25 additions and 9 deletions
|
@ -192,6 +192,10 @@ public class SearchAddressFragment extends Fragment {
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude());
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(intent != null && getActivity() instanceof SearchAddressActivity) {
|
||||||
|
newIntent.putExtra(SearchByNameAbstractActivity.SELECT_ADDRESS, true);
|
||||||
|
}
|
||||||
return newIntent;
|
return newIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,11 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
|
||||||
text = hno;
|
text = hno;
|
||||||
}
|
}
|
||||||
settings.setLastSearchedBuilding(text, loc);
|
settings.setLastSearchedBuilding(text, loc);
|
||||||
showOnMap(loc, AddressInformation.buildBuilding(this, settings));
|
if(isSelectAddres()) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
showOnMap(loc, AddressInformation.buildBuilding(this, settings));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,7 +71,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
|
|
||||||
protected static final int MESSAGE_CLEAR_LIST = OsmAndConstants.UI_HANDLER_SEARCH + 2;
|
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 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 ProgressBar progress;
|
||||||
protected LatLon locationToSearch;
|
protected LatLon locationToSearch;
|
||||||
|
@ -167,6 +167,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
selectAddress = getIntent() != null && getIntent().hasExtra(SELECT_ADDRESS);
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||||
if(initializeTask != null){
|
if(initializeTask != null){
|
||||||
initializeTask.execute();
|
initializeTask.execute();
|
||||||
|
@ -214,7 +215,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
|
|
||||||
|
|
||||||
private int MAX_VISIBLE_NAME = 18;
|
private int MAX_VISIBLE_NAME = 18;
|
||||||
private boolean sequentialSearch;
|
private boolean selectAddress;
|
||||||
|
|
||||||
public String getCurrentFilter() {
|
public String getCurrentFilter() {
|
||||||
return currentFilter;
|
return currentFilter;
|
||||||
|
@ -246,6 +247,10 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
super.onRestoreInstanceState(prevState);
|
super.onRestoreInstanceState(prevState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isSelectAddres() {
|
||||||
|
return selectAddress;
|
||||||
|
}
|
||||||
|
|
||||||
private void querySearch(final String filter) {
|
private void querySearch(final String filter) {
|
||||||
if (!currentFilter.equals(filter) || !initFilter) {
|
if (!currentFilter.equals(filter) || !initFilter) {
|
||||||
currentFilter = filter;
|
currentFilter = filter;
|
||||||
|
@ -332,6 +337,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
selectAddress = getIntent() != null && getIntent().getBooleanExtra(SELECT_ADDRESS, false);
|
||||||
setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
@ -340,14 +346,12 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
sequentialSearch = false;
|
|
||||||
if(intent != null){
|
if(intent != null){
|
||||||
if(intent.hasExtra(SearchActivity.SEARCH_LAT) && intent.hasExtra(SearchActivity.SEARCH_LON)){
|
if(intent.hasExtra(SearchActivity.SEARCH_LAT) && intent.hasExtra(SearchActivity.SEARCH_LON)){
|
||||||
double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0);
|
double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0);
|
||||||
double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0);
|
double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0);
|
||||||
locationToSearch = new LatLon(lat, lon);
|
locationToSearch = new LatLon(lat, lon);
|
||||||
}
|
}
|
||||||
sequentialSearch = intent.hasExtra(SEQUENTIAL_SEARCH) && getAddressInformation() != null;
|
|
||||||
}
|
}
|
||||||
if(locationToSearch == null){
|
if(locationToSearch == null){
|
||||||
locationToSearch = settings.getLastKnownMapLocation();
|
locationToSearch = settings.getLastKnownMapLocation();
|
||||||
|
@ -507,7 +511,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
if(cintent.hasExtra(SearchActivity.SEARCH_LAT) && cintent.hasExtra(SearchActivity.SEARCH_LON)){
|
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_LAT, cintent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0));
|
||||||
intent.putExtra(SearchActivity.SEARCH_LON, cintent.getDoubleExtra(SearchActivity.SEARCH_LON, 0));
|
intent.putExtra(SearchActivity.SEARCH_LON, cintent.getDoubleExtra(SearchActivity.SEARCH_LON, 0));
|
||||||
intent.putExtra(SEQUENTIAL_SEARCH, true);
|
intent.putExtra(SELECT_ADDRESS, selectAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -528,9 +532,9 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
if (sequentialSearch) {
|
if (!selectAddress && getAddressInformation() != null) {
|
||||||
createMenuItem(menu, SHOW_ON_MAP, R.string.shared_string_show_on_map,
|
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 {
|
} else {
|
||||||
createMenuItem(menu, 1, R.string.shared_string_ok,
|
createMenuItem(menu, 1, R.string.shared_string_ok,
|
||||||
R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS);
|
R.drawable.ic_action_done, MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
|
@ -77,6 +77,10 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity<St
|
||||||
@Override
|
@Override
|
||||||
public void itemSelected(Street obj) {
|
public void itemSelected(Street obj) {
|
||||||
settings.setLastSearchedIntersectedStreet(obj.getName(region.getLang()), obj.getLocation());
|
settings.setLastSearchedIntersectedStreet(obj.getName(region.getLang()), obj.getLocation());
|
||||||
showOnMap(obj.getLocation(), AddressInformation.build2StreetIntersection(this, settings));
|
if(isSelectAddres()) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
showOnMap(obj.getLocation(), AddressInformation.build2StreetIntersection(this, settings));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue