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