Source:
private void initializeViews(View view) { mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.tasks_swipe_container); mSwipeLayout.setColorSchemeResources(R.color.ws_blue, R.color.facebook_blue, R.color.facebook_dark_blue, R.color.dark_gray); mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSwipeLayout.setRefreshing(true); getTasksRequest(); } }); mListView = (ExpandableListView) view.findViewById(android.R.id.list); mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) { Log.i("asdf", "clicked"); Task taskClicked; if (mArgs.getInt(OPTION) == USER) taskClicked = mUserTaskList.get(mTaskListHeaders.get(groupPosition)).get(childPosition); else taskClicked = mAllTaskList.get(mTaskListHeaders.get(groupPosition)).get(childPosition); TaskDetailFragment detailFragment = TaskDetailFragment.newInstance(taskClicked); mParentActivity.replaceFragment(detailFragment); return false; } }); mListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int topRowVerticalPosition = (mListView == null || mListView.getChildCount() == 0) ? 0 : mListView.getChildAt(0).getTop(); mSwipeLayout.setEnabled((topRowVerticalPosition >= 0)); } }); mNoTasks = (RelativeLayout) view.findViewById(R.id.no_tasks_layout); if (mArgs.getInt(OPTION) == USER) { mUserTaskAdapter = new TaskAdapter(mParentActivity, mTaskListHeaders, mUserTaskList); mListView.setAdapter(mUserTaskAdapter); } else { mAllTaskAdapter = new TaskAdapter(mParentActivity, mTaskListHeaders, mAllTaskList); mListView.setAdapter(mAllTaskAdapter); } }

Target:
private void initializeViews(View view) { mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.tasks_swipe_container); mSwipeLayout.setColorSchemeResources(R.color.ws_blue, R.color.facebook_blue, R.color.facebook_dark_blue, R.color.dark_gray); mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSwipeLayout.setRefreshing(true); getTasksRequest(); } }); mListView = (ExpandableListView) view.findViewById(android.R.id.list); mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) { Task taskClicked; if (mArgs.getInt(OPTION) == USER) taskClicked = mUserTaskList.get(mTaskListHeaders.get(groupPosition)).get(childPosition); else taskClicked = mAllTaskList.get(mTaskListHeaders.get(groupPosition)).get(childPosition); if (taskClicked == null) return false; TaskDetailFragment detailFragment = TaskDetailFragment.newInstance(taskClicked); mParentActivity.replaceFragment(detailFragment); return true; } }); mListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int topRowVerticalPosition = (mListView == null || mListView.getChildCount() == 0) ? 0 : mListView.getChildAt(0).getTop(); mSwipeLayout.setEnabled((topRowVerticalPosition >= 0)); } }); mNoTasks = (TextView) view.findViewById(R.id.no_tasks_layout); if (mArgs.getInt(OPTION) == USER) { mUserTaskAdapter = new TaskAdapter(mParentActivity, mTaskListHeaders, mUserTaskList); mListView.setAdapter(mUserTaskAdapter); } else { mAllTaskAdapter = new TaskAdapter(mParentActivity, mTaskListHeaders, mAllTaskList); mListView.setAdapter(mAllTaskAdapter); } }