Search in sources :

Example 21 with SearchSettings

use of net.osmand.search.core.SearchSettings in project Osmand by osmandapp.

the class QuickSearchDialogFragment method replaceQueryWithText.

public void replaceQueryWithText(String txt) {
    searchQuery = txt;
    searchEditText.setText(txt);
    searchEditText.setSelection(txt.length());
    SearchWord lastWord = searchUICore.getPhrase().getLastSelectedWord();
    boolean buttonToolbarVisible = lastWord == null || searchType == QuickSearchType.REGULAR || ((searchType == QuickSearchType.START_POINT || searchType == QuickSearchType.DESTINATION || searchType == QuickSearchType.INTERMEDIATE) && ObjectType.isAddress(lastWord.getType()));
    buttonToolbarView.setVisibility(buttonToolbarVisible ? View.VISIBLE : View.GONE);
    updateToolbarButton();
    SearchSettings settings = searchUICore.getSearchSettings();
    if (settings.getRadiusLevel() != 1) {
        searchUICore.updateSettings(settings.setRadiusLevel(1));
    }
    runCoreSearch(txt, false, false);
}
Also used : SearchWord(net.osmand.search.core.SearchWord) SearchSettings(net.osmand.search.core.SearchSettings)

Example 22 with SearchSettings

use of net.osmand.search.core.SearchSettings in project Osmand by osmandapp.

the class QuickSearchDialogFragment method startCitySearch.

private void startCitySearch() {
    SearchSettings settings = searchUICore.getSearchSettings().setEmptyQueryAllowed(true).setSortByName(true).setSearchTypes(ObjectType.CITY, ObjectType.VILLAGE).setRadiusLevel(1);
    searchUICore.updateSettings(settings);
}
Also used : SearchSettings(net.osmand.search.core.SearchSettings)

Example 23 with SearchSettings

use of net.osmand.search.core.SearchSettings in project Osmand by osmandapp.

the class QuickSearchDialogFragment method runSearch.

private void runSearch(String text) {
    showProgressBar();
    SearchSettings settings = searchUICore.getSearchSettings();
    if (settings.getRadiusLevel() != 1) {
        searchUICore.updateSettings(settings.setRadiusLevel(1));
    }
    runCoreSearch(text, true, false);
}
Also used : SearchSettings(net.osmand.search.core.SearchSettings)

Example 24 with SearchSettings

use of net.osmand.search.core.SearchSettings in project Osmand by osmandapp.

the class QuickSearchDialogFragment method showFilter.

public void showFilter(@NonNull String filterId) {
    PoiUIFilter filter = app.getPoiFilters().getFilterById(filterId);
    boolean isCustomFilter = filterId.equals(app.getPoiFilters().getCustomPOIFilter().getFilterId());
    if (isCustomFilter) {
        fabVisible = true;
        poiFilterApplied = true;
        updateFab();
    }
    SearchResult sr = new SearchResult(searchUICore.getPhrase());
    sr.localeName = filter.getName();
    sr.object = filter;
    sr.priority = 0;
    sr.objectType = ObjectType.POI_TYPE;
    searchUICore.selectSearchResult(sr);
    String txt = filter.getName() + " ";
    searchQuery = txt;
    searchEditText.setText(txt);
    searchEditText.setSelection(txt.length());
    updateToolbarButton();
    SearchSettings settings = searchUICore.getSearchSettings();
    if (settings.getRadiusLevel() != 1) {
        searchUICore.updateSettings(settings.setRadiusLevel(1));
    }
    runCoreSearch(txt, false, false);
}
Also used : SearchSettings(net.osmand.search.core.SearchSettings) SearchResult(net.osmand.search.core.SearchResult) SpannableString(android.text.SpannableString) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter)

Aggregations

SearchSettings (net.osmand.search.core.SearchSettings)24 LatLon (net.osmand.data.LatLon)11 SearchResult (net.osmand.search.core.SearchResult)7 SearchResultCollection (net.osmand.search.SearchUICore.SearchResultCollection)6 SearchPhrase (net.osmand.search.core.SearchPhrase)6 ArrayList (java.util.ArrayList)4 SpannableString (android.text.SpannableString)3 SearchWord (net.osmand.search.core.SearchWord)3 SuppressLint (android.annotation.SuppressLint)2 Bundle (android.os.Bundle)2 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 View (android.view.View)2 OnClickListener (android.view.View.OnClickListener)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 Point (java.awt.Point)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 Test (org.junit.Test)2