[Quick search] stable search for all types
This commit is contained in:
parent
c21c8ad903
commit
c1c02a1076
1 changed files with 5 additions and 13 deletions
|
@ -854,7 +854,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
final SearchPhrase regionPhrase = object.requiredSearchPhrase;
|
final SearchPhrase regionPhrase = object.requiredSearchPhrase;
|
||||||
regionResultCollection =
|
regionResultCollection =
|
||||||
new SearchResultCollection(regionPhrase).addSearchResults(results, true, true);
|
new SearchResultCollection(regionPhrase).addSearchResults(results, true, true);
|
||||||
showRegionResults(regionPhrase, regionResultCollection);
|
showRegionResults(regionResultCollection);
|
||||||
break;
|
break;
|
||||||
case PARTIAL_LOCATION:
|
case PARTIAL_LOCATION:
|
||||||
showLocationToolbar();
|
showLocationToolbar();
|
||||||
|
@ -873,7 +873,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!searchMore || !needAppend(c.getPhrase())) {
|
if (!searchMore) {
|
||||||
setResultCollection(null);
|
setResultCollection(null);
|
||||||
updateSearchResult(null, false);
|
updateSearchResult(null, false);
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!paused) {
|
if (!paused) {
|
||||||
boolean append = needAppend(phrase);
|
boolean append = getResultCollection() != null;
|
||||||
if (append) {
|
if (append) {
|
||||||
getResultCollection().addSearchResults(apiResults, false, true);
|
getResultCollection().addSearchResults(apiResults, false, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -914,13 +914,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showRegionResults(final SearchPhrase regionPhrase, final SearchResultCollection regionResultCollection) {
|
private void showRegionResults(final SearchResultCollection regionResultCollection) {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!paused) {
|
if (!paused) {
|
||||||
boolean append = needAppend(regionPhrase);
|
if (getResultCollection() != null) {
|
||||||
if (append) {
|
|
||||||
SearchResultCollection resCollection =
|
SearchResultCollection resCollection =
|
||||||
getResultCollection().combineWithCollection(regionResultCollection, false, true);
|
getResultCollection().combineWithCollection(regionResultCollection, false, true);
|
||||||
updateSearchResult(resCollection, true);
|
updateSearchResult(resCollection, true);
|
||||||
|
@ -932,13 +931,6 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean needAppend(SearchPhrase phrase) {
|
|
||||||
return getResultCollection() != null && (getResultCollection().getPhrase() == phrase
|
|
||||||
|| (getResultCollection().getPhrase().isLastWord(ObjectType.POI_TYPE) && phrase.isLastWord(ObjectType.POI_TYPE)
|
|
||||||
&& getResultCollection().getPhrase().getLastSelectedWord().getWord().equals(phrase.getLastSelectedWord().getWord())
|
|
||||||
&& !getResultCollection().getPhrase().isUnknownSearchWordPresent() && !phrase.isUnknownSearchWordPresent()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void completeQueryWithObject(SearchResult sr) {
|
public void completeQueryWithObject(SearchResult sr) {
|
||||||
searchUICore.selectSearchResult(sr);
|
searchUICore.selectSearchResult(sr);
|
||||||
String txt = searchUICore.getPhrase().getText(true);
|
String txt = searchUICore.getPhrase().getText(true);
|
||||||
|
|
Loading…
Reference in a new issue