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

Commit 59c9f191 authored by Fujia Mi's avatar Fujia Mi Committed by Zhao Wei Liew
Browse files

CMFileManager: Refresh the disk usage graph when layout size change

The size of disk usage graph was caculated dynamically according to
the parent layout size. When the device was rotated from landscape
to portrait, the layout size was changed, but the disk usage graph
did not refresh.

Redraw the graph when the view size changes.

Change-Id: I2e283ed77f44b759f4f3753ff92fe95d851b6433
CRs-Fixed: 889743
parent 967dc870
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ public class DiskUsageGraph extends View {
        }
    };

    private DiskUsage mLastDiskUsage;

    /**
     * Initialize the color assets into memory for direct access
     */
@@ -156,6 +158,13 @@ public class DiskUsageGraph extends View {
        this.setMeasuredDimension(size, size);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        // Redraw the disk usage graph when layout size changes
        if (oldw != 0 && oldh != 0 && mLastDiskUsage != null) {
            drawDiskUsage(mLastDiskUsage);
        }
    }
    /**
     * Method that sets the free disk space percentage after the widget change his color to advise
     * the user
@@ -191,6 +200,7 @@ public class DiskUsageGraph extends View {
        // Start drawing thread
        AnimationDrawingRunnable animationDrawingRunnable = new AnimationDrawingRunnable(diskUsage);
        mAnimationFuture = sThreadPool.submit(animationDrawingRunnable);
        mLastDiskUsage = diskUsage;

    }