Search in sources :

Example 1 with PostsAndPagesAdapter

use of org.wordpress.android.ui.stats.adapters.PostsAndPagesAdapter in project WordPress-Android by wordpress-mobile.

the class StatsCommentsFragment method updateUI.

@Override
protected void updateUI() {
    if (!isAdded()) {
        return;
    }
    if (mCommentsModel == null && mCommentFollowersModel == null) {
        showHideNoResultsUI(true);
        mTotalsLabel.setVisibility(View.GONE);
        mTopPagerContainer.setVisibility(View.GONE);
        return;
    }
    mTopPagerContainer.setVisibility(View.VISIBLE);
    if (mCommentFollowersModel != null) {
        // check if comment-followers is already here
        mTotalsLabel.setVisibility(View.VISIBLE);
        int totalNumberOfFollowers = mCommentFollowersModel.getTotal();
        String totalCommentsFollowers = getString(R.string.stats_comments_total_comments_followers);
        mTotalsLabel.setText(String.format(totalCommentsFollowers, FormatUtils.formatDecimal(totalNumberOfFollowers)));
    }
    ArrayAdapter adapter = null;
    if (mTopPagerSelectedButtonIndex == 0 && hasAuthors()) {
        adapter = new AuthorsAdapter(getActivity(), getAuthors());
    } else if (mTopPagerSelectedButtonIndex == 1 && hasPosts()) {
        adapter = new PostsAndPagesAdapter(getActivity(), getPosts());
    }
    if (adapter != null) {
        StatsUIHelper.reloadLinearLayout(getActivity(), adapter, mList, getMaxNumberOfItemsToShowInList());
        showHideNoResultsUI(false);
    } else {
        showHideNoResultsUI(true);
    }
}
Also used : ArrayAdapter(android.widget.ArrayAdapter) PostsAndPagesAdapter(org.wordpress.android.ui.stats.adapters.PostsAndPagesAdapter)

Example 2 with PostsAndPagesAdapter

use of org.wordpress.android.ui.stats.adapters.PostsAndPagesAdapter in project WordPress-Android by wordpress-mobile.

the class StatsTopPostsAndPagesFragment method updateUI.

@Override
protected void updateUI() {
    if (!isAdded()) {
        return;
    }
    if (hasTopPostsAndPages()) {
        List<StatsPostModel> postViews = mTopPostsAndPagesModel.getTopPostsAndPages();
        ArrayAdapter adapter = new PostsAndPagesAdapter(getActivity(), postViews);
        StatsUIHelper.reloadLinearLayout(getActivity(), adapter, mList, getMaxNumberOfItemsToShowInList());
        showHideNoResultsUI(false);
    } else {
        showHideNoResultsUI(true);
    }
}
Also used : StatsPostModel(org.wordpress.android.ui.stats.models.StatsPostModel) ArrayAdapter(android.widget.ArrayAdapter) PostsAndPagesAdapter(org.wordpress.android.ui.stats.adapters.PostsAndPagesAdapter)

Aggregations

ArrayAdapter (android.widget.ArrayAdapter)2 PostsAndPagesAdapter (org.wordpress.android.ui.stats.adapters.PostsAndPagesAdapter)2 StatsPostModel (org.wordpress.android.ui.stats.models.StatsPostModel)1