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

Commit d9c21766 authored by Michael Jurka's avatar Michael Jurka Committed by Android Git Automerger
Browse files

am 35f922d1: Update system wallpaper cropper with latest changes from Launcher3 cropper

* commit '35f922d1':
  Update system wallpaper cropper with latest changes from Launcher3 cropper
parents 6b5747e4 35f922d1
Loading
Loading
Loading
Loading
+35 −34
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ public class WallpaperCropActivity extends Activity {
    public static final int MAX_BMAP_IN_INTENT = 750000;
    private static final float WALLPAPER_SCREENS_SPAN = 2f;

    protected static Point sDefaultWallpaperSize;

    protected CropView mCropView;
    protected Uri mUri;

@@ -204,6 +206,7 @@ public class WallpaperCropActivity extends Activity {
    }

    static protected Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) {
        if (sDefaultWallpaperSize == null) {
            Point minDims = new Point();
            Point maxDims = new Point();
            windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims);
@@ -219,8 +222,7 @@ public class WallpaperCropActivity extends Activity {
            }

            // We need to ensure that there is enough extra space in the wallpaper
        // for the intended
        // parallax effects
            // for the intended parallax effects
            final int defaultWidth, defaultHeight;
            if (isScreenLarge(res)) {
                defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
@@ -229,7 +231,9 @@ public class WallpaperCropActivity extends Activity {
                defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
                defaultHeight = maxDim;
            }
        return new Point(defaultWidth, defaultHeight);
            sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight);
        }
        return sDefaultWallpaperSize;
    }

    public static int getRotationFromExif(String path) {
@@ -785,16 +789,13 @@ public class WallpaperCropActivity extends Activity {
            WindowManager windowManager,
            final WallpaperManager wallpaperManager) {
        final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager);

        new AsyncTask<Void, Void, Void>() {
            public Void doInBackground(Void ... args) {
        // If we have saved a wallpaper width/height, use that instead
        int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, defaultWallpaperSize.x);
        int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, defaultWallpaperSize.y);
        if (savedWidth != wallpaperManager.getDesiredMinimumWidth() ||
                savedHeight != wallpaperManager.getDesiredMinimumHeight()) {
            wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight);
                return null;
        }
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
    }

    protected static RectF getMaxCropRect(