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