Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateViewHelper(inflater, container, savedInstanceState, R.layout.all_episodes_fragment); tvHeader = root.findViewById(R.id.emptyHeader); tvHeader.setText(R.string.no_new_episodes_head_label); tvEmpty = root.findViewById(R.id.empty); <START> tvEmpty.setText(R.string.no_new_episodes_label); <END> ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) { AllEpisodesRecycleAdapter.Holder holder = (AllEpisodesRecycleAdapter.Holder)viewHolder; markItemAsSeenWithUndo(holder.getFeedItem()); } @Override public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) { if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) { if (viewHolder instanceof AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) { AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder itemViewHolder = (AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemSelected(); } } super.onSelectedChanged(viewHolder, actionState); } @Override public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { super.clearView(recyclerView, viewHolder); if (viewHolder instanceof AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) { AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder itemViewHolder = (AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemClear(); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback); itemTouchHelper.attachToRecyclerView(recyclerView); return root; }</code><technical_language>need declare tvEmpty tvHeader variables once. simply do this: root.findViewById(R.id.emptyHeader).setText(R.string.no_new_episodes_head_label);</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateViewHelper(inflater, container, savedInstanceState, R.layout.all_episodes_fragment); ((TextView)root.findViewById(R.id.emptyViewTitle)).setText(R.string.no_new_episodes_head_label); ((TextView)root.findViewById(R.id.emptyViewMessage)).setText(R.string.no_new_episodes_label); ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) { AllEpisodesRecycleAdapter.Holder holder = (AllEpisodesRecycleAdapter.Holder)viewHolder; markItemAsSeenWithUndo(holder.getFeedItem()); } @Override public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) { if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) { if (viewHolder instanceof AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) { AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder itemViewHolder = (AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemSelected(); } } super.onSelectedChanged(viewHolder, actionState); } @Override public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { super.clearView(recyclerView, viewHolder); if (viewHolder instanceof AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) { AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder itemViewHolder = (AllEpisodesRecycleAdapter.ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemClear(); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback); itemTouchHelper.attachToRecyclerView(recyclerView); return root; }