Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.settings.search; |
| 18 | |
| 19 | import android.provider.SearchIndexableResource; |
John Spurlock | 4a35051 | 2014-04-08 14:08:21 -0400 | [diff] [blame^] | 20 | |
Fabrice Di Meglio | 758c3ff | 2014-04-10 13:47:30 -0700 | [diff] [blame] | 21 | import com.android.settings.DataUsageSummary; |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 22 | import com.android.settings.DateTimeSettings; |
| 23 | import com.android.settings.DevelopmentSettings; |
| 24 | import com.android.settings.DeviceInfoSettings; |
| 25 | import com.android.settings.DisplaySettings; |
| 26 | import com.android.settings.HomeSettings; |
| 27 | import com.android.settings.PrivacySettings; |
| 28 | import com.android.settings.R; |
| 29 | import com.android.settings.SecuritySettings; |
| 30 | import com.android.settings.SoundSettings; |
| 31 | import com.android.settings.WallpaperTypeSettings; |
| 32 | import com.android.settings.WirelessSettings; |
| 33 | import com.android.settings.accessibility.AccessibilitySettings; |
| 34 | import com.android.settings.bluetooth.BluetoothSettings; |
| 35 | import com.android.settings.deviceinfo.Memory; |
| 36 | import com.android.settings.fuelgauge.PowerUsageSummary; |
| 37 | import com.android.settings.inputmethod.InputMethodAndLanguageSettings; |
| 38 | import com.android.settings.location.LocationSettings; |
John Spurlock | 4a35051 | 2014-04-08 14:08:21 -0400 | [diff] [blame^] | 39 | import com.android.settings.notification.NotificationSettings; |
| 40 | import com.android.settings.notification.ZenModeSettings; |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 41 | import com.android.settings.print.PrintSettingsFragment; |
| 42 | import com.android.settings.users.UserSettings; |
| 43 | import com.android.settings.wifi.WifiSettings; |
| 44 | |
| 45 | import java.util.Collection; |
| 46 | import java.util.HashMap; |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 47 | |
| 48 | public final class SearchIndexableResources { |
| 49 | |
Fabrice Di Meglio | a9d3705 | 2014-04-10 17:58:27 -0700 | [diff] [blame] | 50 | public static int NO_DATA_RES_ID = 0; |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 51 | |
Fabrice Di Meglio | d1d2f02 | 2014-04-11 16:09:11 -0700 | [diff] [blame] | 52 | 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 Meglio | 9593782 | 2014-03-31 19:46:42 -0700 | [diff] [blame] | 73 | |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 74 | private static HashMap<String, SearchIndexableResource> sResMap = |
| 75 | new HashMap<String, SearchIndexableResource>(); |
| 76 | |
| 77 | |
| 78 | static { |
| 79 | sResMap.put(WifiSettings.class.getName(), |
Fabrice Di Meglio | 9593782 | 2014-03-31 19:46:42 -0700 | [diff] [blame] | 80 | new SearchIndexableResource(RANK_WIFI, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 81 | NO_DATA_RES_ID, |
| 82 | WifiSettings.class.getName(), |
| 83 | R.drawable.ic_settings_wireless)); |
| 84 | |
| 85 | sResMap.put(BluetoothSettings.class.getName(), |
Fabrice Di Meglio | 9593782 | 2014-03-31 19:46:42 -0700 | [diff] [blame] | 86 | new SearchIndexableResource(RANK_BT, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 87 | NO_DATA_RES_ID, |
| 88 | BluetoothSettings.class.getName(), |
| 89 | R.drawable.ic_settings_bluetooth2)); |
| 90 | |
Fabrice Di Meglio | 758c3ff | 2014-04-10 13:47:30 -0700 | [diff] [blame] | 91 | sResMap.put(DataUsageSummary.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 92 | new SearchIndexableResource(RANK_DATA_USAGE, |
Fabrice Di Meglio | 758c3ff | 2014-04-10 13:47:30 -0700 | [diff] [blame] | 93 | NO_DATA_RES_ID, |
| 94 | DataUsageSummary.class.getName(), |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 95 | R.drawable.ic_settings_data_usage)); |
| 96 | |
| 97 | sResMap.put(WirelessSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 98 | new SearchIndexableResource(RANK_WIRELESS, |
| 99 | R.xml.wireless_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 100 | WirelessSettings.class.getName(), |
| 101 | R.drawable.empty_icon)); |
| 102 | |
| 103 | sResMap.put(HomeSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 104 | new SearchIndexableResource(RANK_HOME, |
| 105 | R.xml.home_selection, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 106 | HomeSettings.class.getName(), |
| 107 | R.drawable.ic_settings_home)); |
| 108 | |
| 109 | sResMap.put(SoundSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 110 | new SearchIndexableResource(RANK_SOUND, |
| 111 | R.xml.sound_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 112 | SoundSettings.class.getName(), |
| 113 | R.drawable.ic_settings_sound)); |
| 114 | |
| 115 | sResMap.put(DisplaySettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 116 | new SearchIndexableResource(RANK_DISPLAY, |
| 117 | R.xml.display_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 118 | DisplaySettings.class.getName(), |
| 119 | R.drawable.ic_settings_display)); |
| 120 | |
| 121 | sResMap.put(WallpaperTypeSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 122 | new SearchIndexableResource(RANK_WALLPAPER, |
| 123 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 124 | WallpaperTypeSettings.class.getName(), |
| 125 | R.drawable.ic_settings_display)); |
| 126 | |
Fabrice Di Meglio | 9593782 | 2014-03-31 19:46:42 -0700 | [diff] [blame] | 127 | sResMap.put(NotificationSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 128 | new SearchIndexableResource(RANK_NOTIFICATIONS, |
| 129 | R.xml.notification_settings, |
Fabrice Di Meglio | 9593782 | 2014-03-31 19:46:42 -0700 | [diff] [blame] | 130 | NotificationSettings.class.getName(), |
| 131 | R.drawable.ic_settings_notifications)); |
| 132 | |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 133 | 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 Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 139 | sResMap.put(Memory.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 140 | new SearchIndexableResource(RANK_MEMORY, |
Fabrice Di Meglio | f66eb7a | 2014-04-02 17:07:36 -0700 | [diff] [blame] | 141 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 142 | Memory.class.getName(), |
| 143 | R.drawable.ic_settings_storage)); |
| 144 | |
| 145 | sResMap.put(PowerUsageSummary.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 146 | new SearchIndexableResource(RANK_POWER_USAGE, |
| 147 | R.xml.power_usage_summary, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 148 | PowerUsageSummary.class.getName(), |
| 149 | R.drawable.ic_settings_battery)); |
| 150 | |
| 151 | sResMap.put(UserSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 152 | new SearchIndexableResource(RANK_USERS, |
| 153 | R.xml.user_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 154 | UserSettings.class.getName(), |
| 155 | R.drawable.ic_settings_multiuser)); |
| 156 | |
| 157 | sResMap.put(LocationSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 158 | new SearchIndexableResource(RANK_LOCATION, |
| 159 | R.xml.location_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 160 | LocationSettings.class.getName(), |
| 161 | R.drawable.ic_settings_location)); |
| 162 | |
| 163 | sResMap.put(SecuritySettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 164 | new SearchIndexableResource(RANK_SECURITY, |
Fabrice Di Meglio | d1d2f02 | 2014-04-11 16:09:11 -0700 | [diff] [blame] | 165 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 166 | SecuritySettings.class.getName(), |
| 167 | R.drawable.ic_settings_security)); |
| 168 | |
| 169 | sResMap.put(InputMethodAndLanguageSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 170 | new SearchIndexableResource(RANK_IME, |
Svetoslav | 990159a | 2014-04-14 17:14:59 -0700 | [diff] [blame] | 171 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 172 | InputMethodAndLanguageSettings.class.getName(), |
| 173 | R.drawable.ic_settings_language)); |
| 174 | |
| 175 | sResMap.put(PrivacySettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 176 | new SearchIndexableResource(RANK_PRIVACY, |
| 177 | R.xml.privacy_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 178 | PrivacySettings.class.getName(), |
| 179 | R.drawable.ic_settings_backup)); |
| 180 | |
| 181 | sResMap.put(DateTimeSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 182 | new SearchIndexableResource(RANK_DATE_TIME, |
| 183 | R.xml.date_time_prefs, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 184 | DateTimeSettings.class.getName(), |
| 185 | R.drawable.ic_settings_date_time)); |
| 186 | |
| 187 | sResMap.put(AccessibilitySettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 188 | new SearchIndexableResource(RANK_ACCESSIBILITY, |
Svetoslav | b4b3082 | 2014-04-11 17:06:17 -0700 | [diff] [blame] | 189 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 190 | AccessibilitySettings.class.getName(), |
| 191 | R.drawable.ic_settings_accessibility)); |
| 192 | |
| 193 | sResMap.put(PrintSettingsFragment.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 194 | new SearchIndexableResource(RANK_PRINTING, |
Svetoslav | d78d44d | 2014-04-11 16:07:43 -0700 | [diff] [blame] | 195 | NO_DATA_RES_ID, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 196 | PrintSettingsFragment.class.getName(), |
| 197 | com.android.internal.R.drawable.ic_print)); |
| 198 | |
| 199 | sResMap.put(DevelopmentSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 200 | new SearchIndexableResource(RANK_DEVELOPEMENT, |
| 201 | R.xml.development_prefs, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 202 | DevelopmentSettings.class.getName(), |
| 203 | R.drawable.ic_settings_development)); |
| 204 | |
| 205 | sResMap.put(DeviceInfoSettings.class.getName(), |
Fabrice Di Meglio | 019b87f | 2014-04-01 14:30:07 -0700 | [diff] [blame] | 206 | new SearchIndexableResource(RANK_DEVICE_INFO, |
| 207 | R.xml.device_info_settings, |
Fabrice Di Meglio | 51bfee5 | 2014-03-20 19:52:29 -0700 | [diff] [blame] | 208 | 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 | } |