@@ -3135,7 +3135,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
31353135 continue;
31363136 }
31373137 if (child == aspectRatioFrameLayout) {
3138- int heightSpec = MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y + (isStatusBarVisible() ? AndroidUtilities.statusBarHeight : 0 ), MeasureSpec.EXACTLY);
3138+ int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight( ), MeasureSpec.EXACTLY);
31393139 child.measure(widthMeasureSpec, heightSpec);
31403140 } else if (child == paintingOverlay) {
31413141 int width;
@@ -18794,10 +18794,21 @@ public boolean isVisible() {
1879418794 return isVisible && placeProvider != null;
1879518795 }
1879618796
18797+ private int getVideoFitHeight() {
18798+ int height = getContainerViewHeight();
18799+ if (containerView != null) {
18800+ int measured = containerView.getMeasuredHeight();
18801+ if (measured > 0) {
18802+ height = Math.min(height, measured);
18803+ }
18804+ }
18805+ return height;
18806+ }
18807+
1879718808 private void updateMinMax(float scale) {
1879818809 if (aspectRatioFrameLayout != null && aspectRatioFrameLayout.getVisibility() == View.VISIBLE && textureUploaded) {
1879918810 View view = usedSurfaceView ? videoSurfaceView : videoTextureView;
18800- scale *= Math.min(getContainerViewWidth() / (float) view.getMeasuredWidth(), getContainerViewHeight () / (float) view.getMeasuredHeight());
18811+ scale *= Math.min(getContainerViewWidth() / (float) view.getMeasuredWidth(), getVideoFitHeight () / (float) view.getMeasuredHeight());
1880118812 }
1880218813 float w = centerImage.getImageWidth();
1880318814 float h = centerImage.getImageHeight();
@@ -19688,6 +19699,9 @@ public void onAnimationEnd(Animator animation) {
1968819699
1968919700 int containerWidth = getContainerViewWidth();
1969019701 int containerHeight = getContainerViewHeight();
19702+ if (videoSizeSet && aspectRatioFrameLayout != null && aspectRatioFrameLayout.getVisibility() == View.VISIBLE) {
19703+ containerHeight = getVideoFitHeight();
19704+ }
1969119705 if (animationInProgress != 2 && animationInProgress != 4 && !pipAnimationInProgress && !isInline) {
1969219706 if (currentEditMode == EDIT_MODE_NONE && sendPhotoType != SELECT_TYPE_AVATAR && sendPhotoType != SELECT_TYPE_STICKER && scale == 1 && aty != -1 && !zoomAnimation) {
1969319707 float maxValue = containerWidth / 4.0f;
@@ -22134,6 +22148,9 @@ public void drawCaptionBlur(Canvas canvas, BlurringShader.StoryBlurDrawer drawer
2213422148
2213522149 int containerWidth = getContainerViewWidth();
2213622150 int containerHeight = getContainerViewHeight();
22151+ if (videoSizeSet && aspectRatioFrameLayout != null && aspectRatioFrameLayout.getVisibility() == View.VISIBLE) {
22152+ containerHeight = getVideoFitHeight();
22153+ }
2213722154 ImageReceiver sideImage = null;
2213822155 if (currentEditMode == EDIT_MODE_NONE && sendPhotoType != SELECT_TYPE_AVATAR) {
2213922156 if (scale >= 1.0f && !zoomAnimation && !zooming) {
0 commit comments