Filter out books with null language

This commit is contained in:
Bradlee Speice 2014-12-14 21:20:05 -05:00
parent 651a319edd
commit 60075184ea

View File

@ -120,7 +120,7 @@ public class BookListFragment extends BaseFragment {
} }
void displayLanguageSpinner() { void displayLanguageSpinner() {
ArrayAdapter<Object> adapter = new ArrayAdapter<Object>(this.getActivity(), ArrayAdapter<Object> adapter = new ArrayAdapter<>(this.getActivity(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
availableLanguages.toArray()); availableLanguages.toArray());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@ -166,6 +166,12 @@ public class BookListFragment extends BaseFragment {
return book.getBookCategory() == category; return book.getBookCategory() == category;
} }
}) })
.filter(new Func1<Book, Boolean>() {
@Override
public Boolean call(Book book) {
return book.getLanguage() != null;
}
})
.filter(new Func1<Book, Boolean>() { .filter(new Func1<Book, Boolean>() {
@Override @Override
public Boolean call(Book book) { public Boolean call(Book book) {