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

Commit 2e4f426b authored by Romain Guy's avatar Romain Guy
Browse files

Correctly resize dialogs when measured in WRAP_CONTENT

Bug #2549649

If the window had a different size than its content but the content had already
been measured with the appropriate size, the window would not be resized. This
happens in wrap_content windows (dialogs.) This change simply adds a new codition
to window resizing: if the window is wrap_content, not as big as it can be and
not as big as its content, it gets resized.

Change-Id: I1d82d03af5a15c9ad8dffa0511d5f6d522578285
parent 7d2511b7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -852,7 +852,11 @@ public final class ViewRoot extends Handler implements ViewParent,
        }

        boolean windowShouldResize = mLayoutRequested && windowResizesToFitContent
            && (mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight);
            && ((mWidth != host.mMeasuredWidth || mHeight != host.mMeasuredHeight)
                || (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT &&
                        frame.width() < desiredWindowWidth && frame.width() != mWidth)
                || (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT &&
                        frame.height() < desiredWindowHeight && frame.height() != mHeight));

        final boolean computesInternalInsets =
                attachInfo.mTreeObserver.hasComputeInternalInsetsListeners();