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

Commit 00016635 authored by Clark Scheff's avatar Clark Scheff Committed by Gerrit Code Review
Browse files

Fix: wallpaper changes when changing lockscreen WP

Since LockscreenWallpaperPickerActivity did not override
cropImageAndSetWallpaper the homescreen wallpaper was changing
when selecting the default_wallpaper resource.

Change-Id: I26dd28e628a3ef701ad92a81aa80327d3ccba092
parent e2f7ef53
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
@@ -241,8 +241,7 @@ public class LockWallpaperPickerActivity extends WallpaperCropActivity {
        }
        @Override
        public void onSave(WallpaperCropActivity a) {
            boolean finishActivityWhenDone = true;
            ((LockWallpaperPickerActivity)a).cropImageAndSetWallpaper(mResources, mResId, finishActivityWhenDone);
            a.cropImageAndSetWallpaper(mResources, mResId, true);
        }
        @Override
        public boolean isSelectable() {
@@ -254,6 +253,33 @@ public class LockWallpaperPickerActivity extends WallpaperCropActivity {
        }
    }

    @Override
    protected void cropImageAndSetWallpaper(
            Resources res, int resId, final boolean finishActivityWhenDone) {
        // crop this image and scale it down to the default wallpaper size for
        // this device
        int rotation = getRotationFromExif(res, resId);
        Point inSize = mCropView.getSourceDimensions();
        Point outSize = getDefaultWallpaperSize(getResources(),
                getWindowManager());
        RectF crop = getMaxCropRect(
                inSize.x, inSize.y, outSize.x, outSize.y, false);
        Runnable onEndCrop = new Runnable() {
            public void run() {
                // Passing 0, 0 will cause launcher to revert to using the
                // default wallpaper size
                updateWallpaperDimensions(0, 0);
                if (finishActivityWhenDone) {
                    setResult(Activity.RESULT_OK);
                    finish();
                }
            }
        };
        BitmapCropTask cropTask = new BitmapCropTask(this, res, resId,
                crop, rotation, outSize.x, outSize.y, true, false, onEndCrop);
        cropTask.execute();
    }

    protected void cropImageAndSetWallpaper(String path, String packageName, final boolean legacy,
            final boolean finishActivityWhenDone) {

@@ -900,7 +926,7 @@ public class LockWallpaperPickerActivity extends WallpaperCropActivity {
                                                 themeLockWallpaperInfos) {
                ThemeLockWallpapersAdapter tla = new ThemeLockWallpapersAdapter(
                        LockWallpaperPickerActivity.this, themeLockWallpaperInfos);
                populateWallpapersFromAdapter(mWallpapersView, tla, false, true);
                populateWallpapersFromAdapter(mWallpapersView, tla, false, false);
            }
        }.execute((Void) null);