Update search radius display in the beginnning of search, not just after completion
This commit is contained in:
parent
1274819dc2
commit
a970c43764
2 changed files with 19 additions and 17 deletions
|
@ -179,7 +179,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateButtonState();
|
updateButtonState(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateButtonState();
|
updateButtonState(false);
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
String text = filter.getFilterByName() != null ? filter.getFilterByName() : "";
|
String text = filter.getFilterByName() != null ? filter.getFilterByName() : "";
|
||||||
searchFilter.setText(text);
|
searchFilter.setText(text);
|
||||||
|
@ -325,7 +325,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
filter.setFilterByName(queue.toString());
|
filter.setFilterByName(queue.toString());
|
||||||
runNewSearchQuery(location, SEARCH_AGAIN);
|
runNewSearchQuery(location, SEARCH_AGAIN);
|
||||||
}
|
}
|
||||||
updateButtonState();
|
updateButtonState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtonState() {
|
private void updateButtonState(boolean next) {
|
||||||
if (showFilterItem != null) {
|
if (showFilterItem != null) {
|
||||||
showFilterItem.setVisible(filter != null && !isNameSearch());
|
showFilterItem.setVisible(filter != null && !isNameSearch());
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
if(filter instanceof NominatimPoiFilter && !((NominatimPoiFilter) filter).isPlacesQuery()) {
|
if(filter instanceof NominatimPoiFilter && !((NominatimPoiFilter) filter).isPlacesQuery()) {
|
||||||
// nothing to add
|
// nothing to add
|
||||||
} else {
|
} else {
|
||||||
name += " " + filter.getSearchArea();
|
name += " " + filter.getSearchArea(next);
|
||||||
}
|
}
|
||||||
getSupportActionBar().setTitle(name);
|
getSupportActionBar().setTitle(name);
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
final int top = (v == null) ? 0 : v.getTop();
|
final int top = (v == null) ? 0 : v.getTop();
|
||||||
amenityAdapter.notifyDataSetChanged();
|
amenityAdapter.notifyDataSetChanged();
|
||||||
lv.setSelectionFromTop(index, top);
|
lv.setSelectionFromTop(index, top);
|
||||||
updateButtonState();
|
updateButtonState(false);
|
||||||
navigationInfo.updateLocation(location);
|
navigationInfo.updateLocation(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,6 +615,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
updateExisting.add(getAmenityId(a));
|
updateExisting.add(getAmenityId(a));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateButtonState(requestType == SEARCH_FURTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getAmenityId(Amenity a) {
|
private long getAmenityId(Amenity a) {
|
||||||
|
@ -625,7 +626,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
protected void onPostExecute(List<Amenity> result) {
|
protected void onPostExecute(List<Amenity> result) {
|
||||||
setSupportProgressBarIndeterminateVisibility(false);
|
setSupportProgressBarIndeterminateVisibility(false);
|
||||||
currentSearchTask = null;
|
currentSearchTask = null;
|
||||||
updateButtonState();
|
updateButtonState(false);
|
||||||
if (isNameSearch()) {
|
if (isNameSearch()) {
|
||||||
if (isNominatimFilter() && !Algorithms.isEmpty(((NominatimPoiFilter) filter).getLastError())) {
|
if (isNominatimFilter() && !Algorithms.isEmpty(((NominatimPoiFilter) filter).getLastError())) {
|
||||||
Toast.makeText(SearchPOIActivity.this, ((NominatimPoiFilter) filter).getLastError(),
|
Toast.makeText(SearchPOIActivity.this, ((NominatimPoiFilter) filter).getLastError(),
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
|
|
||||||
protected int distanceInd = 1;
|
protected int distanceInd = 1;
|
||||||
// in kilometers
|
// in kilometers
|
||||||
protected double[] distanceToSearchValues = new double[] {1, 2, 5, 10, 20, 50, 100, 200, 500 };
|
protected double[] distanceToSearchValues = new double[] {1, 2, 5, 10, 20, 50, 100, 200, 500};
|
||||||
|
|
||||||
private final MapPoiTypes poiTypes;
|
private final MapPoiTypes poiTypes;
|
||||||
|
|
||||||
|
@ -181,16 +181,17 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
distanceToSearchValues = new double[] {0.5, 1, 2, 5, 10, 20, 50, 100};
|
distanceToSearchValues = new double[] {0.5, 1, 2, 5, 10, 20, 50, 100};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isSearchFurtherAvailable(){
|
public boolean isSearchFurtherAvailable(){
|
||||||
return distanceInd < distanceToSearchValues.length - 1;
|
return distanceInd < distanceToSearchValues.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSearchArea(boolean next) {
|
||||||
|
int distInd = distanceInd;
|
||||||
|
if (next && (distanceInd < distanceToSearchValues.length - 1)) {
|
||||||
public String getSearchArea(){
|
//This is workaround for the SearchAmenityTask.onPreExecute() case
|
||||||
double val = distanceToSearchValues[distanceInd];
|
distInd = distanceInd + 1;
|
||||||
|
}
|
||||||
|
double val = distanceToSearchValues[distInd];
|
||||||
if(val >= 1){
|
if(val >= 1){
|
||||||
return " < " + OsmAndFormatter.getFormattedDistance(((int)val * 1000), app); //$NON-NLS-1$//$NON-NLS-2$
|
return " < " + OsmAndFormatter.getFormattedDistance(((int)val * 1000), app); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue