OSDN Git Service

CM File Manager - Enable Thumbnail previews by default
[android-x86/packages-apps-CMFileManager.git] / src / com / cyanogenmod / filemanager / preferences / FileManagerSettings.java
1 /*
2  * Copyright (C) 2012 The CyanogenMod Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package com.cyanogenmod.filemanager.preferences;
18
19 import com.cyanogenmod.filemanager.util.FileHelper;
20
21
22 /**
23  * The enumeration of settings of FileManager application.
24  */
25 public enum FileManagerSettings {
26     /**
27      * Whether is the first use of the application
28      * @hide
29      */
30     SETTINGS_FIRST_USE("cm_filemanager_first_use", Boolean.TRUE),  //$NON-NLS-1$
31
32     /**
33      * The access mode to use
34      * @hide
35      */
36     SETTINGS_ACCESS_MODE("cm_filemanager_access_mode", AccessMode.SAFE), //$NON-NLS-1$
37
38     /**
39      * When secondary users will have a chrooted console
40      * @hide
41      */
42     SETTINGS_RESTRICT_SECONDARY_USERS_ACCESS("cm_filemanager_restrict_secondary_users_access",
43             Boolean.TRUE), //$NON-NLS-1$
44
45     /**
46      * The initial directory to be used.
47      * @hide
48      */
49     SETTINGS_INITIAL_DIR("cm_filemanager_initial_dir", FileHelper.ROOT_DIRECTORY), //$NON-NLS-1$
50
51     /**
52      * The view mode to use (simple, details, or icons).
53      * @hide
54      */
55     SETTINGS_LAYOUT_MODE("cm_filemanager_layout_mode", NavigationLayoutMode.DETAILS), //$NON-NLS-1$
56     /**
57      * The sort mode to use (name or data, ascending or descending).
58      * @hide
59      */
60     SETTINGS_SORT_MODE("cm_filemanager_sort_mode", NavigationSortMode.NAME_ASC), //$NON-NLS-1$
61
62     /**
63      * When to sort the directories before the files.
64      * @hide
65      */
66     SETTINGS_SHOW_DIRS_FIRST("cm_filemanager_show_dirs_first", Boolean.TRUE), //$NON-NLS-1$
67     /**
68      * When to show the hidden files.
69      * @hide
70      */
71     SETTINGS_SHOW_HIDDEN("cm_filemanager_show_hidden", Boolean.TRUE), //$NON-NLS-1$
72     /**
73      * When to show the system files.
74      * @hide
75      */
76     SETTINGS_SHOW_SYSTEM("cm_filemanager_show_system", Boolean.TRUE), //$NON-NLS-1$
77     /**
78      * When to show the symlinks files.
79      * @hide
80      */
81     SETTINGS_SHOW_SYMLINKS("cm_filemanager_show_symlinks", Boolean.TRUE), //$NON-NLS-1$
82
83     /**
84      * When to use case sensitive comparison in sorting of files
85      * @hide
86      */
87     SETTINGS_CASE_SENSITIVE_SORT("cm_filemanager_case_sensitive_sort", Boolean.FALSE), //$NON-NLS-1$
88     /**
89      * Defines the filetime format mode to use
90      * @hide
91      */
92     SETTINGS_FILETIME_FORMAT_MODE(
93             "cm_filemanager_filetime_format_mode", FileTimeFormatMode.LOCALE), //$NON-NLS-1$
94     /**
95      * When display a warning in free disk widget
96      * @hide
97      */
98     SETTINGS_DISK_USAGE_WARNING_LEVEL(
99             "cm_filemanager_disk_usage_warning_level", //$NON-NLS-1$
100             new String("95")), //$NON-NLS-1$
101     /**
102      * When to compute folder statistics in folder properties dialog
103      * @hide
104      */
105     SETTINGS_COMPUTE_FOLDER_STATISTICS(
106             "cm_filemanager_compute_folder_statistics", Boolean.FALSE), //$NON-NLS-1$
107     /**
108      * When to display thumbs of pictures, videos, ...
109      * @hide
110      */
111     SETTINGS_DISPLAY_THUMBS(
112             "cm_filemanager_show_thumbs", Boolean.TRUE), //$NON-NLS-1$
113     /**
114      * Whether use flinger to remove items
115      * @hide
116      */
117     SETTINGS_USE_FLINGER("cm_filemanager_use_flinger", Boolean.FALSE),  //$NON-NLS-1$
118
119
120     /**
121      * When to highlight the terms of the search in the search results
122      * @hide
123      */
124     SETTINGS_HIGHLIGHT_TERMS("cm_filemanager_highlight_terms", Boolean.TRUE), //$NON-NLS-1$
125     /**
126      * When to show the relevance widget on searches
127      * @hide
128      */
129     SETTINGS_SHOW_RELEVANCE_WIDGET(
130             "cm_filemanager_show_relevance_widget", //$NON-NLS-1$
131             Boolean.TRUE),
132     /**
133      * How to sort the search results
134      * @hide
135      */
136     SETTINGS_SORT_SEARCH_RESULTS_MODE(
137             "cm_filemanager_sort_search_results_mode", //$NON-NLS-1$
138             SearchSortResultMode.RELEVANCE),
139     /**
140      * When to save the search terms
141      * @hide
142      */
143     SETTINGS_SAVE_SEARCH_TERMS("cm_filemanager_save_search_terms", Boolean.TRUE), //$NON-NLS-1$
144
145     /**
146      * When to delayed filesystem synchronization in secure storages
147      * @hide
148      */
149     SETTINGS_SECURE_STORAGE_DELAYED_SYNC("cm_filemanager_secure_storage_delayed_sync",
150             Boolean.TRUE), //$NON-NLS-1$
151
152     /**
153      * When to show debug traces
154      * @hide
155      */
156     SETTINGS_SHOW_TRACES("cm_filemanager_show_debug_traces", Boolean.FALSE), //$NON-NLS-1$
157
158     /**
159      * When to editor should display suggestions
160      * @hide
161      */
162     SETTINGS_EDITOR_NO_SUGGESTIONS(
163             "cm_filemanager_editor_no_suggestions", Boolean.FALSE), //$NON-NLS-1$
164
165     /**
166      * When to editor should use word wrap
167      * @hide
168      */
169     SETTINGS_EDITOR_WORD_WRAP("cm_filemanager_editor_word_wrap", Boolean.TRUE), //$NON-NLS-1$
170
171     /**
172      * When to editor should open a binary file in a hex viewer
173      * @hide
174      */
175     SETTINGS_EDITOR_HEXDUMP("cm_filemanager_editor_hexdump", Boolean.TRUE), //$NON-NLS-1$
176
177     /**
178      * When to editor should use the syntax highlight
179      * @hide
180      */
181     SETTINGS_EDITOR_SYNTAX_HIGHLIGHT(
182             "cm_filemanager_editor_syntax_highlight", Boolean.TRUE), //$NON-NLS-1$
183
184     /**
185      * When to editor should use the default color scheme of the theme for syntax highlight
186      * @hide
187      */
188     SETTINGS_EDITOR_SH_USE_THEME_DEFAULT(
189             "cm_filemanager_editor_sh_use_theme_default", Boolean.TRUE), //$NON-NLS-1$
190
191     /**
192      * When to editor should use the default color scheme of the theme for syntax highlight
193      * @hide
194      */
195     SETTINGS_EDITOR_SH_COLOR_SCHEME(
196             "cm_filemanager_editor_sh_color_scheme", ""), //$NON-NLS-1$ //$NON-NLS-2$
197
198     /**
199      * The current theme to use in the app
200      * @hide
201      */
202     SETTINGS_THEME("cm_filemanager_theme", //$NON-NLS-1$
203                         "com.cyanogenmod.filemanager:light"),
204
205     /**
206      * The current theme to use in the app
207      * @hide
208      */
209     USER_PREF_LAST_DRAWER_TAB("last_drawer_tab", //$NON-NLS-1$
210                         Integer.valueOf(0));
211
212
213
214     /**
215      * A broadcast intent that is sent when a setting was changed
216      */
217     public final static String INTENT_SETTING_CHANGED =
218                         "com.cyanogenmod.filemanager.INTENT_SETTING_CHANGED"; //$NON-NLS-1$
219
220     /**
221      * A broadcast intent that is sent when a theme was changed
222      */
223     public final static String INTENT_THEME_CHANGED =
224                         "com.cyanogenmod.filemanager.INTENT_THEME_CHANGED"; //$NON-NLS-1$
225
226     /**
227      * A broadcast intent that is sent when a setting was changed
228      */
229     public final static String INTENT_MOUNT_STATUS_CHANGED =
230                         "com.cyanogenmod.filemanager.INTENT_MOUNT_STATUS_CHANGED"; //$NON-NLS-1$
231
232     /**
233      * A broadcast intent that is sent when a file was changed
234      */
235     public final static String INTENT_FILE_CHANGED =
236                         "com.cyanogenmod.filemanager.INTENT_FILE_CHANGED"; //$NON-NLS-1$
237
238     /**
239      * The extra key with the preference key that was changed
240      */
241     public final static String EXTRA_SETTING_CHANGED_KEY = "preference"; //$NON-NLS-1$
242
243     /**
244      * The extra key with the file key that was changed
245      */
246     public final static String EXTRA_FILE_CHANGED_KEY = "file"; //$NON-NLS-1$
247
248     /**
249      * The extra key with the file key that was changed
250      */
251     public final static String EXTRA_THEME_PACKAGE = "package"; //$NON-NLS-1$
252
253     /**
254      * The extra key with the identifier of theme that was changed
255      */
256     public final static String EXTRA_THEME_ID = "id"; //$NON-NLS-1$
257
258     /**
259      * The extra key with the identifier a mountpoint event
260      */
261     public final static String EXTRA_MOUNTPOINT = "mount_point"; //$NON-NLS-1$
262
263     /**
264      * The extra key with the notify the status of an object
265      */
266     public final static String EXTRA_STATUS = "status"; //$NON-NLS-1$
267
268
269
270
271     private final String mId;
272     private final Object mDefaultValue;
273
274     /**
275      * Constructor of <code>FileManagerSettings</code>.
276      *
277      * @param id The unique identifier of the setting
278      * @param defaultValue The default value of the setting
279      */
280     private FileManagerSettings(String id, Object defaultValue) {
281         this.mId = id;
282         this.mDefaultValue = defaultValue;
283     }
284
285     /**
286      * Method that returns the unique identifier of the setting.
287      * @return the mId
288      */
289     public String getId() {
290         return this.mId;
291     }
292
293     /**
294      * Method that returns the default value of the setting.
295      *
296      * @return Object The default value of the setting
297      */
298     public Object getDefaultValue() {
299         return this.mDefaultValue;
300     }
301
302     /**
303      * Method that returns an instance of {@link FileManagerSettings} from its.
304      * unique identifier
305      *
306      * @param id The unique identifier
307      * @return FileManagerSettings The navigation sort mode
308      */
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) {
314                 return values[i];
315             }
316         }
317         return null;
318     }
319 }