The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2008 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.launcher; |
| 18 | |
| 19 | import android.provider.BaseColumns; |
| 20 | import android.net.Uri; |
| 21 | |
| 22 | /** |
| 23 | * Settings related utilities. |
| 24 | */ |
| 25 | class LauncherSettings { |
| 26 | /** |
| 27 | * Favorites. When changing these values, be sure to update |
| 28 | * {@link com.android.settings.LauncherGadgetBinder} as needed. |
| 29 | */ |
| 30 | static final class Favorites implements BaseColumns { |
| 31 | /** |
| 32 | * The content:// style URL for this table |
| 33 | */ |
| 34 | static final Uri CONTENT_URI = Uri.parse("content://" + |
| 35 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 36 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 37 | |
| 38 | /** |
| 39 | * The content:// style URL for this table. When this Uri is used, no notification is |
| 40 | * sent if the content changes. |
| 41 | */ |
| 42 | static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" + |
| 43 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 44 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=false"); |
| 45 | |
| 46 | /** |
| 47 | * The content:// style URL for a given row, identified by its id. |
| 48 | * |
| 49 | * @param id The row id. |
| 50 | * @param notify True to send a notification is the content changes. |
| 51 | * |
| 52 | * @return The unique content URL for the specified row. |
| 53 | */ |
| 54 | static Uri getContentUri(long id, boolean notify) { |
| 55 | return Uri.parse("content://" + LauncherProvider.AUTHORITY + |
| 56 | "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" + |
| 57 | LauncherProvider.PARAMETER_NOTIFY + "=" + notify); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * The row ID. |
| 62 | * <p>Type: INTEGER</p> |
| 63 | */ |
| 64 | static final String ID = "_id"; |
| 65 | |
| 66 | /** |
| 67 | * Descriptive name of the favorite that can be displayed to the user. |
| 68 | * <P>Type: TEXT</P> |
| 69 | */ |
| 70 | static final String TITLE = "title"; |
| 71 | |
| 72 | /** |
| 73 | * The Intent URL of the favorite, describing what it points to. This |
| 74 | * value is given to {@link android.content.Intent#getIntent} to create |
| 75 | * an Intent that can be launched. |
| 76 | * <P>Type: TEXT</P> |
| 77 | */ |
| 78 | static final String INTENT = "intent"; |
| 79 | |
| 80 | /** |
| 81 | * The container holding the favorite |
| 82 | * <P>Type: INTEGER</P> |
| 83 | */ |
| 84 | static final String CONTAINER = "container"; |
| 85 | |
| 86 | /** |
| 87 | * The icon is a resource identified by a package name and an integer id. |
| 88 | */ |
| 89 | static final int CONTAINER_DESKTOP = -100; |
| 90 | |
| 91 | /** |
| 92 | * The screen holding the favorite (if container is CONTAINER_DESKTOP) |
| 93 | * <P>Type: INTEGER</P> |
| 94 | */ |
| 95 | static final String SCREEN = "screen"; |
| 96 | |
| 97 | /** |
| 98 | * The X coordinate of the cell holding the favorite |
| 99 | * (if container is CONTAINER_DESKTOP or CONTAINER_DOCK) |
| 100 | * <P>Type: INTEGER</P> |
| 101 | */ |
| 102 | static final String CELLX = "cellX"; |
| 103 | |
| 104 | /** |
| 105 | * The Y coordinate of the cell holding the favorite |
| 106 | * (if container is CONTAINER_DESKTOP) |
| 107 | * <P>Type: INTEGER</P> |
| 108 | */ |
| 109 | static final String CELLY = "cellY"; |
| 110 | |
| 111 | /** |
| 112 | * The X span of the cell holding the favorite |
| 113 | * <P>Type: INTEGER</P> |
| 114 | */ |
| 115 | static final String SPANX = "spanX"; |
| 116 | |
| 117 | /** |
| 118 | * The Y span of the cell holding the favorite |
| 119 | * <P>Type: INTEGER</P> |
| 120 | */ |
| 121 | static final String SPANY = "spanY"; |
| 122 | |
| 123 | /** |
| 124 | * The type of the favorite |
| 125 | * |
| 126 | * <P>Type: INTEGER</P> |
| 127 | */ |
| 128 | static final String ITEM_TYPE = "itemType"; |
| 129 | |
| 130 | /** |
| 131 | * The favorite is an application |
| 132 | */ |
| 133 | static final int ITEM_TYPE_APPLICATION = 0; |
| 134 | |
| 135 | /** |
| 136 | * The favorite is an application created shortcut |
| 137 | */ |
| 138 | static final int ITEM_TYPE_SHORTCUT = 1; |
| 139 | |
| 140 | /** |
| 141 | * The favorite is a user created folder |
| 142 | */ |
| 143 | static final int ITEM_TYPE_USER_FOLDER = 2; |
| 144 | |
| 145 | /** |
| 146 | * The favorite is a live folder |
| 147 | */ |
| 148 | static final int ITEM_TYPE_LIVE_FOLDER = 3; |
| 149 | |
| 150 | /** |
| 151 | * The favorite is a gadget |
| 152 | */ |
| 153 | static final int ITEM_TYPE_GADGET = 4; |
| 154 | |
| 155 | /** |
| 156 | * The favorite is a clock |
| 157 | */ |
| 158 | static final int ITEM_TYPE_WIDGET_CLOCK = 1000; |
| 159 | |
| 160 | /** |
| 161 | * The favorite is a search widget |
| 162 | */ |
| 163 | static final int ITEM_TYPE_WIDGET_SEARCH = 1001; |
| 164 | |
| 165 | /** |
| 166 | * The favorite is a photo frame |
| 167 | */ |
| 168 | static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002; |
| 169 | |
| 170 | /** |
| 171 | * The gadgetId of the gadget |
| 172 | * |
| 173 | * <P>Type: INTEGER</P> |
| 174 | */ |
| 175 | static final String GADGET_ID = "gadgetId"; |
| 176 | |
| 177 | /** |
| 178 | * Indicates whether this favorite is an application-created shortcut or not. |
| 179 | * If the value is 0, the favorite is not an application-created shortcut, if the |
| 180 | * value is 1, it is an application-created shortcut. |
| 181 | * <P>Type: INTEGER</P> |
| 182 | */ |
| 183 | static final String IS_SHORTCUT = "isShortcut"; |
| 184 | |
| 185 | /** |
| 186 | * The icon type. |
| 187 | * <P>Type: INTEGER</P> |
| 188 | */ |
| 189 | static final String ICON_TYPE = "iconType"; |
| 190 | |
| 191 | /** |
| 192 | * The icon is a resource identified by a package name and an integer id. |
| 193 | */ |
| 194 | static final int ICON_TYPE_RESOURCE = 0; |
| 195 | |
| 196 | /** |
| 197 | * The icon is a bitmap. |
| 198 | */ |
| 199 | static final int ICON_TYPE_BITMAP = 1; |
| 200 | |
| 201 | /** |
| 202 | * The icon package name, if icon type is ICON_TYPE_RESOURCE. |
| 203 | * <P>Type: TEXT</P> |
| 204 | */ |
| 205 | static final String ICON_PACKAGE = "iconPackage"; |
| 206 | |
| 207 | /** |
| 208 | * The icon resource id, if icon type is ICON_TYPE_RESOURCE. |
| 209 | * <P>Type: TEXT</P> |
| 210 | */ |
| 211 | static final String ICON_RESOURCE = "iconResource"; |
| 212 | |
| 213 | /** |
| 214 | * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP. |
| 215 | * <P>Type: BLOB</P> |
| 216 | */ |
| 217 | static final String ICON = "icon"; |
| 218 | |
| 219 | /** |
| 220 | * The URI associated with the favorite. It is used, for instance, by |
| 221 | * live folders to find the content provider. |
| 222 | * <P>Type: TEXT</P> |
| 223 | */ |
| 224 | static final String URI = "uri"; |
| 225 | |
| 226 | /** |
| 227 | * The display mode if the item is a live folder. |
| 228 | * <P>Type: INTEGER</P> |
| 229 | * |
| 230 | * @see android.provider.LiveFolders#DISPLAY_MODE_GRID |
| 231 | * @see android.provider.LiveFolders#DISPLAY_MODE_LIST |
| 232 | */ |
| 233 | static final String DISPLAY_MODE = "displayMode"; |
| 234 | } |
| 235 | } |