Show all villages if no cities are present in region
This commit is contained in:
parent
57d10bf279
commit
b042a6e27b
2 changed files with 12 additions and 2 deletions
|
@ -296,7 +296,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
|||
protected void finishInitializing(List<T> list){
|
||||
Comparator<? super T> cmp = createComparator();
|
||||
getListAdapter().sort(cmp);
|
||||
if(list != null){
|
||||
if (list != null) {
|
||||
Collections.sort(list,cmp);
|
||||
initialListToFilter = list;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,16 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity<City>
|
|||
private Button searchVillages;
|
||||
private OsmandSettings osmandSettings;
|
||||
|
||||
@Override
|
||||
protected void finishInitializing(List<City> list) {
|
||||
// Show villages if cities are not present in this region
|
||||
if (list != null && list.isEmpty()) {
|
||||
searchVillagesMode = 0;
|
||||
searchVillages.setVisibility(View.GONE);
|
||||
}
|
||||
super.finishInitializing(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
//This is really only a "clear input text field", hence do not reset settings here
|
||||
|
@ -141,7 +151,7 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity<City>
|
|||
private void redefineSearchVillagesMode(int queryLen) {
|
||||
if (searchVillagesMode == 1) {
|
||||
searchVillagesMode = 0;
|
||||
} else if (searchVillagesMode == 0 && queryLen <= 3) {
|
||||
} else if (searchVillagesMode == 0 && queryLen <= 3 && !initialListToFilter.isEmpty()) {
|
||||
searchVillagesMode = -1;
|
||||
uiHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue