use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class ReputationFragment method onLoadThemes.
private void onLoadThemes(RepData data) {
setRefreshing(false);
if (data.getItems().isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_history).setTitle(R.string.funny_reputation_nodata_title);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
this.data = data;
tryShowAvatar();
adapter.addAll(data.getItems());
paginationHelper.updatePagination(data.getPagination());
refreshToolbarMenuItems(true);
// setSubtitle(paginationHelper.getString());
setSubtitle("" + (data.getPositive() - data.getNegative()) + " (+" + data.getPositive() + " / -" + data.getNegative() + ")");
setTabTitle("Репутация " + data.getNick() + (data.getMode().equals(Reputation.MODE_FROM) ? ": кому изменял" : ""));
setTitle("Репутация " + data.getNick() + (data.getMode().equals(Reputation.MODE_FROM) ? ": кому изменял" : ""));
listScrollTop();
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class MentionsFragment method showMentions.
@Override
public void showMentions(MentionsData data) {
if (data.getItems().isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_notifications).setTitle(R.string.funny_mentions_nodata_title).setDesc(R.string.funny_mentions_nodata_desc);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
adapter.addAll(data.getItems());
paginationHelper.updatePagination(data.getPagination());
setSubtitle(paginationHelper.getTitle());
listScrollTop();
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class ArticleCommentsFragment method createFunny.
private void createFunny(ArrayList<Comment> comments) {
if (comments.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_comment).setTitle(R.string.funny_article_comments_nodata_title);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class HistoryFragment method showHistory.
@Override
public void showHistory(List<HistoryItemBd> history) {
if (history.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_history).setTitle(R.string.funny_history_nodata_title).setDesc(R.string.funny_history_nodata_desc);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
adapter.addAll(history);
}
use of forpdateam.ru.forpda.ui.views.FunnyContent in project ForPDA by RadiationX.
the class FavoritesFragment method onShowFavorite.
@Override
public void onShowFavorite(List<FavItem> items) {
if (items.isEmpty()) {
if (!contentController.contains(ContentController.TAG_NO_DATA)) {
FunnyContent funnyContent = new FunnyContent(getContext()).setImage(R.drawable.ic_star).setTitle(R.string.funny_favorites_nodata_title).setDesc(R.string.funny_favorites_nodata_desc);
contentController.addContent(funnyContent, ContentController.TAG_NO_DATA);
}
contentController.showContent(ContentController.TAG_NO_DATA);
} else {
contentController.hideContent(ContentController.TAG_NO_DATA);
}
ArrayList<FavItem> pinnedUnread = new ArrayList<>();
ArrayList<FavItem> itemsUnread = new ArrayList<>();
ArrayList<FavItem> pinned = new ArrayList<>();
ArrayList<FavItem> otherItems = new ArrayList<>();
for (FavItem item : items) {
if (item.isPin()) {
if (unreadTop && item.isNew()) {
pinnedUnread.add(item);
} else {
pinned.add(item);
}
} else {
if (unreadTop && item.isNew()) {
itemsUnread.add(item);
} else {
otherItems.add(item);
}
}
}
adapter.clear();
if (!pinnedUnread.isEmpty()) {
adapter.addSection(getString(R.string.fav_unreaded_pinned), pinnedUnread);
}
if (!itemsUnread.isEmpty()) {
adapter.addSection(getString(R.string.fav_unreaded), itemsUnread);
}
if (!pinned.isEmpty()) {
adapter.addSection(getString(R.string.fav_pinned), pinned);
}
adapter.addSection(getString(R.string.fav_themes), otherItems);
adapter.notifyDataSetChanged();
if (!ClientHelper.getNetworkState(getContext())) {
ClientHelper.get().notifyCountsChanged();
}
}
Aggregations