Merge "Enabling setWallpaper button only if the image was loaded successfully" into ub-launcher3-burnaby

This commit is contained in:
Sunny Goyal
2015-05-21 23:19:24 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 4 deletions
@@ -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,
@@ -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);
}
}
});
}