use of net.osmand.plus.search.listitems.QuickSearchTopShadowListItem in project Osmand by osmandapp.
the class QuickSearchListFragment method updateListAdapter.
public void updateListAdapter(List<QuickSearchListItem> listItems, boolean append) {
if (listAdapter != null) {
List<QuickSearchListItem> list = new ArrayList<>(listItems);
if (list.size() > 0) {
list.add(0, new QuickSearchTopShadowListItem(getMyApplication()));
list.add(new QuickSearchBottomShadowListItem(getMyApplication()));
}
listAdapter.setListItems(list);
if (!append) {
getListView().setSelection(0);
}
}
}
use of net.osmand.plus.search.listitems.QuickSearchTopShadowListItem 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);
}
}
}
}
Aggregations