Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
78e254a457
2 changed files with 9 additions and 6 deletions
|
@ -39,7 +39,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
public class SearchUICore {
|
||||
|
||||
private static final int TIMEOUT_BETWEEN_CHARS = 400;
|
||||
private static final int TIMEOUT_BETWEEN_CHARS = 700;
|
||||
private static final int TIMEOUT_BEFORE_SEARCH = 50;
|
||||
private static final Log LOG = PlatformUtil.getLog(SearchUICore.class);
|
||||
private SearchPhrase phrase;
|
||||
private SearchResultCollection currentSearchResult;
|
||||
|
@ -353,7 +354,7 @@ public class SearchUICore {
|
|||
return this.phrase;
|
||||
}
|
||||
|
||||
public SearchResultCollection search(final String text, final ResultMatcher<SearchResult> matcher) {
|
||||
public SearchResultCollection search(final String text, final boolean updateResult, final ResultMatcher<SearchResult> matcher) {
|
||||
final int request = requestNumber.incrementAndGet();
|
||||
final SearchPhrase phrase = this.phrase.generateNewPhrase(text, searchSettings);
|
||||
this.phrase = phrase;
|
||||
|
@ -369,10 +370,12 @@ public class SearchUICore {
|
|||
onSearchStart.run();
|
||||
}
|
||||
SearchResultMatcher rm = new SearchResultMatcher(matcher, phrase, request, requestNumber, totalLimit);
|
||||
if(TIMEOUT_BETWEEN_CHARS > 0) {
|
||||
if (TIMEOUT_BETWEEN_CHARS > 0 && updateResult) {
|
||||
Thread.sleep(TIMEOUT_BETWEEN_CHARS);
|
||||
} else if (TIMEOUT_BEFORE_SEARCH > 0) {
|
||||
Thread.sleep(TIMEOUT_BEFORE_SEARCH);
|
||||
}
|
||||
if(rm.isCancelled()) {
|
||||
if (rm.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
searchInBackground(phrase, rm);
|
||||
|
|
|
@ -1072,7 +1072,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
searchEditText.setHint(R.string.type_city_town);
|
||||
startCitySearch();
|
||||
updateTabbarVisibility(false);
|
||||
runSearch();
|
||||
runCoreSearch("", false, false);
|
||||
searchEditText.requestFocus();
|
||||
AndroidUtils.softKeyboardDelayed(searchEditText);
|
||||
}
|
||||
|
@ -1249,7 +1249,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
|
||||
private void runCoreSearchInternal(String text, boolean updateResult, boolean searchMore) {
|
||||
SearchResultCollection c = searchUICore.search(text, new ResultMatcher<SearchResult>() {
|
||||
SearchResultCollection c = searchUICore.search(text, updateResult, new ResultMatcher<SearchResult>() {
|
||||
SearchResultCollection regionResultCollection = null;
|
||||
SearchCoreAPI regionResultApi = null;
|
||||
List<SearchResult> results = new ArrayList<>();
|
||||
|
|
Loading…
Reference in a new issue