Search in sources :

Example 1 with ReaderPostAdapter

use of org.wordpress.android.ui.reader.adapters.ReaderPostAdapter in project WordPress-Android by wordpress-mobile.

the class ReaderPostListFragment method getPostAdapter.

private ReaderPostAdapter getPostAdapter() {
    if (mPostAdapter == null) {
        AppLog.d(T.READER, "reader post list > creating post adapter");
        Context context = WPActivityUtils.getThemedContext(getActivity());
        mPostAdapter = new ReaderPostAdapter(context, getPostListType());
        mPostAdapter.setOnPostSelectedListener(this);
        mPostAdapter.setOnPostPopupListener(this);
        mPostAdapter.setOnDataLoadedListener(mDataLoadedListener);
        mPostAdapter.setOnDataRequestedListener(mDataRequestedListener);
        if (getActivity() instanceof ReaderSiteHeaderView.OnBlogInfoLoadedListener) {
            mPostAdapter.setOnBlogInfoLoadedListener((ReaderSiteHeaderView.OnBlogInfoLoadedListener) getActivity());
        }
        if (getPostListType().isTagType()) {
            mPostAdapter.setCurrentTag(getCurrentTag());
        } else if (getPostListType() == ReaderPostListType.BLOG_PREVIEW) {
            mPostAdapter.setCurrentBlogAndFeed(mCurrentBlogId, mCurrentFeedId);
        } else if (getPostListType() == ReaderPostListType.SEARCH_RESULTS) {
            ReaderTag searchTag = ReaderSearchService.getTagForSearchQuery(mCurrentSearchQuery);
            mPostAdapter.setCurrentTag(searchTag);
        }
    }
    return mPostAdapter;
}
Also used : Context(android.content.Context) ReaderTag(org.wordpress.android.models.ReaderTag) ReaderPostAdapter(org.wordpress.android.ui.reader.adapters.ReaderPostAdapter) ReaderSiteHeaderView(org.wordpress.android.ui.reader.views.ReaderSiteHeaderView)

Aggregations

Context (android.content.Context)1 ReaderTag (org.wordpress.android.models.ReaderTag)1 ReaderPostAdapter (org.wordpress.android.ui.reader.adapters.ReaderPostAdapter)1 ReaderSiteHeaderView (org.wordpress.android.ui.reader.views.ReaderSiteHeaderView)1