2 * Copyright (C) 2012 The CyanogenMod Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.cyanogenmod.filemanager.preferences;
19 import com.cyanogenmod.filemanager.util.FileHelper;
23 * The enumeration of settings of FileManager application.
25 public enum FileManagerSettings {
27 * Whether is the first use of the application
30 SETTINGS_FIRST_USE("cm_filemanager_first_use", Boolean.TRUE), //$NON-NLS-1$
33 * The access mode to use
36 SETTINGS_ACCESS_MODE("cm_filemanager_access_mode", AccessMode.SAFE), //$NON-NLS-1$
39 * When secondary users will have a chrooted console
42 SETTINGS_RESTRICT_SECONDARY_USERS_ACCESS("cm_filemanager_restrict_secondary_users_access",
43 Boolean.TRUE), //$NON-NLS-1$
46 * The initial directory to be used.
49 SETTINGS_INITIAL_DIR("cm_filemanager_initial_dir", FileHelper.ROOT_DIRECTORY), //$NON-NLS-1$
52 * The view mode to use (simple, details, or icons).
55 SETTINGS_LAYOUT_MODE("cm_filemanager_layout_mode", NavigationLayoutMode.DETAILS), //$NON-NLS-1$
57 * The sort mode to use (name or data, ascending or descending).
60 SETTINGS_SORT_MODE("cm_filemanager_sort_mode", NavigationSortMode.NAME_ASC), //$NON-NLS-1$
63 * When to sort the directories before the files.
66 SETTINGS_SHOW_DIRS_FIRST("cm_filemanager_show_dirs_first", Boolean.TRUE), //$NON-NLS-1$
68 * When to show the hidden files.
71 SETTINGS_SHOW_HIDDEN("cm_filemanager_show_hidden", Boolean.TRUE), //$NON-NLS-1$
73 * When to show the system files.
76 SETTINGS_SHOW_SYSTEM("cm_filemanager_show_system", Boolean.TRUE), //$NON-NLS-1$
78 * When to show the symlinks files.
81 SETTINGS_SHOW_SYMLINKS("cm_filemanager_show_symlinks", Boolean.TRUE), //$NON-NLS-1$
84 * When to use case sensitive comparison in sorting of files
87 SETTINGS_CASE_SENSITIVE_SORT("cm_filemanager_case_sensitive_sort", Boolean.FALSE), //$NON-NLS-1$
89 * Defines the filetime format mode to use
92 SETTINGS_FILETIME_FORMAT_MODE(
93 "cm_filemanager_filetime_format_mode", FileTimeFormatMode.LOCALE), //$NON-NLS-1$
95 * When display a warning in free disk widget
98 SETTINGS_DISK_USAGE_WARNING_LEVEL(
99 "cm_filemanager_disk_usage_warning_level", //$NON-NLS-1$
100 new String("95")), //$NON-NLS-1$
102 * When to compute folder statistics in folder properties dialog
105 SETTINGS_COMPUTE_FOLDER_STATISTICS(
106 "cm_filemanager_compute_folder_statistics", Boolean.FALSE), //$NON-NLS-1$
108 * When to display thumbs of pictures, videos, ...
111 SETTINGS_DISPLAY_THUMBS(
112 "cm_filemanager_show_thumbs", Boolean.TRUE), //$NON-NLS-1$
114 * Whether use flinger to remove items
117 SETTINGS_USE_FLINGER("cm_filemanager_use_flinger", Boolean.FALSE), //$NON-NLS-1$
121 * When to highlight the terms of the search in the search results
124 SETTINGS_HIGHLIGHT_TERMS("cm_filemanager_highlight_terms", Boolean.TRUE), //$NON-NLS-1$
126 * When to show the relevance widget on searches
129 SETTINGS_SHOW_RELEVANCE_WIDGET(
130 "cm_filemanager_show_relevance_widget", //$NON-NLS-1$
133 * How to sort the search results
136 SETTINGS_SORT_SEARCH_RESULTS_MODE(
137 "cm_filemanager_sort_search_results_mode", //$NON-NLS-1$
138 SearchSortResultMode.RELEVANCE),
140 * When to save the search terms
143 SETTINGS_SAVE_SEARCH_TERMS("cm_filemanager_save_search_terms", Boolean.TRUE), //$NON-NLS-1$
146 * When to delayed filesystem synchronization in secure storages
149 SETTINGS_SECURE_STORAGE_DELAYED_SYNC("cm_filemanager_secure_storage_delayed_sync",
150 Boolean.TRUE), //$NON-NLS-1$
153 * When to show debug traces
156 SETTINGS_SHOW_TRACES("cm_filemanager_show_debug_traces", Boolean.FALSE), //$NON-NLS-1$
159 * When to editor should display suggestions
162 SETTINGS_EDITOR_NO_SUGGESTIONS(
163 "cm_filemanager_editor_no_suggestions", Boolean.FALSE), //$NON-NLS-1$
166 * When to editor should use word wrap
169 SETTINGS_EDITOR_WORD_WRAP("cm_filemanager_editor_word_wrap", Boolean.TRUE), //$NON-NLS-1$
172 * When to editor should open a binary file in a hex viewer
175 SETTINGS_EDITOR_HEXDUMP("cm_filemanager_editor_hexdump", Boolean.TRUE), //$NON-NLS-1$
178 * When to editor should use the syntax highlight
181 SETTINGS_EDITOR_SYNTAX_HIGHLIGHT(
182 "cm_filemanager_editor_syntax_highlight", Boolean.TRUE), //$NON-NLS-1$
185 * When to editor should use the default color scheme of the theme for syntax highlight
188 SETTINGS_EDITOR_SH_USE_THEME_DEFAULT(
189 "cm_filemanager_editor_sh_use_theme_default", Boolean.TRUE), //$NON-NLS-1$
192 * When to editor should use the default color scheme of the theme for syntax highlight
195 SETTINGS_EDITOR_SH_COLOR_SCHEME(
196 "cm_filemanager_editor_sh_color_scheme", ""), //$NON-NLS-1$ //$NON-NLS-2$
199 * The current theme to use in the app
202 SETTINGS_THEME("cm_filemanager_theme", //$NON-NLS-1$
203 "com.cyanogenmod.filemanager:light"),
206 * The current theme to use in the app
209 USER_PREF_LAST_DRAWER_TAB("last_drawer_tab", //$NON-NLS-1$
215 * A broadcast intent that is sent when a setting was changed
217 public final static String INTENT_SETTING_CHANGED =
218 "com.cyanogenmod.filemanager.INTENT_SETTING_CHANGED"; //$NON-NLS-1$
221 * A broadcast intent that is sent when a theme was changed
223 public final static String INTENT_THEME_CHANGED =
224 "com.cyanogenmod.filemanager.INTENT_THEME_CHANGED"; //$NON-NLS-1$
227 * A broadcast intent that is sent when a setting was changed
229 public final static String INTENT_MOUNT_STATUS_CHANGED =
230 "com.cyanogenmod.filemanager.INTENT_MOUNT_STATUS_CHANGED"; //$NON-NLS-1$
233 * A broadcast intent that is sent when a file was changed
235 public final static String INTENT_FILE_CHANGED =
236 "com.cyanogenmod.filemanager.INTENT_FILE_CHANGED"; //$NON-NLS-1$
239 * The extra key with the preference key that was changed
241 public final static String EXTRA_SETTING_CHANGED_KEY = "preference"; //$NON-NLS-1$
244 * The extra key with the file key that was changed
246 public final static String EXTRA_FILE_CHANGED_KEY = "file"; //$NON-NLS-1$
249 * The extra key with the file key that was changed
251 public final static String EXTRA_THEME_PACKAGE = "package"; //$NON-NLS-1$
254 * The extra key with the identifier of theme that was changed
256 public final static String EXTRA_THEME_ID = "id"; //$NON-NLS-1$
259 * The extra key with the identifier a mountpoint event
261 public final static String EXTRA_MOUNTPOINT = "mount_point"; //$NON-NLS-1$
264 * The extra key with the notify the status of an object
266 public final static String EXTRA_STATUS = "status"; //$NON-NLS-1$
271 private final String mId;
272 private final Object mDefaultValue;
275 * Constructor of <code>FileManagerSettings</code>.
277 * @param id The unique identifier of the setting
278 * @param defaultValue The default value of the setting
280 private FileManagerSettings(String id, Object defaultValue) {
282 this.mDefaultValue = defaultValue;
286 * Method that returns the unique identifier of the setting.
289 public String getId() {
294 * Method that returns the default value of the setting.
296 * @return Object The default value of the setting
298 public Object getDefaultValue() {
299 return this.mDefaultValue;
303 * Method that returns an instance of {@link FileManagerSettings} from its.
306 * @param id The unique identifier
307 * @return FileManagerSettings The navigation sort mode
309 public static FileManagerSettings fromId(String id) {
310 FileManagerSettings[] values = values();
311 int cc = values.length;
312 for (int i = 0; i < cc; i++) {
313 if (values[i].mId == id) {