Loading core/java/android/widget/VideoView.java +14 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { private int mVideoHeight; private int mSurfaceWidth; private int mSurfaceHeight; private int mPreviousWidth; private int mPreviousHeight; private MediaController mMediaController; private OnCompletionListener mOnCompletionListener; private MediaPlayer.OnPreparedListener mOnPreparedListener; Loading Loading @@ -121,6 +123,18 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { //width+"/"+height+"="+ //mVideoWidth+"/"+mVideoHeight); } mPreviousWidth = mVideoWidth; mPreviousHeight = mVideoHeight; } else if (mPreviousWidth > 0 && mPreviousHeight > 0) { width = getDefaultSize(mPreviousWidth, widthMeasureSpec); height = getDefaultSize(mPreviousHeight, heightMeasureSpec); if ( mPreviousWidth * height > width * mPreviousHeight ) { Log.i("VideoView", "image too tall, correcting"); height = width * mPreviousHeight / mPreviousWidth; } else if ( mPreviousWidth * height < width * mPreviousHeight ) { Log.i("VideoView", "image too wide, correcting"); width = height * mPreviousWidth / mPreviousHeight; } } //Log.i("@@@@@@@@@@", "setting size: " + width + 'x' + height); setMeasuredDimension(width, height); Loading Loading
core/java/android/widget/VideoView.java +14 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { private int mVideoHeight; private int mSurfaceWidth; private int mSurfaceHeight; private int mPreviousWidth; private int mPreviousHeight; private MediaController mMediaController; private OnCompletionListener mOnCompletionListener; private MediaPlayer.OnPreparedListener mOnPreparedListener; Loading Loading @@ -121,6 +123,18 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { //width+"/"+height+"="+ //mVideoWidth+"/"+mVideoHeight); } mPreviousWidth = mVideoWidth; mPreviousHeight = mVideoHeight; } else if (mPreviousWidth > 0 && mPreviousHeight > 0) { width = getDefaultSize(mPreviousWidth, widthMeasureSpec); height = getDefaultSize(mPreviousHeight, heightMeasureSpec); if ( mPreviousWidth * height > width * mPreviousHeight ) { Log.i("VideoView", "image too tall, correcting"); height = width * mPreviousHeight / mPreviousWidth; } else if ( mPreviousWidth * height < width * mPreviousHeight ) { Log.i("VideoView", "image too wide, correcting"); width = height * mPreviousWidth / mPreviousHeight; } } //Log.i("@@@@@@@@@@", "setting size: " + width + 'x' + height); setMeasuredDimension(width, height); Loading