From 25373c95103dbd7b63b990bf3b45425b1b838977 Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Thu, 27 Feb 2014 12:22:22 +0800 Subject: Gallery2: Can set picture as screen color background. The upgrade of android4.4 make the set wallPaper activity be executed when set picture as background color. Add a condition to judge fromScreenColor and when judge the fromScreenColor is set as true, then execute the activity of set picture as color background activity instead of set wallpaper activity. CRs-Fixed: 623268 Change-Id: Id4dfa745f9d8379af084b8e2752f775ad85c9c52 --- src/com/android/gallery3d/app/Wallpaper.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/android/gallery3d/app/Wallpaper.java b/src/com/android/gallery3d/app/Wallpaper.java index 8aa31ee7e..5c19d9016 100644 --- a/src/com/android/gallery3d/app/Wallpaper.java +++ b/src/com/android/gallery3d/app/Wallpaper.java @@ -105,7 +105,14 @@ public class Wallpaper extends Activity { } case STATE_PHOTO_PICKED: { Intent cropAndSetWallpaperIntent; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + boolean fromScreenColor = false; + + // Do this for screencolor select and crop image to preview. + Bundle extras = intent.getExtras(); + if (extras != null) { + fromScreenColor = extras.getBoolean(KEY_FROM_SCREENCOLOR, false); + } + if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && (!fromScreenColor)) { WallpaperManager wpm = WallpaperManager.getInstance(getApplicationContext()); try { cropAndSetWallpaperIntent = wpm.getCropAndSetWallpaperIntent(mPickedItem); @@ -121,13 +128,7 @@ public class Wallpaper extends Activity { int width,height; float spotlightX,spotlightY; - boolean fromScreenColor = false; - // Do this for screencolor select and crop image to preview. - Bundle extras = intent.getExtras(); - if (extras != null) { - fromScreenColor = extras.getBoolean(KEY_FROM_SCREENCOLOR, false); - } if (fromScreenColor) { width = extras.getInt(KEY_ASPECT_X, 0); height = extras.getInt(KEY_ASPECT_Y, 0); -- cgit v1.2.3