public override void OnListItemClick(ListView l, View v, int position, long id) { string videoId = VIDEO_LIST[position].videoId; VideoFragment videoFragment = (VideoFragment)FragmentManager.FindFragmentById(Resource.Id.video_fragment_container); videoFragment.SetVideoId(videoId); // The videoBox is INVISIBLE if no video was previously selected, so we need to show it now. if (videoBox.Visibility != ViewStates.Visible) { if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait) { // Initially translate off the screen so that it can be animated in from below. videoBox.TranslationY = (videoBox.Height); } videoBox.Visibility = ViewStates.Visible; } // If the fragment is off the screen, we animate it in. if (videoBox.TranslationY > 0) { videoBox.Animate().TranslationY(0).SetDuration(300);//ANIMATION_DURATION_MILLIS } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.video_list_demo); listFragment = FragmentManager.FindFragmentById <VideoListFragment>(Resource.Id.list_fragment); videoFragment = FragmentManager.FindFragmentById <VideoFragment>(Resource.Id.video_fragment_container); videoBox = FindViewById(Resource.Id.video_box); closeButton = FindViewById(Resource.Id.close_button); closeButton.Click += (s, e) => { OnClickClose(closeButton); }; videoBox.Visibility = ViewStates.Invisible; DoLayout(); CheckYouTubeApi(); }