diff options
author | Fujia Mi <fmi@codeaurora.org> | 2015-11-26 14:27:37 +0800 |
---|---|---|
committer | Zhao Wei Liew <zhaoweiliew@gmail.com> | 2016-10-28 12:10:29 +0800 |
commit | 59c9f1911dab44b95fa60a18cfeed6d0264a2f2e (patch) | |
tree | 8e4a2ecac62a44cad11691ff552d43ee0790d26c | |
parent | 967dc870372319cf81e952710effbd33148d8df0 (diff) | |
download | android_packages_apps_CMFileManager-59c9f1911dab44b95fa60a18cfeed6d0264a2f2e.tar.gz android_packages_apps_CMFileManager-59c9f1911dab44b95fa60a18cfeed6d0264a2f2e.tar.bz2 android_packages_apps_CMFileManager-59c9f1911dab44b95fa60a18cfeed6d0264a2f2e.zip |
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
-rw-r--r-- | src/com/cyanogenmod/filemanager/ui/widgets/DiskUsageGraph.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/filemanager/ui/widgets/DiskUsageGraph.java b/src/com/cyanogenmod/filemanager/ui/widgets/DiskUsageGraph.java index bb7681d2..075afa7d 100644 --- a/src/com/cyanogenmod/filemanager/ui/widgets/DiskUsageGraph.java +++ b/src/com/cyanogenmod/filemanager/ui/widgets/DiskUsageGraph.java @@ -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; } |