Exemplo n.º 1
0
            void LayoutPortrait()
            {
                var  bounds    = Bounds;
                bool showVideo = songId == Settings.CurrentSong && Settings.CurrentPlaybackIsVideo;
                var  maxWidth  = NMath.Max(200, NMath.Min(bounds.Width, 512));
                var  topHeight = NowPlayingViewController.Current.GetCurrentTopHeight();
                var  frame     = new CGRect((bounds.Width - maxWidth) / 2, topHeight + NowPlayingViewController.StatusBarHeight, maxWidth, maxWidth);

                albumArtImageView.Frame = frame;
                if (TopHeight > 0)
                {
                    var top = topHeight + NowPlayingViewController.StatusBarHeight;
                    albumArtImageView.Center = new CGPoint(bounds.Width / 2, top + (TopHeight - top) / 2);
                }
                albumArtImageView.Alpha = showVideo ? Math.Max(0, 1 - (float)currentPercent) : 1;
                frame = bounds;
                var size = (float)Math.Max(frame.Height, frame.Width);

                size       *= 1.35f;
                frame.Width = frame.Height = size;
                backgroundImageView.Frame  = frame;
                backgroundImageView.Center = albumArtImageView.Center;

                var videoFrame = new CGRect(padding, padding, 160, 90);

                videoFrame.Width += (bounds.Width - videoFrame.Width) * currentPercent;
                videoFrame.X     -= currentPercent * padding;
                videoFrame.Height = videoFrame.Width * widthRatio;
                videoFrame.Y      = NMath.Max((topHeight + (videoFrame.Height / 2)) * currentPercent, padding);
                frame.X           = padding;
                frame.Height      = topHeight;
                var w = showVideo ? 160 : NowPlayingViewController.AlbumArtWidth;

                frame.Width = w + padding;
                smallArtImageView.Center = frame.GetCenter();
                smallArtImageView.Hidden = showVideo;

                videoView.Frame  = showVideo ? videoFrame : frame;
                videoView.Hidden = !showVideo;
                if (isVisible)
                {
                    videoView.Show();
                }
                frame.X         = frame.Right;
                frame.Width     = bounds.Width - frame.X - buttonWidth - (padding * 2);
                labelView.Frame = frame;
            }
Exemplo n.º 2
0
 public void Show()
 {
     videoView.Show();
     showOverlay();
 }