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

Commit d629b5aa authored by Martin Brabham's avatar Martin Brabham
Browse files

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
parent 486c19ad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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());

    }

+7 −0
Original line number Diff line number Diff line
@@ -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);
            }
        }
+13 −12
Original line number Diff line number Diff line
@@ -89,17 +89,18 @@ public class FilesystemInfoDialog implements OnClickListener, OnCheckedChangeLis

        }

        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);
            }
        }

        this.mDiskUsageGraph.post(new Runnable() {
            @Override
            public void run() {
                //Animate disk usage graph
                FilesystemInfoDialog.this.mDiskUsageGraph.drawDiskUsage(mDiskUsage);
                isFetching = false;
            }
        });
@@ -386,17 +387,17 @@ public class FilesystemInfoDialog implements OnClickListener, OnCheckedChangeLis
                    // Apply theme
                    applyTabTheme();
                }
                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);
                    }
                }
                this.mDiskUsageGraph.post(new Runnable() {
                    @Override
                    public void run() {
                        //Animate disk usage graph
                        FilesystemInfoDialog.this.mDiskUsageGraph.drawDiskUsage(mDiskUsage);
                    }
                });
                break;
+4 −2
Original line number Diff line number Diff line
@@ -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;