use of forpdateam.ru.forpda.data.realm.forum.ForumItemFlatBd in project ForPDA by RadiationX.
the class ForumFragment method transformToList.
public void transformToList(List<ForumItemFlatBd> list, ForumItemTree rootForum) {
if (rootForum.getForums() == null)
return;
for (ForumItemTree item : rootForum.getForums()) {
list.add(new ForumItemFlatBd(item));
transformToList(list, item);
}
}
use of forpdateam.ru.forpda.data.realm.forum.ForumItemFlatBd in project ForPDA by RadiationX.
the class ForumFragment method onLoadThemes.
private void onLoadThemes(ForumItemTree forumRoot) {
updateDialog.setMessage(getString(R.string.update_data_base));
if (forumRoot.getForums() == null) {
updateDialog.setMessage(getString(R.string.error_occurred));
new Handler().postDelayed(() -> {
if (updateDialog != null)
updateDialog.cancel();
}, 500);
return;
}
if (realm.isClosed())
return;
realm.executeTransactionAsync(r -> {
r.delete(ForumItemFlatBd.class);
List<ForumItemFlatBd> items = new ArrayList<>();
transformToList(items, forumRoot);
r.copyToRealmOrUpdate(items);
items.clear();
}, this::loadCacheData);
// setSubtitle(data.getAll() <= 1 ? null : "" + data.getCurrent() + "/" + data.getAll());
}
Aggregations