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

Commit ba126c09 authored by Selim Cinek's avatar Selim Cinek Committed by Adam Cohen
Browse files

Disable Set Wallpaper button while loading image

Bug: 13534714
Change-Id: I45ff3436de40ea85fb22d776584d9f30f0795898
(cherry picked from commit 0fa6c1b1)
parent 1aad3ad4
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
@@ -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);
                }
            }
        };