Search in sources :

Example 1 with SearchMoreItemOnClickListener

use of net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener in project Osmand by osmandapp.

the class QuickSearchDialogFragment method addMoreButton.

private void addMoreButton(boolean searchMoreAvailable) {
    if (!paused && !cancelPrev && mainSearchFragment != null && !isTextEmpty()) {
        QuickSearchMoreListItem moreListItem = new QuickSearchMoreListItem(app, null, new SearchMoreItemOnClickListener() {

            @Override
            public void increaseRadiusOnClick() {
                if (!interruptedSearch) {
                    SearchSettings settings = searchUICore.getSearchSettings();
                    searchUICore.updateSettings(settings.setRadiusLevel(settings.getRadiusLevel() + 1));
                }
                runCoreSearch(searchQuery, false, true);
            }

            @Override
            public void onlineSearchOnClick() {
                startOnlineSearch();
                mainSearchFragment.getAdapter().clear();
                updateTabbarVisibility(false);
                runCoreSearch(searchQuery, false, true);
            }
        });
        moreListItem.setInterruptedSearch(interruptedSearch);
        moreListItem.setEmptySearch(isResultEmpty());
        moreListItem.setOnlineSearch(isOnlineSearch());
        moreListItem.setSearchMoreAvailable(searchMoreAvailable);
        mainSearchFragment.addListItem(moreListItem);
    }
}
Also used : QuickSearchMoreListItem(net.osmand.plus.search.listitems.QuickSearchMoreListItem) SearchMoreItemOnClickListener(net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener) SearchSettings(net.osmand.search.core.SearchSettings)

Aggregations

QuickSearchMoreListItem (net.osmand.plus.search.listitems.QuickSearchMoreListItem)1 SearchMoreItemOnClickListener (net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener)1 SearchSettings (net.osmand.search.core.SearchSettings)1