Loading packages/SystemUI/res/layout/long_screenshot.xml +4 −2 Original line number Diff line number Diff line Loading @@ -52,8 +52,9 @@ android:id="@+id/preview" android:layout_width="0px" android:layout_height="0px" android:layout_marginBottom="42dp" android:paddingHorizontal="48dp" android:paddingTop="8dp" android:paddingBottom="42dp" app:layout_constrainedHeight="true" app:layout_constrainedWidth="true" app:layout_constraintTop_toBottomOf="@id/save" Loading @@ -68,7 +69,8 @@ android:id="@+id/crop_view" android:layout_width="0px" android:layout_height="0px" android:layout_marginBottom="42dp" android:paddingTop="8dp" android:paddingBottom="42dp" app:layout_constrainedHeight="true" app:layout_constrainedWidth="true" app:layout_constraintTop_toTopOf="@id/preview" Loading packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java +9 −6 Original line number Diff line number Diff line Loading @@ -411,19 +411,22 @@ public class LongScreenshotActivity extends Activity { float imageRatio = bounds.width() / (float) bounds.height(); int previewWidth = mPreview.getWidth() - mPreview.getPaddingLeft() - mPreview.getPaddingRight(); float viewRatio = previewWidth / (float) mPreview.getHeight(); int previewHeight = mPreview.getHeight() - mPreview.getPaddingTop() - mPreview.getPaddingBottom(); float viewRatio = previewWidth / (float) previewHeight; if (imageRatio > viewRatio) { // Image is full width and height is constrained, compute extra padding to inform // CropView float imageHeight = mPreview.getHeight() * viewRatio / imageRatio; int extraPadding = (int) (mPreview.getHeight() - imageHeight) / 2; mCropView.setExtraPadding(extraPadding, extraPadding); float imageHeight = previewHeight * viewRatio / imageRatio; int extraPadding = (int) (previewHeight - imageHeight) / 2; mCropView.setExtraPadding(extraPadding + mPreview.getPaddingTop(), extraPadding + mPreview.getPaddingBottom()); mCropView.setImageWidth(previewWidth); } else { // Image is full height mCropView.setExtraPadding(0, 0); mCropView.setImageWidth((int) (mPreview.getHeight() * imageRatio)); mCropView.setExtraPadding(mPreview.getPaddingTop(), mPreview.getPaddingBottom()); mCropView.setImageWidth((int) (previewHeight * imageRatio)); } } Loading Loading
packages/SystemUI/res/layout/long_screenshot.xml +4 −2 Original line number Diff line number Diff line Loading @@ -52,8 +52,9 @@ android:id="@+id/preview" android:layout_width="0px" android:layout_height="0px" android:layout_marginBottom="42dp" android:paddingHorizontal="48dp" android:paddingTop="8dp" android:paddingBottom="42dp" app:layout_constrainedHeight="true" app:layout_constrainedWidth="true" app:layout_constraintTop_toBottomOf="@id/save" Loading @@ -68,7 +69,8 @@ android:id="@+id/crop_view" android:layout_width="0px" android:layout_height="0px" android:layout_marginBottom="42dp" android:paddingTop="8dp" android:paddingBottom="42dp" app:layout_constrainedHeight="true" app:layout_constrainedWidth="true" app:layout_constraintTop_toTopOf="@id/preview" Loading
packages/SystemUI/src/com/android/systemui/screenshot/LongScreenshotActivity.java +9 −6 Original line number Diff line number Diff line Loading @@ -411,19 +411,22 @@ public class LongScreenshotActivity extends Activity { float imageRatio = bounds.width() / (float) bounds.height(); int previewWidth = mPreview.getWidth() - mPreview.getPaddingLeft() - mPreview.getPaddingRight(); float viewRatio = previewWidth / (float) mPreview.getHeight(); int previewHeight = mPreview.getHeight() - mPreview.getPaddingTop() - mPreview.getPaddingBottom(); float viewRatio = previewWidth / (float) previewHeight; if (imageRatio > viewRatio) { // Image is full width and height is constrained, compute extra padding to inform // CropView float imageHeight = mPreview.getHeight() * viewRatio / imageRatio; int extraPadding = (int) (mPreview.getHeight() - imageHeight) / 2; mCropView.setExtraPadding(extraPadding, extraPadding); float imageHeight = previewHeight * viewRatio / imageRatio; int extraPadding = (int) (previewHeight - imageHeight) / 2; mCropView.setExtraPadding(extraPadding + mPreview.getPaddingTop(), extraPadding + mPreview.getPaddingBottom()); mCropView.setImageWidth(previewWidth); } else { // Image is full height mCropView.setExtraPadding(0, 0); mCropView.setImageWidth((int) (mPreview.getHeight() * imageRatio)); mCropView.setExtraPadding(mPreview.getPaddingTop(), mPreview.getPaddingBottom()); mCropView.setImageWidth((int) (previewHeight * imageRatio)); } } Loading