Disable Set Wallpaper button while loading image
Bug: 13534714
Change-Id: I45ff3436de40ea85fb22d776584d9f30f0795898
(cherry picked from commit 0fa6c1b146
)
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="?android:actionButtonStyle"
|
||||
android:id="@+id/set_wallpaper_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
<TextView style="?android:actionBarTabTextStyle"
|
||||
|
@ -73,6 +73,7 @@ public class WallpaperCropActivity extends Activity {
|
||||
|
||||
protected CropView mCropView;
|
||||
protected Uri mUri;
|
||||
private View mSetWallpaperButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -109,10 +110,12 @@ public class WallpaperCropActivity extends Activity {
|
||||
cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone);
|
||||
}
|
||||
});
|
||||
mSetWallpaperButton = findViewById(R.id.set_wallpaper_button);
|
||||
|
||||
// Load image in background
|
||||
final BitmapRegionTileSource.UriBitmapSource bitmapSource =
|
||||
new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024);
|
||||
mSetWallpaperButton.setVisibility(View.INVISIBLE);
|
||||
Runnable onLoad = new Runnable() {
|
||||
public void run() {
|
||||
if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) {
|
||||
@ -120,6 +123,8 @@ public class WallpaperCropActivity extends Activity {
|
||||
getString(R.string.wallpaper_load_fail),
|
||||
Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
} else {
|
||||
mSetWallpaperButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user