Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Activity activity = getActivity(); this.viewHolder = new ViewHolder(view); viewHolder.listView.setVisibility(View.GONE); viewHolder.loadingIndicator.setVisibility(View.VISIBLE); final FindCoursesListAdapter adapter = new FindCoursesListAdapter(activity, environment) { @Override public void onItemClicked(CourseDetail model) { environment.getRouter().showCourseDetail(activity, model); } }; viewHolder.listView.addHeaderView(new View(getContext()), null, false); viewHolder.listView.addFooterView(new View(getContext()), null, false); InfiniteScrollUtils.configureListViewWithInfiniteList(viewHolder.listView, adapter, new InfiniteScrollUtils.PageLoader<CourseDetail>() { @Override public void loadNextPage(@NonNull final InfiniteScrollUtils.PageLoadCallback<CourseDetail> callback) { if (null != call) { call.cancel(); } call = courseAPI.getCourseList(nextPage); final TaskMessageCallback mCallback = activity instanceof TaskMessageCallback ? (TaskMessageCallback) activity : null; call.enqueue(new ErrorHandlingCallback<Page<CourseDetail>>(activity, null, mCallback, CallTrigger.LOADING_UNCACHED) { @Override protected void onResponse(@NonNull final Page<CourseDetail> coursesPage) { callback.onPageLoaded(coursesPage); ++nextPage; if (null != viewHolder) { <START> if (coursesPage.getCount()==0){ <END> viewHolder.no_courses.setVisibility(View.VISIBLE); viewHolder.listView.setVisibility(View.GONE);; }else { viewHolder.listView.setVisibility(View.VISIBLE); viewHolder.listView.setVisibility(View.VISIBLE); } viewHolder.loadingIndicator.setVisibility(View.GONE); } } @Override protected void onFailure(@NonNull final Throwable error) { callback.onError(); nextPage = 1; if (null != viewHolder) { viewHolder.loadingIndicator.setVisibility(View.GONE); } } }); } }); viewHolder.listView.setOnItemClickListener(adapter); }</code><technical_language>This if-else block some auto-formatting</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Activity activity = getActivity(); this.viewHolder = new ViewHolder(view); viewHolder.listView.setVisibility(View.GONE); viewHolder.loadingIndicator.setVisibility(View.VISIBLE); final FindCoursesListAdapter adapter = new FindCoursesListAdapter(activity, environment) { @Override public void onItemClicked(CourseDetail model) { environment.getRouter().showCourseDetail(activity, model); } }; viewHolder.listView.addHeaderView(new View(getContext()), null, false); viewHolder.listView.addFooterView(new View(getContext()), null, false); InfiniteScrollUtils.configureListViewWithInfiniteList(viewHolder.listView, adapter, new InfiniteScrollUtils.PageLoader<CourseDetail>() { @Override public void loadNextPage(@NonNull final InfiniteScrollUtils.PageLoadCallback<CourseDetail> callback) { if (null != call) { call.cancel(); } call = courseAPI.getCourseList(nextPage); final TaskMessageCallback mCallback = activity instanceof TaskMessageCallback ? (TaskMessageCallback) activity : null; call.enqueue(new ErrorHandlingCallback<Page<CourseDetail>>(activity, null, mCallback, CallTrigger.LOADING_UNCACHED) { @Override protected void onResponse(@NonNull final Page<CourseDetail> coursesPage) { callback.onPageLoaded(coursesPage); ++nextPage; if (null != viewHolder) { if (coursesPage.getCount()==0){ viewHolder.no_courses.setVisibility(View.VISIBLE); viewHolder.listView.setVisibility(View.GONE); }else { viewHolder.no_courses.setVisibility(View.GONE); viewHolder.listView.setVisibility(View.VISIBLE); } viewHolder.loadingIndicator.setVisibility(View.GONE); } } @Override protected void onFailure(@NonNull final Throwable error) { callback.onError(); nextPage = 1; if (null != viewHolder) { viewHolder.loadingIndicator.setVisibility(View.GONE); } } }); } }); viewHolder.listView.setOnItemClickListener(adapter); }