private void UpdateView(MotionEvent e, float firstTouchX) { try { //Log.i(TAG, "updateView: " + mSeekToPosition); float secondTouch = e.GetX(); int distance = (int)((secondTouch - firstTouchX) / (MBarWidth + MSpaceBetweenBar)); MSeekToPosition -= distance; if (MSeekToPosition < 0) { MSeekToPosition = 0; } else if (MSeekToPosition > MBarHeight.Length) { MSeekToPosition = MBarHeight.Length; } else { if (MMusicBarChangeListener != null) { MMusicBarChangeListener.OnProgressChanged(this, MSeekToPosition, true); IsTracking = true; } } Invalidate(); } catch (Exception exception) { Console.WriteLine(exception); } }
private void UpdateView(MotionEvent e) { try { MSeekToPosition = (int)(e.GetX() / (MBarWidth + MSpaceBetweenBar)); //Log.i(TAG, "updateView: " + mSeekToPosition); if (MSeekToPosition < 0) { MSeekToPosition = 0; } else if (MSeekToPosition > MMaxNumOfBar) { MSeekToPosition = MMaxNumOfBar; } else { Invalidate(); if (MMusicBarChangeListener != null) { MMusicBarChangeListener.OnProgressChanged(this, MSeekToPosition, true); IsTracking = true; } } } catch (Exception exception) { Console.WriteLine(exception); } }