Merge "Update to follow TransportMediator API changes." into jb-mr2-dev

This commit is contained in:
Dianne Hackborn
2013-04-19 17:58:00 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 11 deletions

View File

@@ -216,12 +216,12 @@ public class MediaController extends FrameLayout {
} }
} }
public int updateProgress() { public long updateProgress() {
if (mController == null || mDragging) { if (mController == null || mDragging) {
return 0; return 0;
} }
int position = mController.getCurrentPosition(); long position = mController.getCurrentPosition();
int duration = mController.getDuration(); long duration = mController.getDuration();
if (mProgress != null) { if (mProgress != null) {
if (duration > 0) { if (duration > 0) {
// use long to avoid overflow // use long to avoid overflow
@@ -233,9 +233,9 @@ public class MediaController extends FrameLayout {
} }
if (mEndTime != null) if (mEndTime != null)
mEndTime.setText(stringForTime(duration)); mEndTime.setText(stringForTime((int)duration));
if (mCurrentTime != null) if (mCurrentTime != null)
mCurrentTime.setText(stringForTime(position)); mCurrentTime.setText(stringForTime((int)position));
return position; return position;
} }
@@ -323,7 +323,7 @@ public class MediaController extends FrameLayout {
private View.OnClickListener mRewListener = new View.OnClickListener() { private View.OnClickListener mRewListener = new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
int pos = mController.getCurrentPosition(); long pos = mController.getCurrentPosition();
pos -= 5000; // milliseconds pos -= 5000; // milliseconds
mController.seekTo(pos); mController.seekTo(pos);
updateProgress(); updateProgress();
@@ -332,7 +332,7 @@ public class MediaController extends FrameLayout {
private View.OnClickListener mFfwdListener = new View.OnClickListener() { private View.OnClickListener mFfwdListener = new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
int pos = mController.getCurrentPosition(); long pos = mController.getCurrentPosition();
pos += 15000; // milliseconds pos += 15000; // milliseconds
mController.seekTo(pos); mController.seekTo(pos);
updateProgress(); updateProgress();

View File

@@ -61,16 +61,16 @@ public class TransportControllerActivity extends Activity {
mContent.pause(); mContent.pause();
} }
@Override public int onGetDuration() { @Override public long onGetDuration() {
return mContent.getDuration(); return mContent.getDuration();
} }
@Override public int onGetCurrentPosition() { @Override public long onGetCurrentPosition() {
return mContent.getCurrentPosition(); return mContent.getCurrentPosition();
} }
@Override public void onSeekTo(int pos) { @Override public void onSeekTo(long pos) {
mContent.seekTo(pos); mContent.seekTo((int)pos);
} }
@Override public boolean onIsPlaying() { @Override public boolean onIsPlaying() {