public CurrentSongCollectionViewCell(CGRect frame) : base(frame) { BackgroundColor = UIColor.Gray; ContentView.Add(backgroundImageView = new BlurredImageView { Image = Images.GetDefaultAlbumArt(albumArtWidth) }.StyleBlurredImageView()); ContentView.Add(albumArtImageView = new UIImageView(Images.GetDefaultAlbumArt(albumArtWidth)) { Frame = new CGRect(0, 0, albumArtWidth, albumArtWidth), ContentMode = UIViewContentMode.ScaleAspectFit, Layer = { BorderColor = UIColor.LightGray.CGColor, BorderWidth = .5f, }, }); ContentView.Add(videoView = new VideoView { Frame = new CGRect(0, 0, albumArtWidth, albumArtWidth), Hidden = !Settings.CurrentPlaybackIsVideo }); ContentView.Add(labelView = new TwoLabelView() { TopLabel = { TextAlignment = UITextAlignment.Center }, BottomLabel = { TextAlignment = UITextAlignment.Center }, AccessibilityIdentifier = "NowPlayingBar", }); labelView.AddGestureRecognizer( new UITapGestureRecognizer(() => { NotificationManager.Shared.ProcToggleNowPlaying(); })); Add(smallArtImageView = new UIImageView(new CGRect(0, 0, NowPlayingViewController.AlbumArtWidth, NowPlayingViewController.AlbumArtWidth)) { Layer = { BorderColor = UIColor.LightGray.CGColor, BorderWidth = .5f, } }); this.ClipsToBounds = true; }
public BottomView() { Add(backgroundBluredView = new BluredView()); Add(slider = new ProgressView()); Add(timeLabel = new UILabel { Text = "0000:00", AccessibilityIdentifier = "CurrentTime" }.StyleAsSubText()); Add(remainingTimeLabel = new UILabel { Text = "0000:00", AccessibilityIdentifier = "RemainingTime", TextAlignment = UITextAlignment.Right }.StyleAsSubText()); timeLabel.SizeToFit(); remainingTimeLabel.SizeToFit(); Add(labelView = new TwoLabelView { TopLabel = { TextAlignment = UITextAlignment.Center }, BottomLabel = { TextAlignment = UITextAlignment.Center }, }); labelView.TopLabel.StylePlaybackControl(); labelView.BottomLabel.StylePlaybackControl(); var buttonFrame = new CGRect(0, 0, 44, 44); Add(thumbsDownButton = new SimpleButton { Image = Images.GetThumbsDownImage(25).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "ThumbsDown", TintColor = UIColor.Black, Tapped = async(b) => { var song = MusicManager.Shared.GetCurrentSong(); if (song.Rating != 1) { await MusicManager.Shared.ThumbsDown(song); } else { await MusicManager.Shared.Unrate(song); } SetThumbsState(song); } }); Add(thumbsUpButton = new SimpleButton { Image = Images.GetThumbsUpImage(25).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "ThumbsUp", TintColor = UIColor.Black, Tapped = async(b) => { var song = MusicManager.Shared.GetCurrentSong(); if (song.Rating != 5) { await MusicManager.Shared.ThumbsUp(song); } else { await MusicManager.Shared.Unrate(song); } SetThumbsState(song); } }); Add(previousButton = new SimpleButton { Image = Images.GetPreviousButton(nextbuttonSize), Frame = buttonFrame, AccessibilityIdentifier = "Previous", Tapped = button => PlaybackManager.Shared.Previous(), }); Add(playButton = new SimpleButton { Image = Images.GetPlaybackButton(playButtonSize), Frame = buttonFrame, AccessibilityIdentifier = "Play", TintColor = UIColor.Black, Tapped = (button) => PlaybackManager.Shared.PlayPause() }); Add(nextButton = new SimpleButton { Image = Images.GetNextButton(nextbuttonSize), Frame = buttonFrame, AccessibilityIdentifier = "Next", Tapped = (button) => PlaybackManager.Shared.NextTrack() }); Add(volumeView = new MPVolumeView()); volumeView.SetRouteButtonImage(Images.GetAirplayButton(20), UIControlState.Normal); volumeView.TintColor = Style.DefaultStyle.AccentColor; Add(shareButton = new SimpleButton { Image = Images.GetShareIcon(18).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "Share", Tapped = (b) => ShareSong(), Enabled = false, }); Add(shuffleButton = new SimpleButton { Image = Images.GetShuffleImage(18).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "Shuffle", Tapped = (button) => PlaybackManager.Shared.ToggleRandom(), }); Add(repeatButton = new SimpleButton { Image = Images.GetRepeatImage(18).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "Repeat", Tapped = (button) => PlaybackManager.Shared.ToggleRepeat(), }); Add(menuButton = new SimpleButton { Image = Images.DisclosureImage.Value.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), Frame = buttonFrame, AccessibilityIdentifier = "More", TintColor = UIColor.Black, Tapped = (b) => { PopupManager.Shared.ShowNowPlaying(b); } }); }