aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/explorer/activities/preferences/SettingsPreferences.java7
-rw-r--r--src/com/cyanogenmod/explorer/preferences/ExplorerSettings.java6
-rw-r--r--src/com/cyanogenmod/explorer/ui/dialogs/FsoPropertiesDialog.java33
3 files changed, 37 insertions, 9 deletions
diff --git a/src/com/cyanogenmod/explorer/activities/preferences/SettingsPreferences.java b/src/com/cyanogenmod/explorer/activities/preferences/SettingsPreferences.java
index 3335f5a..4f990aa 100644
--- a/src/com/cyanogenmod/explorer/activities/preferences/SettingsPreferences.java
+++ b/src/com/cyanogenmod/explorer/activities/preferences/SettingsPreferences.java
@@ -118,6 +118,7 @@ public class SettingsPreferences extends PreferenceActivity {
private CheckBoxPreference mCaseSensitiveSort;
private ListPreference mDefaultLongClickAction;
private ListPreference mFreeDiskSpaceWarningLevel;
+ private CheckBoxPreference mComputeFolderStatistics;
private CheckBoxPreference mAllowConsoleSelection;
private boolean mLoaded = false;
@@ -208,6 +209,12 @@ public class SettingsPreferences extends PreferenceActivity {
defaultValue);
this.mOnChangeListener.onPreferenceChange(this.mFreeDiskSpaceWarningLevel, value);
+ // Compute folder statistics
+ this.mComputeFolderStatistics =
+ (CheckBoxPreference)findPreference(
+ ExplorerSettings.SETTINGS_COMPUTE_FOLDER_STATISTICS.getId());
+ this.mComputeFolderStatistics.setOnPreferenceChangeListener(this.mOnChangeListener);
+
// Allow console selection
this.mAllowConsoleSelection =
(CheckBoxPreference)findPreference(
diff --git a/src/com/cyanogenmod/explorer/preferences/ExplorerSettings.java b/src/com/cyanogenmod/explorer/preferences/ExplorerSettings.java
index 006b4ae..fdda409 100644
--- a/src/com/cyanogenmod/explorer/preferences/ExplorerSettings.java
+++ b/src/com/cyanogenmod/explorer/preferences/ExplorerSettings.java
@@ -84,6 +84,12 @@ public enum ExplorerSettings {
"cm_explorer_disk_usage_warning_level", //$NON-NLS-1$
new String("95")), //$NON-NLS-1$
/**
+ * When to compute folder statistics in folder properties dialog
+ * @hide
+ */
+ SETTINGS_COMPUTE_FOLDER_STATISTICS(
+ "cm_explorer_compute_folder_statistics", Boolean.TRUE), //$NON-NLS-1$
+ /**
* When to use case sensitive comparison in sorting of files
* @hide
*/
diff --git a/src/com/cyanogenmod/explorer/ui/dialogs/FsoPropertiesDialog.java b/src/com/cyanogenmod/explorer/ui/dialogs/FsoPropertiesDialog.java
index 8824908..880dab8 100644
--- a/src/com/cyanogenmod/explorer/ui/dialogs/FsoPropertiesDialog.java
+++ b/src/com/cyanogenmod/explorer/ui/dialogs/FsoPropertiesDialog.java
@@ -51,6 +51,8 @@ import com.cyanogenmod.explorer.model.Permissions;
import com.cyanogenmod.explorer.model.Symlink;
import com.cyanogenmod.explorer.model.User;
import com.cyanogenmod.explorer.model.UserPermission;
+import com.cyanogenmod.explorer.preferences.ExplorerSettings;
+import com.cyanogenmod.explorer.preferences.Preferences;
import com.cyanogenmod.explorer.util.AIDHelper;
import com.cyanogenmod.explorer.util.CommandHelper;
import com.cyanogenmod.explorer.util.DialogHelper;
@@ -99,6 +101,7 @@ public class FsoPropertiesDialog
private boolean mIgnoreCheckEvents;
private boolean mHasPrivileged;
+ private final boolean mComputeFolderStatistics;
private AsyncResultExecutable mFolderUsageExecutable;
private FolderUsage mFolderUsage;
private boolean mDrawingFolderUsage;
@@ -137,6 +140,14 @@ public class FsoPropertiesDialog
this.mDialog.setOnCancelListener(this);
this.mDialog.setOnDismissListener(this);
+ // Retrieve the user settings about computing folder statistics
+ this.mComputeFolderStatistics =
+ Preferences.getSharedPreferences().
+ getBoolean(
+ ExplorerSettings.SETTINGS_COMPUTE_FOLDER_STATISTICS.getId(),
+ ((Boolean)ExplorerSettings.SETTINGS_COMPUTE_FOLDER_STATISTICS.
+ getDefaultValue()).booleanValue());
+
//Fill the dialog
fillData(this.mContentView);
}
@@ -239,7 +250,9 @@ public class FsoPropertiesDialog
// Load owners and groups AIDs in background
if (FileHelper.isDirectory(this.mFso)) {
vContatinsRow.setVisibility(View.VISIBLE);
- computeFolderUsage();
+ if (this.mComputeFolderStatistics) {
+ computeFolderUsage();
+ }
}
// Check if permissions operations are allowed
@@ -889,15 +902,17 @@ public class FsoPropertiesDialog
* Method that cancels the folder usage command execution
*/
private void cancelFolderUsageCommand() {
- // Cancel the folder usage command
- try {
- if (this.mFolderUsageExecutable != null &&
- this.mFolderUsageExecutable.isCancelable() &&
- !this.mFolderUsageExecutable.isCanceled()) {
- this.mFolderUsageExecutable.cancel();
+ if (this.mComputeFolderStatistics) {
+ // Cancel the folder usage command
+ try {
+ if (this.mFolderUsageExecutable != null &&
+ this.mFolderUsageExecutable.isCancelable() &&
+ !this.mFolderUsageExecutable.isCanceled()) {
+ this.mFolderUsageExecutable.cancel();
+ }
+ } catch (Exception ex) {
+ Log.e(TAG, "Failed to cancel the folder usage command", ex); //$NON-NLS-1$
}
- } catch (Exception ex) {
- Log.e(TAG, "Failed to cancel the folder usage command", ex); //$NON-NLS-1$
}
}