aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFujia Mi <fmi@codeaurora.org>2015-11-26 14:27:37 +0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-10-26 17:14:40 -0700
commite62ef71f279e076acd136dad954003c83bfdda52 (patch)
treea8e2047d5362484acdc9c727c077f1790660ae23
parent5c14f64aa6b948f37ed106a50353606d89da5801 (diff)
downloadandroid_packages_apps_CMFileManager-e62ef71f279e076acd136dad954003c83bfdda52.tar.gz
android_packages_apps_CMFileManager-e62ef71f279e076acd136dad954003c83bfdda52.tar.bz2
android_packages_apps_CMFileManager-e62ef71f279e076acd136dad954003c83bfdda52.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.java10
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;
}