diff options
author | shibom <shibom@codeaurora.org> | 2014-07-31 14:08:40 +0800 |
---|---|---|
committer | Xiaojing Zhang <zhangx@codeaurora.org> | 2014-11-04 20:24:14 -0800 |
commit | ecd9d2b60c89b32e0e7d99e33a89198e6a790ad2 (patch) | |
tree | db163347e99a7a29c45b783aaea5a89601d0ada6 /src/com/android/gallery3d | |
parent | 90ade05b6276acb084d490003253d7e3d35e1c47 (diff) | |
download | android_packages_apps_Gallery2-ecd9d2b60c89b32e0e7d99e33a89198e6a790ad2.tar.gz android_packages_apps_Gallery2-ecd9d2b60c89b32e0e7d99e33a89198e6a790ad2.tar.bz2 android_packages_apps_Gallery2-ecd9d2b60c89b32e0e7d99e33a89198e6a790ad2.zip |
Gallery2: Support HSCI screencolor settings use
Support to change HSCI values of the picture from Gallery2 in
screencolor settings, and set a picture as screen color.
Change-Id: If45adfca632083f297a58f3431ce9177bd4433c4
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/app/Wallpaper.java | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/app/Wallpaper.java b/src/com/android/gallery3d/app/Wallpaper.java index 2022f5a4a..5c19d9016 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; @@ -100,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); @@ -114,11 +126,23 @@ 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; + + 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 +155,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(); } |