blob: 58597f543791d660ef85849d6c7606d51aa78dbd [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
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 Sandler325dc232013-06-05 22:57:57 -040017package com.android.launcher3;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
The Android Open Source Project31dd5032009-03-03 19:32:27 -080019import android.net.Uri;
Adam Cohendf2cc412011-04-27 16:56:57 -070020import android.provider.BaseColumns;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080021
22/**
23 * Settings related utilities.
24 */
Sunny Goyalbb870532015-06-26 09:07:18 -070025public class LauncherSettings {
Chris Wren1ada10d2013-09-13 18:01:38 -040026 /** Columns required on table staht will be subject to backup and restore. */
Sunny Goyalbb870532015-06-26 09:07:18 -070027 public static interface ChangeLogColumns extends BaseColumns {
Chris Wren1ada10d2013-09-13 18:01:38 -040028 /**
29 * The time of the last update to this row.
30 * <P>Type: INTEGER</P>
31 */
Sunny Goyalbb870532015-06-26 09:07:18 -070032 public static final String MODIFIED = "modified";
Chris Wren1ada10d2013-09-13 18:01:38 -040033 }
34
Sunny Goyalbb870532015-06-26 09:07:18 -070035 public static interface BaseLauncherColumns extends ChangeLogColumns {
Romain Guy73b979d2009-06-09 12:57:21 -070036 /**
37 * Descriptive name of the gesture that can be displayed to the user.
38 * <P>Type: TEXT</P>
39 */
Sunny Goyalbb870532015-06-26 09:07:18 -070040 public static final String TITLE = "title";
Romain Guy73b979d2009-06-09 12:57:21 -070041
42 /**
43 * The Intent URL of the gesture, describing what it points to. This
Romain Guy1ce1a242009-06-23 17:34:54 -070044 * value is given to {@link android.content.Intent#parseUri(String, int)} to create
Romain Guy73b979d2009-06-09 12:57:21 -070045 * an Intent that can be launched.
46 * <P>Type: TEXT</P>
47 */
Sunny Goyalbb870532015-06-26 09:07:18 -070048 public static final String INTENT = "intent";
Romain Guy73b979d2009-06-09 12:57:21 -070049
50 /**
51 * The type of the gesture
52 *
53 * <P>Type: INTEGER</P>
54 */
Sunny Goyalbb870532015-06-26 09:07:18 -070055 public static final String ITEM_TYPE = "itemType";
Romain Guy73b979d2009-06-09 12:57:21 -070056
57 /**
58 * The gesture is an application
59 */
Sunny Goyalbb870532015-06-26 09:07:18 -070060 public static final int ITEM_TYPE_APPLICATION = 0;
Romain Guy73b979d2009-06-09 12:57:21 -070061
62 /**
63 * The gesture is an application created shortcut
64 */
Sunny Goyalbb870532015-06-26 09:07:18 -070065 public static final int ITEM_TYPE_SHORTCUT = 1;
Romain Guy73b979d2009-06-09 12:57:21 -070066
67 /**
68 * The icon type.
69 * <P>Type: INTEGER</P>
70 */
Sunny Goyalbb870532015-06-26 09:07:18 -070071 public static final String ICON_TYPE = "iconType";
Romain Guy73b979d2009-06-09 12:57:21 -070072
73 /**
74 * The icon is a resource identified by a package name and an integer id.
75 */
Sunny Goyalbb870532015-06-26 09:07:18 -070076 public static final int ICON_TYPE_RESOURCE = 0;
Romain Guy73b979d2009-06-09 12:57:21 -070077
78 /**
79 * The icon is a bitmap.
80 */
Sunny Goyalbb870532015-06-26 09:07:18 -070081 public static final int ICON_TYPE_BITMAP = 1;
Romain Guy73b979d2009-06-09 12:57:21 -070082
83 /**
84 * The icon package name, if icon type is ICON_TYPE_RESOURCE.
85 * <P>Type: TEXT</P>
86 */
Sunny Goyalbb870532015-06-26 09:07:18 -070087 public static final String ICON_PACKAGE = "iconPackage";
Romain Guy73b979d2009-06-09 12:57:21 -070088
89 /**
90 * The icon resource id, if icon type is ICON_TYPE_RESOURCE.
91 * <P>Type: TEXT</P>
92 */
Sunny Goyalbb870532015-06-26 09:07:18 -070093 public static final String ICON_RESOURCE = "iconResource";
Romain Guy73b979d2009-06-09 12:57:21 -070094
95 /**
96 * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP.
97 * <P>Type: BLOB</P>
98 */
Sunny Goyalbb870532015-06-26 09:07:18 -070099 public static final String ICON = "icon";
Romain Guy73b979d2009-06-09 12:57:21 -0700100 }
101
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800102 /**
Adam Cohendcd297f2013-06-18 13:13:40 -0700103 * Workspace Screens.
104 *
105 * Tracks the order of workspace screens.
106 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700107 public static final class WorkspaceScreens implements ChangeLogColumns {
Adam Cohendcd297f2013-06-18 13:13:40 -0700108 /**
109 * The content:// style URL for this table
110 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700111 public static final Uri CONTENT_URI = Uri.parse("content://" +
Adam Cohendcd297f2013-06-18 13:13:40 -0700112 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 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700119 public static final String SCREEN_RANK = "screenRank";
Adam Cohendcd297f2013-06-18 13:13:40 -0700120 }
121
122 /**
Bjorn Bringert93c45762009-12-16 13:19:47 +0000123 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800124 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700125 public static final class Favorites implements BaseLauncherColumns {
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800126 /**
127 * The content:// style URL for this table
128 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700129 public static final Uri CONTENT_URI = Uri.parse("content://" +
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800130 LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES +
131 "?" + LauncherProvider.PARAMETER_NOTIFY + "=true");
132
133 /**
Adam Cohene25af792013-06-06 23:08:25 -0700134 * The content:// style URL for this table
135 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700136 public static final Uri OLD_CONTENT_URI = Uri.parse("content://" +
Adam Cohene25af792013-06-06 23:08:25 -0700137 LauncherProvider.OLD_AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES +
138 "?" + LauncherProvider.PARAMETER_NOTIFY + "=true");
139
140 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800141 * The content:// style URL for this table. When this Uri is used, no notification is
142 * sent if the content changes.
143 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700144 public static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" +
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800145 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 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700156 public static Uri getContentUri(long id, boolean notify) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800157 return Uri.parse("content://" + LauncherProvider.AUTHORITY +
158 "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" +
159 LauncherProvider.PARAMETER_NOTIFY + "=" + notify);
160 }
161
162 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800163 * The container holding the favorite
164 * <P>Type: INTEGER</P>
165 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700166 public static final String CONTAINER = "container";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800167
168 /**
169 * The icon is a resource identified by a package name and an integer id.
170 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700171 public static final int CONTAINER_DESKTOP = -100;
172 public static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800173
Sunny Goyalbb870532015-06-26 09:07:18 -0700174 public static final String containerToString(int container) {
Dan Sandlerab5fa3a2014-03-06 23:48:04 -0500175 switch (container) {
176 case CONTAINER_DESKTOP: return "desktop";
177 case CONTAINER_HOTSEAT: return "hotseat";
178 default: return String.valueOf(container);
179 }
180 }
181
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800182 /**
183 * The screen holding the favorite (if container is CONTAINER_DESKTOP)
184 * <P>Type: INTEGER</P>
185 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700186 public static final String SCREEN = "screen";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800187
188 /**
189 * The X coordinate of the cell holding the favorite
Adam Cohenc51934b2011-07-26 21:07:43 -0700190 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800191 * <P>Type: INTEGER</P>
192 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700193 public static final String CELLX = "cellX";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800194
195 /**
196 * The Y coordinate of the cell holding the favorite
197 * (if container is CONTAINER_DESKTOP)
198 * <P>Type: INTEGER</P>
199 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700200 public static final String CELLY = "cellY";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800201
202 /**
203 * The X span of the cell holding the favorite
204 * <P>Type: INTEGER</P>
205 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700206 public static final String SPANX = "spanX";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800207
208 /**
209 * The Y span of the cell holding the favorite
210 * <P>Type: INTEGER</P>
211 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700212 public static final String SPANY = "spanY";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800213
214 /**
Kenny Guyed131872014-04-30 03:02:21 +0100215 * The profile id of the item in the cell.
216 * <P>
217 * Type: INTEGER
218 * </P>
219 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700220 public static final String PROFILE_ID = "profileId";
Kenny Guyed131872014-04-30 03:02:21 +0100221
222 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800223 * The favorite is a user created folder
224 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700225 public static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800226
227 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700228 * The favorite is a live folder
229 *
230 * Note: live folders can no longer be added to Launcher, and any live folders which
231 * exist within the launcher database will be ignored when loading. That said, these
232 * entries in the database may still exist, and are not automatically stripped.
233 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700234 public static final int ITEM_TYPE_LIVE_FOLDER = 3;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800235
236 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700237 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800238 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700239 public static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800240
241 /**
Adam Cohen59400422014-03-05 18:07:04 -0800242 * The favorite is a custom widget provided by the launcher
243 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700244 public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5;
Adam Cohen59400422014-03-05 18:07:04 -0800245
246 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800247 * The favorite is a clock
248 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700249 public static final int ITEM_TYPE_WIDGET_CLOCK = 1000;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800250
251 /**
252 * The favorite is a search widget
253 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700254 public static final int ITEM_TYPE_WIDGET_SEARCH = 1001;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800255
256 /**
257 * The favorite is a photo frame
258 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700259 public static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800260
261 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700262 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800263 *
264 * <P>Type: INTEGER</P>
265 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700266 public static final String APPWIDGET_ID = "appWidgetId";
Chris Wrend5e66bf2013-09-16 14:02:29 -0400267
268 /**
269 * The ComponentName of the widget provider
270 *
271 * <P>Type: STRING</P>
272 */
273 public static final String APPWIDGET_PROVIDER = "appWidgetProvider";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800274
275 /**
276 * Indicates whether this favorite is an application-created shortcut or not.
277 * If the value is 0, the favorite is not an application-created shortcut, if the
278 * value is 1, it is an application-created shortcut.
279 * <P>Type: INTEGER</P>
280 */
Romain Guy73b979d2009-06-09 12:57:21 -0700281 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800282 static final String IS_SHORTCUT = "isShortcut";
283
284 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800285 * The URI associated with the favorite. It is used, for instance, by
286 * live folders to find the content provider.
287 * <P>Type: TEXT</P>
288 */
289 static final String URI = "uri";
290
291 /**
292 * The display mode if the item is a live folder.
293 * <P>Type: INTEGER</P>
294 *
295 * @see android.provider.LiveFolders#DISPLAY_MODE_GRID
296 * @see android.provider.LiveFolders#DISPLAY_MODE_LIST
297 */
Sunny Goyal08f72612015-01-05 13:41:43 -0800298 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800299 static final String DISPLAY_MODE = "displayMode";
Chris Wrenf4d08112014-01-16 18:13:56 -0500300
301 /**
302 * Boolean indicating that his item was restored and not yet successfully bound.
303 * <P>Type: INTEGER</P>
304 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700305 public static final String RESTORED = "restored";
Sunny Goyal08f72612015-01-05 13:41:43 -0800306
307 /**
308 * Indicates the position of the item inside an auto-arranged view like folder or hotseat.
309 * <p>Type: INTEGER</p>
310 */
Sunny Goyalbb870532015-06-26 09:07:18 -0700311 public static final String RANK = "rank";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800312 }
313}