I should translate this into B4A. I stopped on "getDefaultSize (mVideoWidth, widthMeasureSpec);"
The code is:
Any idea ?
Thank you
The code is:
B4X:
2 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
4 int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
5 int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
6 if (mVideoWidth > 0 && mVideoHeight > 0) {
7 if ( mVideoWidth * height > width * mVideoHeight ) {
8 //Log.i("@@@", "image too tall, correcting");
9 height = width * mVideoHeight / mVideoWidth;
10 } else if ( mVideoWidth * height < width * mVideoHeight ) {
11 //Log.i("@@@", "image too wide, correcting");
12 width = height * mVideoWidth / mVideoHeight;
13 } else {
14 //Log.i("@@@", "aspect ratio is correct: " +
15 //width+"/"+height+"="+
16 //mVideoWidth+"/"+mVideoHeight);
17 }
18 }
19 //Log.i("@@@@@@@@@@", "setting size: " + width + 'x' + height);
20 setMeasuredDimension(width, height);
21 }
Any idea ?
Thank you