// TODO: use some sort of map instead
private void reloadItemsList() {
        documentPartsDataSource.ensureConnectionIsOpen();
        List<DocumentCollectionItem> documentCollectionItems = new ArrayList<>();
        Log.d("DocCollectionActivity", "Checking filetypes to add");
        for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
            Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
            // TODO: use some sort of map instead
            boolean isPresent = false;
            for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
                if (documentPart.getType().equals(fileType)) {
                    DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_present_title), fileType, true);
                    documentCollectionItems.add(docData);
                    isPresent = true;
                    break;
                }
            }
            if (!isPresent) {
                Log.d("DocCollectionActivity", "File type not found in documentparts, add as TO-DO");
                DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_not_present_title), fileType, false);
                documentCollectionItems.add(docData);
            }
        }
        listView = (ListView) findViewById(R.id.documentlist);
        DocumentCollectionViewAdapter listViewAdapter = new DocumentCollectionViewAdapter(this, R.layout.fragment_document, documentCollectionItems);
        listView.setAdapter(listViewAdapter);
    }
for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
// TODO: use some sort of map instead
boolean isPresent = false;
for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
private void reloadItemsList() {
documentPartsDataSource.ensureConnectionIsOpen();
List<DocumentCollectionItem> documentCollectionItems = new ArrayList<>();
Log.d("DocCollectionActivity", "Checking filetypes to add");
for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
// TODO: use some sort of map instead
boolean isPresent = false;
for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
if (documentPart.getType().equals(fileType)) {
DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_present_title), fileType, true);
documentCollectionItems.add(docData);
isPresent = true;
break;
}
}
if (!isPresent) {
private void reloadItemsList() {
documentPartsDataSource.ensureConnectionIsOpen();
List<DocumentCollectionItem> documentCollectionItems = new ArrayList<>();
Log.d("DocCollectionActivity", "Checking filetypes to add");
for (FileType fileType : SectionsProvider.getFileTypesForSectionModel(sectionModel)) {
Log.d("DocCollectionActivity", "Checking filetype: " + fileType);
// TODO: use some sort of map instead
boolean isPresent = false;
for (DocumentPart documentPart : documentPartsDataSource.getDocumentPartsForSection(sectionModel)) {
if (documentPart.getType().equals(fileType)) {
DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_present_title), fileType, true);
documentCollectionItems.add(docData);
isPresent = true;
break;
}
}
if (!isPresent) {
Log.d("DocCollectionActivity", "File type not found in documentparts, add as TO-DO");
DocumentCollectionItem docData = new DocumentCollectionItem(getString(fileType.getNameResourceId()), getString(R.string.document_collection_list_item_not_present_title), fileType, false);
documentCollectionItems.add(docData);
}
}
listView = (ListView) findViewById(R.id.documentlist);
DocumentCollectionViewAdapter listViewAdapter = new DocumentCollectionViewAdapter(this, R.layout.fragment_document, documentCollectionItems);
listView.setAdapter(listViewAdapter);
}