Loading packages/WallpaperCropper/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -15,4 +15,7 @@ --> <resources> <bool name="allow_rotation">false</bool> <!-- Specifies whether to expand the cropped area on both sides (rather than just to one side) --> <bool name="center_crop">true</bool> </resources> packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java +15 −5 Original line number Diff line number Diff line Loading @@ -330,10 +330,10 @@ public class WallpaperCropActivity extends Activity { protected void cropImageAndSetWallpaper(Uri uri, OnBitmapCroppedHandler onBitmapCroppedHandler, final boolean finishActivityWhenDone) { boolean centerCrop = getResources().getBoolean(R.bool.center_crop); // Get the crop boolean ltr = mCropView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR; Display d = getWindowManager().getDefaultDisplay(); Point displaySize = new Point(); Loading @@ -358,16 +358,26 @@ public class WallpaperCropActivity extends Activity { // ADJUST CROP WIDTH // Extend the crop all the way to the right, for parallax // (or all the way to the left, in RTL) float extraSpace = ltr ? rotatedInSize[0] - cropRect.right : cropRect.left; float extraSpace; if (centerCrop) { extraSpace = 2f * Math.min(rotatedInSize[0] - cropRect.right, cropRect.left); } else { extraSpace = ltr ? rotatedInSize[0] - cropRect.right : cropRect.left; } // Cap the amount of extra width float maxExtraSpace = defaultWallpaperSize.x / cropScale - cropRect.width(); extraSpace = Math.min(extraSpace, maxExtraSpace); if (centerCrop) { cropRect.left -= extraSpace / 2f; cropRect.right += extraSpace / 2f; } else { if (ltr) { cropRect.right += extraSpace; } else { cropRect.left -= extraSpace; } } // ADJUST CROP HEIGHT if (isPortrait) { Loading Loading
packages/WallpaperCropper/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -15,4 +15,7 @@ --> <resources> <bool name="allow_rotation">false</bool> <!-- Specifies whether to expand the cropped area on both sides (rather than just to one side) --> <bool name="center_crop">true</bool> </resources>
packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java +15 −5 Original line number Diff line number Diff line Loading @@ -330,10 +330,10 @@ public class WallpaperCropActivity extends Activity { protected void cropImageAndSetWallpaper(Uri uri, OnBitmapCroppedHandler onBitmapCroppedHandler, final boolean finishActivityWhenDone) { boolean centerCrop = getResources().getBoolean(R.bool.center_crop); // Get the crop boolean ltr = mCropView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR; Display d = getWindowManager().getDefaultDisplay(); Point displaySize = new Point(); Loading @@ -358,16 +358,26 @@ public class WallpaperCropActivity extends Activity { // ADJUST CROP WIDTH // Extend the crop all the way to the right, for parallax // (or all the way to the left, in RTL) float extraSpace = ltr ? rotatedInSize[0] - cropRect.right : cropRect.left; float extraSpace; if (centerCrop) { extraSpace = 2f * Math.min(rotatedInSize[0] - cropRect.right, cropRect.left); } else { extraSpace = ltr ? rotatedInSize[0] - cropRect.right : cropRect.left; } // Cap the amount of extra width float maxExtraSpace = defaultWallpaperSize.x / cropScale - cropRect.width(); extraSpace = Math.min(extraSpace, maxExtraSpace); if (centerCrop) { cropRect.left -= extraSpace / 2f; cropRect.right += extraSpace / 2f; } else { if (ltr) { cropRect.right += extraSpace; } else { cropRect.left -= extraSpace; } } // ADJUST CROP HEIGHT if (isPortrait) { Loading