Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4c1ccf3 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Disable Set Wallpaper button while loading image"

parents f7ad8557 0fa6c1b1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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"
+5 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class WallpaperCropActivity extends Activity {

    protected CropView mCropView;
    protected Uri mUri;
    private View mSetWallpaperButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
@@ -111,10 +112,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) {
@@ -122,6 +125,8 @@ public class WallpaperCropActivity extends Activity {
                            getString(R.string.wallpaper_load_fail),
                            Toast.LENGTH_LONG).show();
                    finish();
                } else {
                    mSetWallpaperButton.setVisibility(View.VISIBLE);
                }
            }
        };