summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-05-21 23:19:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-21 23:19:24 +0000
commit0a45b58e107b25af41a99d16fc10277ea90f07c0 (patch)
treeb8cc1fce1934b968572d93df94247a915ec053a3
parent2e6da1539bc7286336b3c24d96ab76434939ce4d (diff)
parent8abbd29ca320fe88d0043a51bc4a4f5914480b00 (diff)
downloadandroid_packages_apps_Trebuchet-0a45b58e107b25af41a99d16fc10277ea90f07c0.tar.gz
android_packages_apps_Trebuchet-0a45b58e107b25af41a99d16fc10277ea90f07c0.tar.bz2
android_packages_apps_Trebuchet-0a45b58e107b25af41a99d16fc10277ea90f07c0.zip
Merge "Enabling setWallpaper button only if the image was loaded successfully" into ub-launcher3-burnaby
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java1
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java12
2 files changed, 9 insertions, 4 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
index ee0d8b0c6..f2bb50944 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
@@ -263,6 +263,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb
if (req.postExecute != null) {
req.postExecute.run();
}
+ mProgressView.setVisibility(View.GONE);
}
public final void setCropViewTileSource(BitmapSource bitmapSource, boolean touchEnabled,
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);
+ }
}
});
}