aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Brabham <optedoblivion@cyngn.com>2014-12-17 12:17:04 -0800
committerMartin Brabham <optedoblivion@cyngn.com>2014-12-17 20:40:03 -0800
commitd629b5aaf5201593c366e099dde5bd6bf1320995 (patch)
tree84408a9ce7c997273ae1d4112db1e5817811d2d3
parent486c19adee31fac87ef5a70fe37611e64aea99d1 (diff)
downloadandroid_packages_apps_CMFileManager-d629b5aaf5201593c366e099dde5bd6bf1320995.tar.gz
android_packages_apps_CMFileManager-d629b5aaf5201593c366e099dde5bd6bf1320995.tar.bz2
android_packages_apps_CMFileManager-d629b5aaf5201593c366e099dde5bd6bf1320995.zip
CMFileManager:
- Use Environment function to be more compatible. - Take into account the directory sizes - Fix usage dialog jumping on first open. - Fix Java DiskUsageCommand to return correct DiskUsage based on MountPoint Change-Id: I62c4e734a99f5eba8eb596db360e760cb8404b51
-rw-r--r--src/com/cyanogenmod/filemanager/FileManagerApplication.java2
-rw-r--r--src/com/cyanogenmod/filemanager/service/MimeTypeIndexService.java7
-rw-r--r--src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java25
-rw-r--r--src/com/cyanogenmod/filemanager/util/CommandHelper.java6
4 files changed, 25 insertions, 15 deletions
diff --git a/src/com/cyanogenmod/filemanager/FileManagerApplication.java b/src/com/cyanogenmod/filemanager/FileManagerApplication.java
index 0529b97b..3855c04f 100644
--- a/src/com/cyanogenmod/filemanager/FileManagerApplication.java
+++ b/src/com/cyanogenmod/filemanager/FileManagerApplication.java
@@ -181,7 +181,7 @@ public final class FileManagerApplication extends Application {
// file manager
File externalStorage = Environment.getExternalStorageDirectory();
MimeTypeIndexService.indexFileRoot(this, externalStorage.getAbsolutePath());
- MimeTypeIndexService.indexFileRoot(this, "/system");
+ MimeTypeIndexService.indexFileRoot(this, Environment.getRootDirectory().getAbsolutePath());
}
diff --git a/src/com/cyanogenmod/filemanager/service/MimeTypeIndexService.java b/src/com/cyanogenmod/filemanager/service/MimeTypeIndexService.java
index 7f926920..ad7192e5 100644
--- a/src/com/cyanogenmod/filemanager/service/MimeTypeIndexService.java
+++ b/src/com/cyanogenmod/filemanager/service/MimeTypeIndexService.java
@@ -124,6 +124,13 @@ public class MimeTypeIndexService extends IntentService {
if (dirs != null) {
// Recurse directories
for (File dir : dirs) {
+ long size = dir.length();
+ if (!groupUsageMap.containsKey(MimeTypeCategory.NONE)) {
+ groupUsageMap.put(MimeTypeCategory.NONE, size);
+ } else {
+ long newSum = groupUsageMap.get(MimeTypeCategory.NONE) + size;
+ groupUsageMap.put(MimeTypeCategory.NONE, newSum);
+ }
calculateUsageByType(dir, groupUsageMap);
}
}
diff --git a/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java b/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java
index 5ead3192..e5b05f4b 100644
--- a/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java
+++ b/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java
@@ -89,17 +89,18 @@ public class FilesystemInfoDialog implements OnClickListener, OnCheckedChangeLis
}
+ if (mIsInUsageTab) {
+ if (mLegendLayout.getVisibility() != View.VISIBLE) {
+ populateLegend();
+ mLegendLayout.setVisibility(View.VISIBLE);
+ }
+ }
+
this.mDiskUsageGraph.post(new Runnable() {
@Override
public void run() {
//Animate disk usage graph
FilesystemInfoDialog.this.mDiskUsageGraph.drawDiskUsage(mDiskUsage);
- if (mIsInUsageTab) {
- if (mLegendLayout.getVisibility() != View.VISIBLE) {
- populateLegend();
- mLegendLayout.setVisibility(View.VISIBLE);
- }
- }
isFetching = false;
}
});
@@ -386,17 +387,17 @@ public class FilesystemInfoDialog implements OnClickListener, OnCheckedChangeLis
// Apply theme
applyTabTheme();
}
+ if (mIsInUsageTab) {
+ if (mLegendLayout.getVisibility() != View.VISIBLE) {
+ populateLegend();
+ mLegendLayout.setVisibility(View.VISIBLE);
+ }
+ }
this.mDiskUsageGraph.post(new Runnable() {
@Override
public void run() {
//Animate disk usage graph
FilesystemInfoDialog.this.mDiskUsageGraph.drawDiskUsage(mDiskUsage);
- if (mIsInUsageTab) {
- if (mLegendLayout.getVisibility() != View.VISIBLE) {
- populateLegend();
- mLegendLayout.setVisibility(View.VISIBLE);
- }
- }
}
});
break;
diff --git a/src/com/cyanogenmod/filemanager/util/CommandHelper.java b/src/com/cyanogenmod/filemanager/util/CommandHelper.java
index edba9694..6c33a2f6 100644
--- a/src/com/cyanogenmod/filemanager/util/CommandHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/CommandHelper.java
@@ -1115,8 +1115,10 @@ public final class CommandHelper {
c.getExecutableFactory().newCreator().createDiskUsageExecutable(dir);
execute(context, executable, c);
List<DiskUsage> du = executable.getResult();
- if (du != null && du.size() > 0) {
- return du.get(0);
+ for (DiskUsage d : du) {
+ if (d.getMountPoint().equals(dir)) {
+ return d;
+ }
}
}
return null;