added boolean isEmpty and refactored some code
This commit is contained in:
parent
befaa12c80
commit
2cacac9b60
1 changed files with 7 additions and 8 deletions
|
@ -116,6 +116,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCityEmpty(City c, SearchResult sr) {
|
public boolean isCityEmpty(City c, SearchResult sr) {
|
||||||
|
final boolean isEmpty[] = new boolean[1];
|
||||||
|
isEmpty[0] = true;
|
||||||
if (c.getStreets().isEmpty()) {
|
if (c.getStreets().isEmpty()) {
|
||||||
ResultMatcher<Street> resultMatcher = new ResultMatcher<Street>() {
|
ResultMatcher<Street> resultMatcher = new ResultMatcher<Street>() {
|
||||||
boolean isCancelled = false;
|
boolean isCancelled = false;
|
||||||
|
@ -123,7 +125,8 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(Street object) {
|
public boolean publish(Street object) {
|
||||||
isCancelled = true;
|
isCancelled = true;
|
||||||
return true;
|
isEmpty[0] = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,17 +136,13 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
sr.file.preloadStreets(c, BinaryMapIndexReader.buildAddressRequest(resultMatcher));
|
sr.file.preloadStreets(c, BinaryMapIndexReader.buildAddressRequest(resultMatcher));
|
||||||
if (c.getStreets().isEmpty()) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
c.unregisterStreet(c.getStreets().get(0));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isEmpty[0] = false;
|
||||||
}
|
}
|
||||||
return false;
|
return isEmpty[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue