Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 414c23e1 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "frameworks/base: Fix screen stretch issue for NuPlayer" into jellybean

parents 2e750df0 df11329a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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);