diff options
author | Michael Jurka <mikejurka@google.com> | 2013-10-23 20:59:51 +0200 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2013-10-23 23:54:21 +0200 |
commit | 83699e56be0767bb080b5461896a99f266e7b85e (patch) | |
tree | 5e48ac2d98de5c36bf750d971c923d417afbfcda /src/com/android/launcher3/WallpaperPickerActivity.java | |
parent | 3d7f086f6a6eb730dbd8d5e8874ce7a71a7a8194 (diff) | |
download | android_packages_apps_Trebuchet-83699e56be0767bb080b5461896a99f266e7b85e.tar.gz android_packages_apps_Trebuchet-83699e56be0767bb080b5461896a99f266e7b85e.tar.bz2 android_packages_apps_Trebuchet-83699e56be0767bb080b5461896a99f266e7b85e.zip |
Stop using a separate ImageView for default wallpaper
Fixes janky transition when going from default
wallpaper to another wallpaper
Bug: 11278179
Change-Id: I738d1ae7bbc5e2d139a084e721b53fed9008367f
Diffstat (limited to 'src/com/android/launcher3/WallpaperPickerActivity.java')
-rw-r--r-- | src/com/android/launcher3/WallpaperPickerActivity.java | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java index 9c6ee6ec0..c58d66063 100644 --- a/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/src/com/android/launcher3/WallpaperPickerActivity.java @@ -90,7 +90,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private LinearLayout mWallpapersView; private View mWallpaperStrip; - private ImageView mDefaultWallpaperView; private ActionMode.Callback mActionModeCallback; private ActionMode mActionMode; @@ -134,8 +133,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override public void onClick(WallpaperPickerActivity a) { - a.setCropViewTileSource( - new BitmapRegionTileSource.UriBitmapSource(a, mUri, 1024), true, false); + a.setCropViewTileSource(new BitmapRegionTileSource.UriBitmapSource( + a, mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE), true, false); } @Override public void onSave(final WallpaperPickerActivity a) { @@ -174,11 +173,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(WallpaperPickerActivity a) { BitmapRegionTileSource.ResourceBitmapSource bitmapSource = - new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId, 1024); + new BitmapRegionTileSource.ResourceBitmapSource( + mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); bitmapSource.loadInBackground(); BitmapRegionTileSource source = new BitmapRegionTileSource(a, bitmapSource); CropView v = a.getCropView(); - a.getDefaultWallpaperView().setVisibility(View.INVISIBLE); v.setTileSource(source, null); Point wallpaperSize = WallpaperCropActivity.getDefaultWallpaperSize( a.getResources(), a.getWindowManager()); @@ -210,15 +209,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override public void onClick(WallpaperPickerActivity a) { - a.getCropView().setTouchEnabled(false); - ImageView defaultWallpaperView = a.getDefaultWallpaperView(); - defaultWallpaperView.setVisibility(View.VISIBLE); + CropView c = a.getCropView(); + Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable( - defaultWallpaperView.getWidth(), defaultWallpaperView.getHeight(), - false, 0.5f, 0.5f); - if (defaultWallpaper != null) { - defaultWallpaperView.setBackgroundDrawable(defaultWallpaper); - } + c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); + + c.setTileSource( + new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null); + c.setScale(1f); + c.setTouchEnabled(false); } @Override public void onSave(WallpaperPickerActivity a) { @@ -248,7 +247,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { setContentView(R.layout.wallpaper_picker); mCropView = (CropView) findViewById(R.id.cropView); - mDefaultWallpaperView = (ImageView) findViewById(R.id.defaultWallpaperView); mWallpaperStrip = findViewById(R.id.wallpaper_strip); mCropView.setTouchCallback(new CropView.TouchCallback() { LauncherViewPropertyAnimator mAnim; @@ -409,7 +407,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Select the first item; wait for a layout pass so that we initialize the dimensions of // cropView or the defaultWallpaperView first - mDefaultWallpaperView.addOnLayoutChangeListener(new OnLayoutChangeListener() { + mCropView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { @@ -530,7 +528,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void setCropViewTileSource(final BitmapRegionTileSource.BitmapSource bitmapSource, final boolean touchEnabled, boolean moveToLeft) { - getDefaultWallpaperView().setVisibility(View.INVISIBLE); super.setCropViewTileSource(bitmapSource, touchEnabled, moveToLeft); } @@ -899,10 +896,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return mCropView; } - public ImageView getDefaultWallpaperView() { - return mDefaultWallpaperView; - } - public SavedWallpaperImages getSavedImages() { return mSavedImages; } |