Exemple #1
0
            public NowPlayingView(NowPlayingViewController parent)
            {
                Parent             = parent;
                this.ClipsToBounds = true;
                BackgroundColor    = UIColor.Gray;
                collectionView     = new NowPlayingCollectionView();
                Add(collectionView.View);
                Parent.AddChildViewController(collectionView);

                var buttonFrame = new CGRect(0, 0, 44, 44);

                Add(closeButton = new SimpleShadowButton()
                {
                    Image     = Images.GetCloseImage(15).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                    TintColor = Style.DefaultStyle.AccentColor,
                    Tapped    = (b) => Parent?.Close?.Invoke(),
                    Frame     = buttonFrame,
                });
                Add(showCurrentPlaylist = new SimpleShadowButton
                {
                    Image     = Images.GetPlaylistIcon(20).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                    TintColor = Style.DefaultStyle.AccentColor,
                    Tapped    = (b) => Parent?.ShowCurrentPlaylist(),
                    Frame     = buttonFrame,
                });

                Add(playButton = new SimpleButton
                {
                    Frame = new CGRect(0, 0, buttonWidth, buttonWidth),
                    Image = Images.GetBorderedPlaybackButton(buttonWidth),
                    AccessibilityIdentifier = "Play",
                    Tapped = (b) => { PlaybackManager.Shared.PlayPause(); }
                }.StylePlaybackControl());
                Add(footer = new BottomView());
            }
Exemple #2
0
        public override void LoadView()
        {
            View      = view = new RootView();
            menuItems = new Tuple <Element, UIViewController>[]
            {
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Search, "SVG/search.svg", 20)
                {
                    SaveIndex = false
                }, new SearchViewController()),
                new Tuple <Element, UIViewController>(new MenuHeaderElement(Strings.MusicLibraryHeading), null),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Artists, "SVG/artist.svg"), new ArtistViewController()),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Albums, "SVG/album.svg"), new AlbumViewController()),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Genres, "SVG/genres.svg"), new GenreViewController()),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Songs, "SVG/songs.svg"), new SongViewController()),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Playlists, "SVG/playlists.svg"), new PlaylistViewController()),
                new Tuple <Element, UIViewController>(new MenuHeaderElement(Strings.Online), null),
                //new Tuple<Element, UIViewController>(new MenuElement("trending", "SVG/trending.svg"),
                //	new BaseViewController {Title = "Trending", View = {BackgroundColor = UIColor.White}}),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Radio, "SVG/radio.svg"), new RadioStationViewController()),
                new Tuple <Element, UIViewController>(new MenuHeaderElement(Strings.Settings), null),
                new Tuple <Element, UIViewController>(new MenuSwitch(Strings.OfflineOnly, "SVG/offline.svg", Settings.ShowOfflineOnly)
                {
                    ValueUpdated = (b) => Settings.ShowOfflineOnly = b
                }, null),
                new Tuple <Element, UIViewController>(new MenuSubtextSwitch(Strings.Equalizer
                                                                            , MusicPlayer.Playback.Equalizer.Shared.CurrentPreset?.Name, "SVG/equalizer.svg", Settings.EqualizerEnabled)
                {
                    ValueUpdated = (b) => MusicPlayer.Playback.Equalizer.Shared.Active = b
                },
                                                      new EqualizerViewController()),
                new Tuple <Element, UIViewController>(new MenuElement(Strings.Settings, "SVG/settings.svg")
                {
                    SaveIndex = false
                }, new SettingViewController()),
                                #if DEBUG || ADHOC
                new Tuple <Element, UIViewController>(new MenuElement("Console", "SVG/settings.svg")
                {
                    SaveIndex = false
                }, new ConsoleViewController()),
                                #endif
            };
            Menu = new FlyoutNavigationController {
            };
            Menu.NavigationRoot = new RootElement("gMusic")
            {
                new Section
                {
                    menuItems.Select(x => x.Item1)
                }
            };
            Menu.NavigationRoot.TableView.TableFooterView =
                new UIView(new CGRect(0, 0, 320, NowPlayingViewController.MinVideoHeight));
            Menu.NavigationRoot.TableView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("launchBg"));
            Menu.NavigationRoot.TableView.BackgroundView  = new BluredView(Style.DefaultStyle.NavigationBlurStyle);
            Menu.NavigationRoot.TableView.SeparatorColor  = UIColor.Clear;
            Menu.NavigationRoot.TableView.EstimatedSectionHeaderHeight = 0;
            Menu.NavigationRoot.TableView.EstimatedSectionFooterHeight = 0;
            Menu.ViewControllers = menuItems.Select(x => x.Item2 == null ? null : new UINavigationController(x.Item2)).ToArray();
            Menu.HideShadow      = false;
            Menu.ShadowViewColor = UIColor.Gray.ColorWithAlpha(.25f);
            view.Menu            = Menu;
            Menu.SelectedIndex   = Settings.CurrentMenuIndex;
            AddChildViewController(Menu);

            NowPlaying = new NowPlayingViewController
            {
                Close = () => view.HideNowPlaying(true, true),
            };
            view.NowPlaying = NowPlaying;
            AddChildViewController(NowPlaying);
            SetupEvents();
        }