diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-05-21 15:54:58 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-05-21 16:14:08 -0700 |
commit | 8abbd29ca320fe88d0043a51bc4a4f5914480b00 (patch) | |
tree | db1f216f7f2318c408c94ee170c415f399a43b0f /WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | |
parent | 370afe8a04d1d13b03b5dda53a4f542bde016690 (diff) | |
download | android_packages_apps_Trebuchet-8abbd29ca320fe88d0043a51bc4a4f5914480b00.tar.gz android_packages_apps_Trebuchet-8abbd29ca320fe88d0043a51bc4a4f5914480b00.tar.bz2 android_packages_apps_Trebuchet-8abbd29ca320fe88d0043a51bc4a4f5914480b00.zip |
Enabling setWallpaper button only if the image was loaded successfully
Bug: 20187333
Change-Id: I1b738a06499d20facbc4bccb1e6247086a45b686
Diffstat (limited to 'WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 72cb194d6..3f90203ed 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -196,13 +196,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); - BitmapRegionTileSource.UriBitmapSource bitmapSource = + final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile)); a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { @Override public void run() { - a.setWallpaperButtonEnabled(true); + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.setWallpaperButtonEnabled(true); + } } }); } @@ -232,7 +234,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); - BitmapRegionTileSource.ResourceBitmapSource bitmapSource = + final BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId); a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleProvider() { @@ -249,7 +251,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void run() { - a.setWallpaperButtonEnabled(true); + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.setWallpaperButtonEnabled(true); + } } }); } |