Merge "Update to follow TransportMediator API changes." into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3da1568ae8
@@ -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();
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user