Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.reader_fragment_post_cards, container, false); mRecyclerView = (ReaderRecyclerView) rootView.findViewById(R.id.recycler_view); Context context = container.getContext(); int spacingHorizontal = context.getResources().getDimensionPixelSize(R.dimen.reader_card_margin); int spacingVertical = context.getResources().getDimensionPixelSize(R.dimen.reader_card_gutters); boolean skipFirstItem = (getPostListType() == ReaderPostListType.TAG_FOLLOWED); mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical, skipFirstItem)); mNewPostsBar = rootView.findViewById(R.id.layout_new_posts); mNewPostsBar.setVisibility(View.GONE); mNewPostsBar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { scrollRecycleViewToPosition(0); refreshPosts(); } }); mHideNewPostsBarOnScrollOffset = DisplayUtils.dpToPx(context, 10); mEmptyView = rootView.findViewById(R.id.empty_view); mEmptyView.findViewById(R.id.layout_box_images).setVisibility(shouldShowBoxAndPagesAnimation() ? View.VISIBLE : View.GONE); mProgress = (ProgressBar) rootView.findViewById(R.id.progress_footer); mProgress.setVisibility(View.GONE); mSwipeToRefreshHelper = new SwipeToRefreshHelper(getActivity(), (CustomSwipeRefreshLayout) rootView.findViewById(R.id.ptr_layout), new RefreshListener() { @Override public void onRefreshStarted() { if (!isAdded()) { return; } if (!NetworkUtils.checkConnection(getActivity())) { showSwipeToRefreshProgress(false); return; } switch (getPostListType()) { case TAG_FOLLOWED: case TAG_PREVIEW: updatePostsWithTag(getCurrentTag(), UpdateAction.REQUEST_NEWER); break; case BLOG_PREVIEW: updatePostsInCurrentBlogOrFeed(UpdateAction.REQUEST_NEWER); break; } showSwipeToRefreshProgress(true); } } ); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.reader_fragment_post_cards, container, false); mRecyclerView = (ReaderRecyclerView) rootView.findViewById(R.id.recycler_view); Context context = container.getContext(); int spacingHorizontal = context.getResources().getDimensionPixelSize(R.dimen.reader_card_margin); int spacingVertical = context.getResources().getDimensionPixelSize(R.dimen.reader_card_gutters); boolean skipFirstItem = (getPostListType() == ReaderPostListType.TAG_FOLLOWED); mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical, skipFirstItem)); mNewPostsBar = rootView.findViewById(R.id.layout_new_posts); mNewPostsBar.setVisibility(View.GONE); mNewPostsBar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { scrollRecycleViewToPosition(0); refreshPosts(); } }); mEmptyView = rootView.findViewById(R.id.empty_view); mEmptyView.findViewById(R.id.layout_box_images).setVisibility(shouldShowBoxAndPagesAnimation() ? View.VISIBLE : View.GONE); mProgress = (ProgressBar) rootView.findViewById(R.id.progress_footer); mProgress.setVisibility(View.GONE); mSwipeToRefreshHelper = new SwipeToRefreshHelper(getActivity(), (CustomSwipeRefreshLayout) rootView.findViewById(R.id.ptr_layout), new RefreshListener() { @Override public void onRefreshStarted() { if (!isAdded()) { return; } if (!NetworkUtils.checkConnection(getActivity())) { showSwipeToRefreshProgress(false); return; } switch (getPostListType()) { case TAG_FOLLOWED: case TAG_PREVIEW: updatePostsWithTag(getCurrentTag(), UpdateAction.REQUEST_NEWER); break; case BLOG_PREVIEW: updatePostsInCurrentBlogOrFeed(UpdateAction.REQUEST_NEWER); break; } showSwipeToRefreshProgress(true); } } ); return rootView; }