Don't update seek bar unnecessarily often

Since Handler delays aren't very accurate, updateElapsedTime() is
sometimes called just before the second increments, causing
updateElapsedTime() to be called several times in rapid succession. This
adds a 50 ms to help avoid this.
This commit is contained in:
Christopher Eby committed 2012-03-13 15:27:41 -05:00
1 parent 7cc59120d4
commit ea1a12af01
1 file changed
+2 -2
@@ -443,8 +443,8 @@ public class FullPlaybackActivity extends PlaybackActivity
mElapsedView.setText(DateUtils.formatElapsedTime(mTimeBuilder, position / 1000));
if (!mPaused && mControlsVisible && (mState & PlaybackService.FLAG_PLAYING) != 0) {
// Try to update right when the duration increases by one second
long next = 1000 - position % 1000;
// Try to update right after the duration increases by one second
long next = 1050 - position % 1000;
mUiHandler.removeMessages(MSG_UPDATE_PROGRESS);
mUiHandler.sendEmptyMessageDelayed(MSG_UPDATE_PROGRESS, next);
}