blob: af04b5f528266908c266408585e8c85baeb7e4a4 [file] [log] [blame]
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -07001/*
2 * Copyright (C) 2014 The Android Open Source 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
17package com.android.settings.search;
18
19import android.provider.SearchIndexableResource;
John Spurlock4a350512014-04-08 14:08:21 -040020
Fabrice Di Meglio758c3ff2014-04-10 13:47:30 -070021import com.android.settings.DataUsageSummary;
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070022import com.android.settings.DateTimeSettings;
23import com.android.settings.DevelopmentSettings;
24import com.android.settings.DeviceInfoSettings;
25import com.android.settings.DisplaySettings;
26import com.android.settings.HomeSettings;
27import com.android.settings.PrivacySettings;
28import com.android.settings.R;
29import com.android.settings.SecuritySettings;
30import com.android.settings.SoundSettings;
31import com.android.settings.WallpaperTypeSettings;
32import com.android.settings.WirelessSettings;
33import com.android.settings.accessibility.AccessibilitySettings;
34import com.android.settings.bluetooth.BluetoothSettings;
35import com.android.settings.deviceinfo.Memory;
36import com.android.settings.fuelgauge.PowerUsageSummary;
37import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
38import com.android.settings.location.LocationSettings;
John Spurlock4a350512014-04-08 14:08:21 -040039import com.android.settings.notification.NotificationSettings;
40import com.android.settings.notification.ZenModeSettings;
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070041import com.android.settings.print.PrintSettingsFragment;
42import com.android.settings.users.UserSettings;
43import com.android.settings.wifi.WifiSettings;
44
45import java.util.Collection;
46import java.util.HashMap;
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070047
48public final class SearchIndexableResources {
49
Fabrice Di Meglioa9d37052014-04-10 17:58:27 -070050 public static int NO_DATA_RES_ID = 0;
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070051
Fabrice Di Megliod1d2f022014-04-11 16:09:11 -070052 public static final int RANK_WIFI = 1;
53 public static final int RANK_BT = 2;
54 public static final int RANK_DATA_USAGE = 3;
55 public static final int RANK_WIRELESS = 4;
56 public static final int RANK_HOME = 5;
57 public static final int RANK_SOUND = 6;
58 public static final int RANK_DISPLAY = 7;
59 public static final int RANK_WALLPAPER = 7;
60 public static final int RANK_NOTIFICATIONS = 8;
61 public static final int RANK_MEMORY = 9;
62 public static final int RANK_POWER_USAGE = 10;
63 public static final int RANK_USERS = 11;
64 public static final int RANK_LOCATION = 12;
65 public static final int RANK_SECURITY = 13;
66 public static final int RANK_IME = 14;
67 public static final int RANK_PRIVACY = 15;
68 public static final int RANK_DATE_TIME = 16;
69 public static final int RANK_ACCESSIBILITY = 17;
70 public static final int RANK_PRINTING = 18;
71 public static final int RANK_DEVELOPEMENT = 19;
72 public static final int RANK_DEVICE_INFO = 20;
Fabrice Di Meglio95937822014-03-31 19:46:42 -070073
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070074 private static HashMap<String, SearchIndexableResource> sResMap =
75 new HashMap<String, SearchIndexableResource>();
76
77
78 static {
79 sResMap.put(WifiSettings.class.getName(),
Fabrice Di Meglio95937822014-03-31 19:46:42 -070080 new SearchIndexableResource(RANK_WIFI,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070081 NO_DATA_RES_ID,
82 WifiSettings.class.getName(),
83 R.drawable.ic_settings_wireless));
84
85 sResMap.put(BluetoothSettings.class.getName(),
Fabrice Di Meglio95937822014-03-31 19:46:42 -070086 new SearchIndexableResource(RANK_BT,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070087 NO_DATA_RES_ID,
88 BluetoothSettings.class.getName(),
89 R.drawable.ic_settings_bluetooth2));
90
Fabrice Di Meglio758c3ff2014-04-10 13:47:30 -070091 sResMap.put(DataUsageSummary.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -070092 new SearchIndexableResource(RANK_DATA_USAGE,
Fabrice Di Meglio758c3ff2014-04-10 13:47:30 -070093 NO_DATA_RES_ID,
94 DataUsageSummary.class.getName(),
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -070095 R.drawable.ic_settings_data_usage));
96
97 sResMap.put(WirelessSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -070098 new SearchIndexableResource(RANK_WIRELESS,
99 R.xml.wireless_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700100 WirelessSettings.class.getName(),
101 R.drawable.empty_icon));
102
103 sResMap.put(HomeSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700104 new SearchIndexableResource(RANK_HOME,
105 R.xml.home_selection,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700106 HomeSettings.class.getName(),
107 R.drawable.ic_settings_home));
108
109 sResMap.put(SoundSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700110 new SearchIndexableResource(RANK_SOUND,
111 R.xml.sound_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700112 SoundSettings.class.getName(),
113 R.drawable.ic_settings_sound));
114
115 sResMap.put(DisplaySettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700116 new SearchIndexableResource(RANK_DISPLAY,
117 R.xml.display_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700118 DisplaySettings.class.getName(),
119 R.drawable.ic_settings_display));
120
121 sResMap.put(WallpaperTypeSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700122 new SearchIndexableResource(RANK_WALLPAPER,
123 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700124 WallpaperTypeSettings.class.getName(),
125 R.drawable.ic_settings_display));
126
Fabrice Di Meglio95937822014-03-31 19:46:42 -0700127 sResMap.put(NotificationSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700128 new SearchIndexableResource(RANK_NOTIFICATIONS,
129 R.xml.notification_settings,
Fabrice Di Meglio95937822014-03-31 19:46:42 -0700130 NotificationSettings.class.getName(),
131 R.drawable.ic_settings_notifications));
132
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700133 sResMap.put(ZenModeSettings.class.getName(),
134 new SearchIndexableResource(RANK_NOTIFICATIONS,
135 NO_DATA_RES_ID,
136 ZenModeSettings.class.getName(),
137 R.drawable.ic_settings_notifications));
138
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700139 sResMap.put(Memory.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700140 new SearchIndexableResource(RANK_MEMORY,
Fabrice Di Megliof66eb7a2014-04-02 17:07:36 -0700141 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700142 Memory.class.getName(),
143 R.drawable.ic_settings_storage));
144
145 sResMap.put(PowerUsageSummary.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700146 new SearchIndexableResource(RANK_POWER_USAGE,
147 R.xml.power_usage_summary,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700148 PowerUsageSummary.class.getName(),
149 R.drawable.ic_settings_battery));
150
151 sResMap.put(UserSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700152 new SearchIndexableResource(RANK_USERS,
153 R.xml.user_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700154 UserSettings.class.getName(),
155 R.drawable.ic_settings_multiuser));
156
157 sResMap.put(LocationSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700158 new SearchIndexableResource(RANK_LOCATION,
159 R.xml.location_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700160 LocationSettings.class.getName(),
161 R.drawable.ic_settings_location));
162
163 sResMap.put(SecuritySettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700164 new SearchIndexableResource(RANK_SECURITY,
Fabrice Di Megliod1d2f022014-04-11 16:09:11 -0700165 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700166 SecuritySettings.class.getName(),
167 R.drawable.ic_settings_security));
168
169 sResMap.put(InputMethodAndLanguageSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700170 new SearchIndexableResource(RANK_IME,
Svetoslav990159a2014-04-14 17:14:59 -0700171 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700172 InputMethodAndLanguageSettings.class.getName(),
173 R.drawable.ic_settings_language));
174
175 sResMap.put(PrivacySettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700176 new SearchIndexableResource(RANK_PRIVACY,
177 R.xml.privacy_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700178 PrivacySettings.class.getName(),
179 R.drawable.ic_settings_backup));
180
181 sResMap.put(DateTimeSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700182 new SearchIndexableResource(RANK_DATE_TIME,
183 R.xml.date_time_prefs,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700184 DateTimeSettings.class.getName(),
185 R.drawable.ic_settings_date_time));
186
187 sResMap.put(AccessibilitySettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700188 new SearchIndexableResource(RANK_ACCESSIBILITY,
Svetoslavb4b30822014-04-11 17:06:17 -0700189 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700190 AccessibilitySettings.class.getName(),
191 R.drawable.ic_settings_accessibility));
192
193 sResMap.put(PrintSettingsFragment.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700194 new SearchIndexableResource(RANK_PRINTING,
Svetoslavd78d44d2014-04-11 16:07:43 -0700195 NO_DATA_RES_ID,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700196 PrintSettingsFragment.class.getName(),
197 com.android.internal.R.drawable.ic_print));
198
199 sResMap.put(DevelopmentSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700200 new SearchIndexableResource(RANK_DEVELOPEMENT,
201 R.xml.development_prefs,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700202 DevelopmentSettings.class.getName(),
203 R.drawable.ic_settings_development));
204
205 sResMap.put(DeviceInfoSettings.class.getName(),
Fabrice Di Meglio019b87f2014-04-01 14:30:07 -0700206 new SearchIndexableResource(RANK_DEVICE_INFO,
207 R.xml.device_info_settings,
Fabrice Di Meglio51bfee52014-03-20 19:52:29 -0700208 DeviceInfoSettings.class.getName(),
209 R.drawable.ic_settings_about));
210 }
211
212 private SearchIndexableResources() {
213 }
214
215 public static int size() {
216 return sResMap.size();
217 }
218
219 public static SearchIndexableResource getResourceByName(String className) {
220 return sResMap.get(className);
221 }
222
223 public static Collection<SearchIndexableResource> values() {
224 return sResMap.values();
225 }
226}