Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_download_song);

            GoogleAnalyticsService.Instance.Initialize(this);
            GoogleAnalyticsService.Instance.TrackAppPage("Download Song");

            video       = SearchSongs.getSelectedVideo();
            videoName   = FindViewById <TextView>(Resource.Id.videoName);
            channelName = FindViewById <TextView>(Resource.Id.channelName);
            videoImg    = FindViewById <ImageView>(Resource.Id.videoImg);
            progressBar = FindViewById <ProgressBar>(Resource.Id.downloadingProgressBar);
            downloadBtn = FindViewById <Button>(Resource.Id.downloadBtn);
            downloadBtn.SetBackgroundColor(new Color(ContextCompat.GetColor(this, Resource.Color.darkassets)));

            DownloadWatcher.onDownloaded     += (sender, e) => TogglePlay();
            DownloadWatcher.onDownloadFailed += (sender, e) => ToggelDownload();

            if (AdsService.DownloadSongAd == null)
            {
                AdsService.DownloadSongAd = FindViewById <AdView>(Resource.Id.adView);
                AdsService.LoadBanner(AdsService.DownloadSongAd);
            }

            UpdateView();
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_current_song);

            GoogleAnalyticsService.Instance.Initialize(this);
            GoogleAnalyticsService.Instance.TrackAppPage("Current Song");

            if (AdsService.CurrentSongAd == null)
            {
                AdsService.CurrentSongAd = FindViewById <AdView>(Resource.Id.adView);
                AdsService.LoadBanner(AdsService.CurrentSongAd);
            }

            songImg   = FindViewById <ImageView>(Resource.Id.songImg);
            songTitle = FindViewById <TextView>(Resource.Id.songTitle);
            seekbar   = FindViewById <SeekbarView>(Resource.Id.seekbar);

            ImageButton nextBtn = FindViewById <ImageButton>(Resource.Id.nextBtn);
            ImageButton prevBtn = FindViewById <ImageButton>(Resource.Id.prevBtn);

            playBtn = FindViewById <ImageButton>(Resource.Id.playBtn);

            playBtn.SetBackgroundColor(new Color(ContextCompat.GetColor(this, Resource.Color.darkassets)));
            nextBtn.SetBackgroundColor(new Color(ContextCompat.GetColor(this, Resource.Color.darkassets)));
            prevBtn.SetBackgroundColor(new Color(ContextCompat.GetColor(this, Resource.Color.darkassets)));

            checkCurrentSong();

            nextBtn.Click += delegate
            {
                mediaPlayer.PlayNext();
            };

            prevBtn.Click += delegate
            {
                mediaPlayer.PlayPrev();
            };

            ChangePlayingView();

            mediaPlayer.Completing += delegate
            {
                UpdatePage(mediaPlayer.CurrentSong.Id);
            };

            mediaPlayer.Starting += delegate
            {
                TogglePlay();
            };

            mediaPlayer.StartingNewSong += delegate
            {
                UpdatePage(mediaPlayer.CurrentSong.Id);
            };

            mediaPlayer.Pausing += delegate
            {
                TogglePause();
            };
        }