diff options
author | Tony Wickham <twickham@google.com> | 2015-08-31 17:28:32 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2015-09-02 20:55:19 +0000 |
commit | 785f7a59d347b199d544d9c9c38f6f3eb26b0085 (patch) | |
tree | a163db0211b3a0fb59650716d09f0d1ddb1c93e3 /WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java | |
parent | 009a724ca242133cae8b1c5f18eec94f1b693c68 (diff) | |
download | android_packages_apps_Trebuchet-785f7a59d347b199d544d9c9c38f6f3eb26b0085.tar.gz android_packages_apps_Trebuchet-785f7a59d347b199d544d9c9c38f6f3eb26b0085.tar.bz2 android_packages_apps_Trebuchet-785f7a59d347b199d544d9c9c38f6f3eb26b0085.zip |
Previews in the wallpaper picker are offset to match the homescreen parallax.
When "Wallpapers" is selected from the overlay, the current wallpaper parallax
offset is sent to the WallpaperPickerActivity as an Intent extra. The CropView
then uses that offset when previewing new wallpapers to ensure the preview looks
exactly the same as the actual wallpaper will when set.
Note that this fix doesn't seem to work for DefaultWallpaperInfo - that will
come in a future CL.
Bug: 23568800
Change-Id: I41c5bbbfdabfeb4e20d77e9b5804842a03211edf
Diffstat (limited to 'WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 2cfc9bfc3..b3a81aedc 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -22,7 +22,6 @@ import android.app.Activity; import android.app.WallpaperManager; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Matrix; @@ -250,8 +249,9 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb if (req.moveToLeft) { mCropView.moveToLeft(); } - if (req.scaleProvider != null) { - mCropView.setScale(req.scaleProvider.getScale(req.result)); + if (req.scaleAndOffsetProvider != null) { + mCropView.setScale(req.scaleAndOffsetProvider.getScale(req.result)); + mCropView.addParallaxOffset(req.scaleAndOffsetProvider.getParallaxOffset()); } // Free last image @@ -270,13 +270,14 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb @TargetApi(Build.VERSION_CODES.KITKAT) public final void setCropViewTileSource(BitmapSource bitmapSource, boolean touchEnabled, - boolean moveToLeft, CropViewScaleProvider scaleProvider, Runnable postExecute) { + boolean moveToLeft, CropViewScaleAndOffsetProvider scaleAndOffsetProvider, + Runnable postExecute) { final LoadRequest req = new LoadRequest(); req.moveToLeft = moveToLeft; req.src = bitmapSource; req.touchEnabled = touchEnabled; req.postExecute = postExecute; - req.scaleProvider = scaleProvider; + req.scaleAndOffsetProvider = scaleAndOffsetProvider; mCurrentLoadRequest = req; // Remove any pending requests @@ -436,12 +437,13 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb boolean touchEnabled; boolean moveToLeft; Runnable postExecute; - CropViewScaleProvider scaleProvider; + CropViewScaleAndOffsetProvider scaleAndOffsetProvider; TileSource result; } - public interface CropViewScaleProvider { + public interface CropViewScaleAndOffsetProvider { float getScale(TileSource src); + float getParallaxOffset(); } } |