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

Commit 9a9a8785 authored by Matt Casey's avatar Matt Casey Committed by Automerger Merge Worker
Browse files

Merge "Fix CropView sizing on full-width images" into sc-dev am: 76aabd7b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13938721

Change-Id: Iea4a3f9f7be17344b758dc3e2856306bee7a7037
parents 83877c7f 76aabd7b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -48,10 +48,10 @@

    <ImageView
        android:id="@+id/preview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_width="0px"
        android:layout_height="0px"
        android:layout_marginBottom="42dp"
        android:layout_marginHorizontal="48dp"
        android:paddingHorizontal="48dp"
        app:layout_constrainedHeight="true"
        app:layout_constrainedWidth="true"
        app:layout_constraintTop_toBottomOf="@id/save"
@@ -64,8 +64,8 @@

    <com.android.systemui.screenshot.CropView
        android:id="@+id/crop_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_width="0px"
        android:layout_height="0px"
        android:layout_marginBottom="42dp"
        app:layout_constrainedHeight="true"
        app:layout_constrainedWidth="true"
+4 −2
Original line number Diff line number Diff line
@@ -409,7 +409,9 @@ public class LongScreenshotActivity extends Activity {
        }
        Rect bounds = drawable.getBounds();
        float imageRatio = bounds.width() / (float) bounds.height();
        float viewRatio = mPreview.getWidth() / (float) mPreview.getHeight();
        int previewWidth = mPreview.getWidth() - mPreview.getPaddingLeft()
                - mPreview.getPaddingRight();
        float viewRatio = previewWidth / (float) mPreview.getHeight();

        if (imageRatio > viewRatio) {
            // Image is full width and height is constrained, compute extra padding to inform
@@ -417,7 +419,7 @@ public class LongScreenshotActivity extends Activity {
            float imageHeight = mPreview.getHeight() * viewRatio / imageRatio;
            int extraPadding = (int) (mPreview.getHeight() - imageHeight) / 2;
            mCropView.setExtraPadding(extraPadding, extraPadding);
            mCropView.setImageWidth(mPreview.getWidth());
            mCropView.setImageWidth(previewWidth);
        } else {
            // Image is full height
            mCropView.setExtraPadding(0, 0);