Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c34a56300a
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_LON, location.getLongitude());
|
||||
}
|
||||
|
||||
if(intent != null && getActivity() instanceof SearchAddressActivity) {
|
||||
newIntent.putExtra(SearchByNameAbstractActivity.SELECT_ADDRESS, true);
|
||||
}
|
||||
return newIntent;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,12 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
|
|||
text = hno;
|
||||
}
|
||||
settings.setLastSearchedBuilding(text, loc);
|
||||
if(isSelectAddres()) {
|
||||
finish();
|
||||
} else {
|
||||
showOnMap(loc, AddressInformation.buildBuilding(this, settings));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AddressInformation getAddressInformation() {
|
||||
|
|
|
@ -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_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<T> 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<T> 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<T> 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<T> 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<T> 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<T> 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<T> 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);
|
||||
|
|
|
@ -77,6 +77,10 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity<St
|
|||
@Override
|
||||
public void itemSelected(Street obj) {
|
||||
settings.setLastSearchedIntersectedStreet(obj.getName(region.getLang()), obj.getLocation());
|
||||
if(isSelectAddres()) {
|
||||
finish();
|
||||
} else {
|
||||
showOnMap(obj.getLocation(), AddressInformation.build2StreetIntersection(this, settings));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue