for (Book doc : allDocuments) { BookFilter filter = DOCUMENT_TYPE_SPINNER_FILTERS[selectedDocumentFilterNo]; if (filter.test(doc) && doc.getLanguage().equals(lang)) { displayedDocuments.add(doc);
protected Language getDefaultLanguage() { // get the current language code String langCode = Locale.getDefault().getLanguage(); if (!new Language(langCode).isValidLanguage()) { langCode = Locale.ENGLISH.getLanguage(); } // create the JSword Language for current lang Language localLanguage = new Language(langCode); Log.d(TAG, "Local language is:"+localLanguage); // check a bible exists in current lang otherwise use english boolean foundBibleInLocalLanguage = false; for (Book book : getAllDocuments()) { if (book.getBookCategory().equals(BookCategory.BIBLE) && localLanguage.equals(book.getLanguage())) { foundBibleInLocalLanguage = true; break; } } // if no bibles exist in current lang then fall back to default language (English) so the user will not see an initially empty list if (!foundBibleInLocalLanguage) { Log.d(TAG, "No bibles found in local language so falling back to default lang"); localLanguage = Language.DEFAULT_LANG; } return localLanguage; }
@Override public boolean equals(Object obj) { // The real bit ... Book thatBook = ((BookKey)obj).book; return book.getBookCategory().equals(thatBook.getBookCategory()) && book.getAbbreviation().equals(thatBook.getAbbreviation()) && book.getLanguage().equals(thatBook.getLanguage()); }
String prevName = firstBook.getInitials(); showDiffs[i - 1] = comparingBooks && BookCategory.BIBLE.equals(category) && category.equals(prevCategory) && book.getLanguage().equals(firstBook.getLanguage()) && !book.getInitials().equals(prevName);