package org.edx.mobile.view;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import org.edx.mobile.R;
import org.edx.mobile.model.course.CourseComponent;
import org.edx.mobile.model.course.VideoBlockModel;
import org.edx.mobile.util.AppConstants;
import org.edx.mobile.util.BrowserUtil;

public class CourseUnitOnlyOnYoutubeFragment extends CourseUnitFragment {

    public static CourseUnitOnlyOnYoutubeFragment newInstance(CourseComponent unit) {
        final CourseUnitOnlyOnYoutubeFragment fragment = new CourseUnitOnlyOnYoutubeFragment();
        final Bundle args = new Bundle();
        args.putSerializable(Router.EXTRA_COURSE_UNIT, unit);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_course_unit_only_on_youtube, container, false);
        if (environment.getConfig().getYoutubeInAppPlayerConfig().isYoutubeEnabled()) {
            ((TextView) view.findViewById(R.id.only_youtube_available_message)).setText(R.string.assessment_needed_updating_youtube);
            view.findViewById(R.id.update_youtube_button).setVisibility(View.VISIBLE);
            view.findViewById(R.id.update_youtube_button).setOnClickListener(v -> {
                BrowserUtil.open(getActivity(), AppConstants.BROWSER_PLAYSTORE_YOUTUBE_URI);
            });
        }

        view.findViewById(R.id.view_on_youtube_button).setOnClickListener(v -> {
            BrowserUtil.open(getActivity(), ((VideoBlockModel) unit).getData().encodedVideos.youtube.url);
        });

        return view;
    }
}

@@ -1187,24 +1187,116 @@
 er, false);%0A
+        TextView tvYouTubeMessage = view.findViewById(R.id.only_youtube_available_message);%0A
         if (
@@ -1387,75 +1387,24 @@
     
-((TextView) view.findViewById(R.id.only_youtube_available_m
+tvYouTubeM
 essage
-))
 .set
@@ -1739,24 +1739,116 @@
 );%0A        %7D
+ else %7B%0A            tvYouTubeMessage.setText(R.string.assessment_only_on_youtube);%0A        %7D
 %0A%0A        vi

Resolve YouTube Message disappear issue