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 | |
Daniel Sandler | 325dc23 | 2013-06-05 22:57:57 -0400 | [diff] [blame] | 17 | package com.android.launcher3; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 18 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 19 | import android.net.Uri; |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 20 | import android.provider.BaseColumns; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Settings related utilities. |
| 24 | */ |
| 25 | class LauncherSettings { |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 26 | /** Columns required on table staht will be subject to backup and restore. */ |
| 27 | static interface ChangeLogColumns extends BaseColumns { |
| 28 | /** |
| 29 | * The time of the last update to this row. |
| 30 | * <P>Type: INTEGER</P> |
| 31 | */ |
| 32 | static final String MODIFIED = "modified"; |
| 33 | } |
| 34 | |
| 35 | static interface BaseLauncherColumns extends ChangeLogColumns { |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Descriptive name of the gesture that can be displayed to the user. |
| 38 | * <P>Type: TEXT</P> |
| 39 | */ |
| 40 | static final String TITLE = "title"; |
| 41 | |
| 42 | /** |
| 43 | * The Intent URL of the gesture, describing what it points to. This |
Romain Guy | 1ce1a24 | 2009-06-23 17:34:54 -0700 | [diff] [blame] | 44 | * value is given to {@link android.content.Intent#parseUri(String, int)} to create |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 45 | * an Intent that can be launched. |
| 46 | * <P>Type: TEXT</P> |
| 47 | */ |
| 48 | static final String INTENT = "intent"; |
| 49 | |
| 50 | /** |
| 51 | * The type of the gesture |
| 52 | * |
| 53 | * <P>Type: INTEGER</P> |
| 54 | */ |
| 55 | static final String ITEM_TYPE = "itemType"; |
| 56 | |
| 57 | /** |
| 58 | * The gesture is an application |
| 59 | */ |
| 60 | static final int ITEM_TYPE_APPLICATION = 0; |
| 61 | |
| 62 | /** |
| 63 | * The gesture is an application created shortcut |
| 64 | */ |
| 65 | static final int ITEM_TYPE_SHORTCUT = 1; |
| 66 | |
| 67 | /** |
| 68 | * The icon type. |
| 69 | * <P>Type: INTEGER</P> |
| 70 | */ |
| 71 | static final String ICON_TYPE = "iconType"; |
| 72 | |
| 73 | /** |
| 74 | * The icon is a resource identified by a package name and an integer id. |
| 75 | */ |
| 76 | static final int ICON_TYPE_RESOURCE = 0; |
| 77 | |
| 78 | /** |
| 79 | * The icon is a bitmap. |
| 80 | */ |
| 81 | static final int ICON_TYPE_BITMAP = 1; |
| 82 | |
| 83 | /** |
| 84 | * The icon package name, if icon type is ICON_TYPE_RESOURCE. |
| 85 | * <P>Type: TEXT</P> |
| 86 | */ |
| 87 | static final String ICON_PACKAGE = "iconPackage"; |
| 88 | |
| 89 | /** |
| 90 | * The icon resource id, if icon type is ICON_TYPE_RESOURCE. |
| 91 | * <P>Type: TEXT</P> |
| 92 | */ |
| 93 | static final String ICON_RESOURCE = "iconResource"; |
| 94 | |
| 95 | /** |
| 96 | * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP. |
| 97 | * <P>Type: BLOB</P> |
| 98 | */ |
| 99 | static final String ICON = "icon"; |
| 100 | } |
| 101 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 102 | /** |
Adam Cohen | dcd297f | 2013-06-18 13:13:40 -0700 | [diff] [blame] | 103 | * Workspace Screens. |
| 104 | * |
| 105 | * Tracks the order of workspace screens. |
| 106 | */ |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 107 | static final class WorkspaceScreens implements ChangeLogColumns { |
Adam Cohen | dcd297f | 2013-06-18 13:13:40 -0700 | [diff] [blame] | 108 | /** |
| 109 | * The content:// style URL for this table |
| 110 | */ |
| 111 | static final Uri CONTENT_URI = Uri.parse("content://" + |
| 112 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_WORKSPACE_SCREENS + |
| 113 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 114 | |
| 115 | /** |
| 116 | * The rank of this screen -- ie. how it is ordered relative to the other screens. |
| 117 | * <P>Type: INTEGER</P> |
| 118 | */ |
| 119 | static final String SCREEN_RANK = "screenRank"; |
| 120 | } |
| 121 | |
| 122 | /** |
Bjorn Bringert | 93c4576 | 2009-12-16 13:19:47 +0000 | [diff] [blame] | 123 | * Favorites. |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 124 | */ |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 125 | static final class Favorites implements BaseLauncherColumns { |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 126 | /** |
| 127 | * The content:// style URL for this table |
| 128 | */ |
| 129 | static final Uri CONTENT_URI = Uri.parse("content://" + |
| 130 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 131 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 132 | |
| 133 | /** |
Adam Cohen | e25af79 | 2013-06-06 23:08:25 -0700 | [diff] [blame] | 134 | * The content:// style URL for this table |
| 135 | */ |
| 136 | static final Uri OLD_CONTENT_URI = Uri.parse("content://" + |
| 137 | LauncherProvider.OLD_AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 138 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 139 | |
| 140 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 141 | * The content:// style URL for this table. When this Uri is used, no notification is |
| 142 | * sent if the content changes. |
| 143 | */ |
| 144 | static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" + |
| 145 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 146 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=false"); |
| 147 | |
| 148 | /** |
| 149 | * The content:// style URL for a given row, identified by its id. |
| 150 | * |
| 151 | * @param id The row id. |
| 152 | * @param notify True to send a notification is the content changes. |
| 153 | * |
| 154 | * @return The unique content URL for the specified row. |
| 155 | */ |
| 156 | static Uri getContentUri(long id, boolean notify) { |
| 157 | return Uri.parse("content://" + LauncherProvider.AUTHORITY + |
| 158 | "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" + |
| 159 | LauncherProvider.PARAMETER_NOTIFY + "=" + notify); |
| 160 | } |
| 161 | |
| 162 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 163 | * The container holding the favorite |
| 164 | * <P>Type: INTEGER</P> |
| 165 | */ |
| 166 | static final String CONTAINER = "container"; |
| 167 | |
| 168 | /** |
| 169 | * The icon is a resource identified by a package name and an integer id. |
| 170 | */ |
| 171 | static final int CONTAINER_DESKTOP = -100; |
Winson Chung | 3d503fb | 2011-07-13 17:25:49 -0700 | [diff] [blame] | 172 | static final int CONTAINER_HOTSEAT = -101; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 173 | |
| 174 | /** |
| 175 | * The screen holding the favorite (if container is CONTAINER_DESKTOP) |
| 176 | * <P>Type: INTEGER</P> |
| 177 | */ |
| 178 | static final String SCREEN = "screen"; |
| 179 | |
| 180 | /** |
| 181 | * The X coordinate of the cell holding the favorite |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 182 | * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT) |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 183 | * <P>Type: INTEGER</P> |
| 184 | */ |
| 185 | static final String CELLX = "cellX"; |
| 186 | |
| 187 | /** |
| 188 | * The Y coordinate of the cell holding the favorite |
| 189 | * (if container is CONTAINER_DESKTOP) |
| 190 | * <P>Type: INTEGER</P> |
| 191 | */ |
| 192 | static final String CELLY = "cellY"; |
| 193 | |
| 194 | /** |
| 195 | * The X span of the cell holding the favorite |
| 196 | * <P>Type: INTEGER</P> |
| 197 | */ |
| 198 | static final String SPANX = "spanX"; |
| 199 | |
| 200 | /** |
| 201 | * The Y span of the cell holding the favorite |
| 202 | * <P>Type: INTEGER</P> |
| 203 | */ |
| 204 | static final String SPANY = "spanY"; |
| 205 | |
| 206 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 207 | * The favorite is a user created folder |
| 208 | */ |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 209 | static final int ITEM_TYPE_FOLDER = 2; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 210 | |
| 211 | /** |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 212 | * The favorite is a live folder |
| 213 | * |
| 214 | * Note: live folders can no longer be added to Launcher, and any live folders which |
| 215 | * exist within the launcher database will be ignored when loading. That said, these |
| 216 | * entries in the database may still exist, and are not automatically stripped. |
| 217 | */ |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 218 | static final int ITEM_TYPE_LIVE_FOLDER = 3; |
| 219 | |
| 220 | /** |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 221 | * The favorite is a widget |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 222 | */ |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 223 | static final int ITEM_TYPE_APPWIDGET = 4; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 224 | |
| 225 | /** |
| 226 | * The favorite is a clock |
| 227 | */ |
| 228 | static final int ITEM_TYPE_WIDGET_CLOCK = 1000; |
| 229 | |
| 230 | /** |
| 231 | * The favorite is a search widget |
| 232 | */ |
| 233 | static final int ITEM_TYPE_WIDGET_SEARCH = 1001; |
| 234 | |
| 235 | /** |
| 236 | * The favorite is a photo frame |
| 237 | */ |
| 238 | static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002; |
| 239 | |
| 240 | /** |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 241 | * The appWidgetId of the widget |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 242 | * |
| 243 | * <P>Type: INTEGER</P> |
| 244 | */ |
The Android Open Source Project | ca9475f | 2009-03-13 13:04:24 -0700 | [diff] [blame] | 245 | static final String APPWIDGET_ID = "appWidgetId"; |
Chris Wren | d5e66bf | 2013-09-16 14:02:29 -0400 | [diff] [blame] | 246 | |
| 247 | /** |
| 248 | * The ComponentName of the widget provider |
| 249 | * |
| 250 | * <P>Type: STRING</P> |
| 251 | */ |
| 252 | public static final String APPWIDGET_PROVIDER = "appWidgetProvider"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 253 | |
| 254 | /** |
| 255 | * Indicates whether this favorite is an application-created shortcut or not. |
| 256 | * If the value is 0, the favorite is not an application-created shortcut, if the |
| 257 | * value is 1, it is an application-created shortcut. |
| 258 | * <P>Type: INTEGER</P> |
| 259 | */ |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 260 | @Deprecated |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 261 | static final String IS_SHORTCUT = "isShortcut"; |
| 262 | |
| 263 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 264 | * The URI associated with the favorite. It is used, for instance, by |
| 265 | * live folders to find the content provider. |
| 266 | * <P>Type: TEXT</P> |
| 267 | */ |
| 268 | static final String URI = "uri"; |
| 269 | |
| 270 | /** |
| 271 | * The display mode if the item is a live folder. |
| 272 | * <P>Type: INTEGER</P> |
| 273 | * |
| 274 | * @see android.provider.LiveFolders#DISPLAY_MODE_GRID |
| 275 | * @see android.provider.LiveFolders#DISPLAY_MODE_LIST |
| 276 | */ |
| 277 | static final String DISPLAY_MODE = "displayMode"; |
Chris Wren | f4d0811 | 2014-01-16 18:13:56 -0500 | [diff] [blame] | 278 | |
| 279 | /** |
| 280 | * Boolean indicating that his item was restored and not yet successfully bound. |
| 281 | * <P>Type: INTEGER</P> |
| 282 | */ |
| 283 | static final String RESTORED = "restored"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 284 | } |
| 285 | } |