diff options
author | Zhang Fang <zfang@codeaurora.org> | 2014-01-08 21:36:01 +0800 |
---|---|---|
committer | emancebo <emancebo@cyngn.com> | 2014-09-04 10:40:17 -0700 |
commit | 12c89af7f5358587c7924f06e38a118d5461897e (patch) | |
tree | 13f2f333d6b3240fc77735a8a5de3a5bad190ea0 /src | |
parent | 3ac7264b02d7c009607bbf9f25ab085abfee7293 (diff) | |
download | android_packages_apps_Gallery2-12c89af7f5358587c7924f06e38a118d5461897e.tar.gz android_packages_apps_Gallery2-12c89af7f5358587c7924f06e38a118d5461897e.tar.bz2 android_packages_apps_Gallery2-12c89af7f5358587c7924f06e38a118d5461897e.zip |
Gallery2: Support HSCI screencolor settings use
Let it can change HSCI when the picture selected from Gallery2 in screencolor settings.
Change-Id: I57cdb7080820defaa27a2f2e93e479374f00b09a
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/Wallpaper.java | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/app/Wallpaper.java b/src/com/android/gallery3d/app/Wallpaper.java index 2022f5a4a..8aa31ee7e 100644 --- a/src/com/android/gallery3d/app/Wallpaper.java +++ b/src/com/android/gallery3d/app/Wallpaper.java @@ -44,6 +44,11 @@ public class Wallpaper extends Activity { private static final String IMAGE_TYPE = "image/*"; private static final String KEY_STATE = "activity-state"; private static final String KEY_PICKED_ITEM = "picked-item"; + private static final String KEY_ASPECT_X = "aspectX"; + private static final String KEY_ASPECT_Y = "aspectY"; + private static final String KEY_SPOTLIGHT_X = "spotlightX"; + private static final String KEY_SPOTLIGHT_Y = "spotlightY"; + private static final String KEY_FROM_SCREENCOLOR = "fromScreenColor"; private static final int STATE_INIT = 0; private static final int STATE_PHOTO_PICKED = 1; @@ -114,11 +119,29 @@ public class Wallpaper extends Activity { } } - int width = getWallpaperDesiredMinimumWidth(); - int height = getWallpaperDesiredMinimumHeight(); - Point size = getDefaultDisplaySize(new Point()); - float spotlightX = (float) size.x / width; - float spotlightY = (float) size.y / height; + 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); + spotlightX = extras.getFloat(KEY_SPOTLIGHT_X, 0); + spotlightY = extras.getFloat(KEY_SPOTLIGHT_Y, 0); + } else { + width = getWallpaperDesiredMinimumWidth(); + height = getWallpaperDesiredMinimumHeight(); + Point size = getDefaultDisplaySize(new Point()); + spotlightX = (float) size.x / width; + spotlightY = (float) size.y / height; + } + + //Don't set wallpaper from screencolor. cropAndSetWallpaperIntent = new Intent(CropActivity.CROP_ACTION) .setClass(this, CropActivity.class) .setDataAndType(mPickedItem, IMAGE_TYPE) @@ -131,7 +154,7 @@ public class Wallpaper extends Activity { .putExtra(CropExtras.KEY_SPOTLIGHT_Y, spotlightY) .putExtra(CropExtras.KEY_SCALE, true) .putExtra(CropExtras.KEY_SCALE_UP_IF_NEEDED, true) - .putExtra(CropExtras.KEY_SET_AS_WALLPAPER, true); + .putExtra(CropExtras.KEY_SET_AS_WALLPAPER, !fromScreenColor); startActivity(cropAndSetWallpaperIntent); finish(); } |