Source:
<code>private void initDatesBanner(CourseBannerInfoModel courseBannerInfo) { LayoutCourseDatesBannerBinding bannerViewBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.layout_course_dates_banner, listView, false); if (courseBannerInfo != null && !isVideoMode && isOnCourseOutline && !courseBannerInfo.getHasEnded()) { String buttonText = ""; switch (courseBannerInfo.getDatesBannerInfo().getCourseBannerType()) { case UPGRADE_TO_GRADED: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_upgrade_to_graded)); break; case UPGRADE_TO_RESET: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_upgrade_to_reset)); break; case RESET_DATES: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_reset_date)); buttonText = getContextOrThrow().getString(R.string.course_dates_banner_reset_date_button); break; case INFO_BANNER: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_info_banner)); break; case BLANK: break; } <START> <END> if (listView.getHeaderViewsCount() == 0 && !TextUtils.isEmpty(bannerViewBinding.bannerInfo.getText())) { if (!TextUtils.isEmpty(buttonText)) { bannerViewBinding.btnShiftDates.setText(buttonText); bannerViewBinding.btnShiftDates.setVisibility(View.VISIBLE); bannerViewBinding.btnShiftDates.setOnClickListener(v -> { resetCourseDatesBanner(true); }); } listView.addHeaderView(bannerViewBinding.getRoot()); isBannerVisible = true; } } else { listView.removeHeaderView(bannerViewBinding.getRoot()); isBannerVisible = false; } }</code><technical_language>add code: listView.removeHeaderView(bannerViewBinding.getRoot()); isBannerVisible = false;</technical_language>

Target:
private void initDatesBanner(CourseBannerInfoModel courseBannerInfo) { LayoutCourseDatesBannerBinding bannerViewBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.layout_course_dates_banner, listView, false); if (courseBannerInfo != null && !isVideoMode && isOnCourseOutline && !courseBannerInfo.getHasEnded()) { String buttonText = ""; switch (courseBannerInfo.getDatesBannerInfo().getCourseBannerType()) { case UPGRADE_TO_GRADED: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_upgrade_to_graded)); break; case UPGRADE_TO_RESET: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_upgrade_to_reset)); break; case RESET_DATES: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_banner_reset_date)); buttonText = getContextOrThrow().getString(R.string.course_dates_banner_reset_date_button); break; case INFO_BANNER: bannerViewBinding.bannerInfo.setText(getText(R.string.course_dates_info_banner)); break; case BLANK: listView.removeHeaderView(bannerViewBinding.getRoot()); isBannerVisible = false; break; } if (listView.getHeaderViewsCount() == 0 && !TextUtils.isEmpty(bannerViewBinding.bannerInfo.getText())) { if (!TextUtils.isEmpty(buttonText)) { bannerViewBinding.btnShiftDates.setText(buttonText); bannerViewBinding.btnShiftDates.setVisibility(View.VISIBLE); bannerViewBinding.btnShiftDates.setOnClickListener(v -> { resetCourseDatesBanner(); }); } listView.addHeaderView(bannerViewBinding.getRoot()); isBannerVisible = true; } } else { listView.removeHeaderView(bannerViewBinding.getRoot()); isBannerVisible = false; } }