use of forpdateam.ru.forpda.api.qms.models.QmsContact in project ForPDA by RadiationX.
the class QmsContactsFragment method bindView.
private void bindView() {
if (realm.isClosed())
return;
results = realm.where(QmsContactBd.class).findAll();
if (results.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_contacts).setTitle(R.string.funny_contacts_nodata_title);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
ArrayList<QmsContact> currentItems = new ArrayList<>();
for (QmsContactBd qmsContactBd : results) {
QmsContact contact = new QmsContact(qmsContactBd);
currentItems.add(contact);
}
int count = 0;
for (QmsContact contact : currentItems) {
if (contact.getCount() > 0) {
count += contact.getCount();
}
}
ClientHelper.setQmsCount(count);
ClientHelper.get().notifyCountsChanged();
adapter.addAll(currentItems);
}
Aggregations