summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2013-08-23 00:15:41 +0200
committerMichael Jurka <mikejurka@google.com>2013-08-26 15:54:03 +0200
commitfd471c0b4f028948d5aaefe37d4b9582b4b4372f (patch)
tree2bb21b8e63e345f26a5b54f7049bc3a110d33011 /src
parenteed7aa422f64e1a62d6d4ef96bf378ef9392a48b (diff)
downloadandroid_packages_apps_Trebuchet-fd471c0b4f028948d5aaefe37d4b9582b4b4372f.tar.gz
android_packages_apps_Trebuchet-fd471c0b4f028948d5aaefe37d4b9582b4b4372f.tar.bz2
android_packages_apps_Trebuchet-fd471c0b4f028948d5aaefe37d4b9582b4b4372f.zip
Fix wallpaper cropping
Images were not being scaled correctly and wallpaper dimensions weren't always being set
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/WallpaperCropActivity.java7
-rw-r--r--src/com/android/launcher3/WallpaperPickerActivity.java1
2 files changed, 3 insertions, 5 deletions
diff --git a/src/com/android/launcher3/WallpaperCropActivity.java b/src/com/android/launcher3/WallpaperCropActivity.java
index 087785ef5..2978c850a 100644
--- a/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/src/com/android/launcher3/WallpaperCropActivity.java
@@ -47,9 +47,6 @@ import java.io.InputStream;
public class WallpaperCropActivity extends Activity {
private static final String LOGTAG = "Launcher3.CropActivity";
- private int mOutputX = 0;
- private int mOutputY = 0;
-
protected static final String WALLPAPER_WIDTH_KEY = "wallpaper.width";
protected static final String WALLPAPER_HEIGHT_KEY = "wallpaper.height";
private static final int DEFAULT_COMPRESS_QUALITY = 90;
@@ -183,14 +180,14 @@ public class WallpaperCropActivity extends Activity {
failure = true;
return false;
}
- if (mOutputX > 0 && mOutputY > 0) {
+ if (mOutWidth > 0 && mOutHeight > 0) {
Matrix m = new Matrix();
RectF cropRect = new RectF(0, 0, crop.getWidth(), crop.getHeight());
if (mRotation > 0) {
m.setRotate(mRotation);
m.mapRect(cropRect);
}
- RectF returnRect = new RectF(0, 0, mOutputX, mOutputY);
+ RectF returnRect = new RectF(0, 0, mOutWidth, mOutHeight);
m.setRectToRect(cropRect, returnRect, Matrix.ScaleToFit.FILL);
m.preRotate(mRotation);
Bitmap tmp = Bitmap.createBitmap((int) returnRect.width(),
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java
index bad84603e..a1c74d2b2 100644
--- a/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -398,6 +398,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
// If we have saved a wallpaper width/height, use that instead
int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, defaultWidth);
int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, defaultHeight);
+ wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight);
}
}.start();
}