Beispiel #1
0
        public AudioPlayerView(Algh.interfaces.IPlayer p, View menu)
        {
            player      = p;
            NextImage   = new ClickableIcon(next, NextClick);
            BackImage   = new ClickableIcon(prev, BackClick);
            PlayImage   = new ClickableHashIcon(play, PlayPauseClick);
            RepeatImage = new ClickableHashIcon(repeaton, (i, e) => { player.Repeat = !player.Repeat; });

            Orientation = StackOrientation.Vertical;

            Children.Add(slider);

            CommandPanel.Children.Add(BackImage);
            CommandPanel.Children.Add(PlayImage);
            CommandPanel.Children.Add(NextImage);
            CommandPanel.Children.Add(RepeatImage);

            Children.Add(CommandPanel);
            if (menu != null)
            {
                CommandPanel.Children.Add(menu);
            }
            //------------------------------------------------
            if (player.IsPlay)
            {
                PlayEvent(player, true);
            }
            if (player.Repeat)
            {
                RepeatImage.Source = repeatoff;
            }
            //------------------------------------------------
            player.PlayEvent         += PlayEvent;
            player.SeekEvent         += SeekEvent;
            slider.ValueChangeByUser += SeekChange;
        }
Beispiel #2
0
        public Collection()
        {
            Tracks = App.Player.TrackList[1];

            App.Player.PlayEvent += PlayEvent;

            loadb   = new Views.ClickableHashIcon("ic_download_grey600_36dp.png", MenuButton1Tap);
            deleteb = new Views.ClickableHashIcon("ic_delete_grey600_36dp.png", MenuButton2Tap);

            var menu = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };



            menu.Children.Add(loadb);
            menu.Children.Add(deleteb);

            Views.AudioListViewWithOutSelect DownloadList = new Views.AudioListViewWithOutSelect(App.trackManager.Downloads);
            downloadspage = new Downloads(DownloadList);

            listViewTracks = new Views.AudioListViewWithCheckBoxes(Tracks);



            listViewTracks.ItemTapped += OnItemTapped;

            var ads = new Views.adsView(App.ads[1]);
            //---------------------------------------Search-------------------------------------
            var SearchEntry = new SearchBar();

            if (Device.RuntimePlatform == Device.Android)
            {
                SearchEntry.HeightRequest = 40.0;
            }

            listViewTracks.Header = SearchEntry;


            searchHelper              = new Algh.SearchHelper(Tracks);
            searchHelper.SearchEvent += (i, e) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    var buf = listViewTracks.SelectedItem;
                    listViewTracks.ItemsSource  = null;
                    listViewTracks.ItemsSource  = e;
                    listViewTracks.SelectedItem = null;
                    listViewTracks.SelectedItem = buf;
                });
            };



            SearchEntry.TextChanged += (i, e) => { searchHelper.Search(e.NewTextValue); };
            //-----------------------------------------------------------------------------------
            if (App.Player.TrackList.Curtl != -1)
            {
                if (App.Player.TrackList.Curtl == 1)
                {
                    listViewTracks.SelectedItem = App.Player.TrackList[1][App.Player.TrackList.Curid];                                  // check
                }
            }
            else
            {
                foreach (IAudio track in App.trackManager.GetTracks())
                {
                    Tracks.Add(track);
                }
            }
            //------------------------------------------------------------------------------------

            this.Content = new StackLayout {
                Children = { listViewTracks, new Views.AudioPlayerView(App.Player, menu), ads }
            };
        }