Fix some crashes

This commit is contained in:
NekoInverter committed 2020-11-17 16:07:38 +08:00
1 parent 290d09f390
commit 92df7e9efa
4 files changed
+49 -21

No files matched your search

@@ -152,10 +152,20 @@ public class SearchBar extends MaterialCardView implements View.OnClickListener,
mListView.addItemDecoration(decoration);
mListView.setLayoutManager(layoutManager);
mListView.setOnItemClickListener((parent, view, position, id) -> {
mSuggestionList.get(position).onClick();
return true;
if (position < mSuggestionList.size() - 1) {
mSuggestionList.get(position).onClick();
return true;
} else {
return false;
}
});
mListView.setOnItemLongClickListener((parent, view, position, id) -> {
if (position < mSuggestionList.size() - 1) {
return mSuggestionList.get(position).onLongClick();
} else {
return false;
}
});
mListView.setOnItemLongClickListener((parent, view, position, id) -> mSuggestionList.get(position).onLongClick());
}
private void addListHeader() {