use of com.quran.labs.androidquran.dao.translation.TranslationHeader in project quran_android by quran.
the class TranslationManagerActivity method generateListItems.
private void generateListItems() {
if (allItems == null) {
return;
}
List<TranslationItem> downloaded = new ArrayList<>();
List<TranslationItem> notDownloaded = new ArrayList<>();
for (int i = 0, mAllItemsSize = allItems.size(); i < mAllItemsSize; i++) {
TranslationItem item = allItems.get(i);
if (item.exists()) {
downloaded.add(item);
} else {
notDownloaded.add(item);
}
}
List<TranslationRowData> result = new ArrayList<>();
if (downloaded.size() > 0) {
TranslationHeader hdr = new TranslationHeader(getString(R.string.downloaded_translations));
result.add(hdr);
boolean needsUpgrade = false;
for (TranslationItem item : downloaded) {
result.add(item);
needsUpgrade = needsUpgrade || item.needsUpgrade();
}
if (!needsUpgrade) {
quranSettings.setHaveUpdatedTranslations(false);
}
}
result.add(new TranslationHeader(getString(R.string.available_translations)));
result.addAll(notDownloaded);
adapter.setTranslations(result);
adapter.notifyDataSetChanged();
}
Aggregations