Search in sources :

Example 11 with QuickSearchListItem

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

the class QuickSearchListFragment method addListItem.

public void addListItem(QuickSearchListItem listItem) {
    if (listItem != null) {
        if (listAdapter.getCount() == 0) {
            List<QuickSearchListItem> list = new ArrayList<>();
            list.add(new QuickSearchTopShadowListItem(getMyApplication()));
            list.add(listItem);
            list.add(new QuickSearchBottomShadowListItem(getMyApplication()));
            listAdapter.setListItems(list);
        } else {
            QuickSearchListItem lastItem = listAdapter.getItem(listAdapter.getCount() - 1);
            if (lastItem.getType() == QuickSearchListItemType.BOTTOM_SHADOW) {
                listAdapter.insertListItem(listItem, listAdapter.getCount() - 1);
            } else {
                listAdapter.addListItem(listItem);
            }
        }
    }
}
Also used : QuickSearchTopShadowListItem(net.osmand.plus.search.listitems.QuickSearchTopShadowListItem) ArrayList(java.util.ArrayList) QuickSearchListItem(net.osmand.plus.search.listitems.QuickSearchListItem) QuickSearchBottomShadowListItem(net.osmand.plus.search.listitems.QuickSearchBottomShadowListItem)

Aggregations

QuickSearchListItem (net.osmand.plus.search.listitems.QuickSearchListItem)11 ArrayList (java.util.ArrayList)7 SearchResult (net.osmand.search.core.SearchResult)5 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 OnClickListener (android.view.View.OnClickListener)3 AdapterView (android.widget.AdapterView)3 ListView (android.widget.ListView)3 SearchMoreItemOnClickListener (net.osmand.plus.search.listitems.QuickSearchMoreListItem.SearchMoreItemOnClickListener)3 SearchResultCollection (net.osmand.search.SearchUICore.SearchResultCollection)3 SearchPhrase (net.osmand.search.core.SearchPhrase)3 SpannableString (android.text.SpannableString)2 IOException (java.io.IOException)2 List (java.util.List)2 LatLon (net.osmand.data.LatLon)2 AbstractPoiType (net.osmand.osm.AbstractPoiType)2 PoiUIFilter (net.osmand.plus.poi.PoiUIFilter)2 QuickSearchBottomShadowListItem (net.osmand.plus.search.listitems.QuickSearchBottomShadowListItem)2 QuickSearchButtonListItem (net.osmand.plus.search.listitems.QuickSearchButtonListItem)2