Search in sources :

Example 1 with FunnyContent

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();
}
Also used : FunnyContent(forpdateam.ru.forpda.ui.views.FunnyContent)

Example 2 with FunnyContent

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();
}
Also used : FunnyContent(forpdateam.ru.forpda.ui.views.FunnyContent)

Example 3 with FunnyContent

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);
    }
}
Also used : FunnyContent(forpdateam.ru.forpda.ui.views.FunnyContent)

Example 4 with FunnyContent

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);
}
Also used : FunnyContent(forpdateam.ru.forpda.ui.views.FunnyContent)

Example 5 with FunnyContent

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();
    }
}
Also used : FunnyContent(forpdateam.ru.forpda.ui.views.FunnyContent) IFavItem(forpdateam.ru.forpda.api.favorites.interfaces.IFavItem) FavItem(forpdateam.ru.forpda.api.favorites.models.FavItem) ArrayList(java.util.ArrayList)

Aggregations

FunnyContent (forpdateam.ru.forpda.ui.views.FunnyContent)9 ArrayList (java.util.ArrayList)3 SuppressLint (android.annotation.SuppressLint)1 RecyclerView (android.support.v7.widget.RecyclerView)1 IFavItem (forpdateam.ru.forpda.api.favorites.interfaces.IFavItem)1 FavItem (forpdateam.ru.forpda.api.favorites.models.FavItem)1 IQmsContact (forpdateam.ru.forpda.api.qms.interfaces.IQmsContact)1 QmsContact (forpdateam.ru.forpda.api.qms.models.QmsContact)1 CustomWebChromeClient (forpdateam.ru.forpda.common.webview.CustomWebChromeClient)1 CustomWebViewClient (forpdateam.ru.forpda.common.webview.CustomWebViewClient)1 NoteItem (forpdateam.ru.forpda.data.models.notes.NoteItem)1 NoteItemBd (forpdateam.ru.forpda.data.realm.notes.NoteItemBd)1 QmsContactBd (forpdateam.ru.forpda.data.realm.qms.QmsContactBd)1 ExtendedWebView (forpdateam.ru.forpda.ui.views.ExtendedWebView)1