private void Seeker_ProgressChanged(object sender, SeekBar.ProgressChangedEventArgs e) { int Seconds = e.Progress % 60; string seconds = Seconds.ToString(); if (seconds.Count() == 1) { string temp = seconds; seconds = "0" + temp; } CurrentPosTV.Text = inMins ? e.Progress / 3600 + ":" + seconds + ":" + e.Progress % 60 : e.Progress / 60 + ":" + seconds; if (!refresh) { // if we moving forward at least more than a second or backwars then seek to the position if (!inMins && (e.Progress * 1000 - prevmin * 1000 > 1100 || e.Progress * 1000 - prevmin * 1000 < 0)) { //MainActivity.MainPlayer.SeekTo(e.Progress * 1000); ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.SeekTo, e.Progress * 1000); } // same as the above for minutes else if (inMins && (e.Progress * 60 * 1000 - prevmin * 1000 * 60 > 1100 || e.Progress * 60 * 1000 - prevmin * 1000 * 60 < 0)) { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.SeekTo, e.Progress * 60 * 1000); //MainActivity.MainPlayer.SeekTo(e.Progress * 60 * 1000); } } else { refresh = false; } }
private async void Next_Click(object sender, EventArgs e) { long thistime = DateTime.Now.Millisecond; if (thistime - lastClickRaised < 250 && ((int)DateTime.Now.Second == second || (int)DateTime.Now.Second == second + 1)) { RunOnUiThread(() => { seeker.Progress += 10; }); lastClickRaised = 0; wasDouble = true; } else { second = DateTime.Now.Second; lastClickRaised = thistime; await System.Threading.Tasks.Task.Delay(500); if (wasDouble) { wasDouble = false; } else { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.Next); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar bar = ActionBar; bar.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Color.Olive)); bar.SetHomeButtonEnabled(true); bar.SetDisplayHomeAsUpEnabled(true); SetContentView(Resource.Layout.Details); FindViews(); RegisterReceivers(); // Create your application here if (Intent.GetStringExtra("PARAMS") != string.Empty) { List <Paths> paths = new List <Paths> { Newtonsoft.Json.JsonConvert.DeserializeObject <Paths>(Intent.GetStringExtra("PARAMS")) }; CurrentTrack = Track_Finder.TrackFinder.ConvertPathsToTracks(paths)[0]; PopulateViews(); } else { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.RequestCurrentSong); } seeker.ProgressChanged += Seeker_ProgressChanged; layout.SetOnTouchListener(this); _gestureDetector = new GestureDetector(this); timer = new Timer { Interval = 1000 }; timer.Elapsed += Timer_Elapsed; ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.RequestSeekPosition); next.Click += Next_Click; previous.Click += Previous_Click; playPause.Click += PlayPause_Click; loop.Click += Loop_Click; ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.RequestLoopbackIcon); }
public override void OnWindowFocusChanged(bool hasFocus) { base.OnWindowFocusChanged(hasFocus); if (!hasFocus) { timer.Stop(); } else { refresh = true; timer.Start(); ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.RequestSeekPosition); //if (inMins) // seeker.Progress = MainActivity.MainPlayer.CurrentPosition / 60 / 1000; // reconverting to mins //else // seeker.Progress = MainActivity.MainPlayer.CurrentPosition / 1000; // reconverting to secs } }
public void PlayPause_Click(object sender, sys.EventArgs e) { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.PlayPause); }
public void Next_Click(object sender, sys.EventArgs e) { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.Next); }
public void Previous_Click(object sender, sys.EventArgs e) { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.Previous); }
private void Loop_Click(object sender, EventArgs e) { ServiceStartHelper.StartHybridService(this, Services.ServiceCallAction.LoopBackChange); }