public override bool OnContextItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.item_delete: try { mediaPlayer.DeleteSong(selectedSong.Id); UpdateList(); } catch (Exception ex) { GoogleAnalyticsService.Instance.TrackAppException(ex.Message, false); Toast.MakeText(Application.Context, "could not delete this song", ToastLength.Long).Show(); } return(true); case Resource.Id.item_play: Play(selectedSong.Id); Intent intent = new Intent(this, typeof(CurrentSong)); intent.AddFlags(ActivityFlags.SingleTop); StartActivity(intent); return(true); case Resource.Id.item_rename: RenameSong(); return(true); case Resource.Id.seek_bar: AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); seekbarview = new SeekbarView(alertDialogBuilder.Context, null); alertDialogBuilder.SetView(seekbarview); alertDialogBuilder.SetCancelable(false); alertDialogBuilder.SetPositiveButton("OK", (s, e) => { seekbarview.AbortSeekbarThread(); }); alertDialogBuilder.SetTitle(GetSelectedSongTitle()); Drawable picture = SongMetadata.GetSongPicture(selectedSong.Id); if (picture != null) { alertDialogBuilder.SetIcon(picture); } else { alertDialogBuilder.SetIcon(Resource.Drawable.default_song_image); } seekbarDialog = alertDialogBuilder.Create(); seekbarDialog.Show(); return(true); default: return(base.OnContextItemSelected(item)); } }
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(); }; }