blob: 988e5efca99a795bad33ad4851eb1c45cd2e74c0 [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 */
25class LauncherSettings {
Chris Wren1ada10d2013-09-13 18:01:38 -040026 /** 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 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 */
40 static final String TITLE = "title";
41
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 */
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 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 */
Chris Wren1ada10d2013-09-13 18:01:38 -0400107 static final class WorkspaceScreens implements ChangeLogColumns {
Adam Cohendcd297f2013-06-18 13:13:40 -0700108 /**
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 Bringert93c45762009-12-16 13:19:47 +0000123 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800124 */
Romain Guy73b979d2009-06-09 12:57:21 -0700125 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 */
129 static final Uri CONTENT_URI = Uri.parse("content://" +
130 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 */
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 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 */
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 Project31dd5032009-03-03 19:32:27 -0800163 * 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 Chung3d503fb2011-07-13 17:25:49 -0700172 static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800173
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 Cohenc51934b2011-07-26 21:07:43 -0700182 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800183 * <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 Project31dd5032009-03-03 19:32:27 -0800207 * The favorite is a user created folder
208 */
Adam Cohendf2cc412011-04-27 16:56:57 -0700209 static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800210
211 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700212 * 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 Project31dd5032009-03-03 19:32:27 -0800218 static final int ITEM_TYPE_LIVE_FOLDER = 3;
219
220 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700221 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800222 */
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700223 static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800224
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 Project7376fae2009-03-11 12:11:58 -0700241 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800242 *
243 * <P>Type: INTEGER</P>
244 */
The Android Open Source Projectca9475f2009-03-13 13:04:24 -0700245 static final String APPWIDGET_ID = "appWidgetId";
Chris Wrend5e66bf2013-09-16 14:02:29 -0400246
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 Project31dd5032009-03-03 19:32:27 -0800253
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 Guy73b979d2009-06-09 12:57:21 -0700260 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800261 static final String IS_SHORTCUT = "isShortcut";
262
263 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800264 * 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";
278 }
279}