blob: 111de409e97dbb4a52e669d44f1d4bb7b37ef454 [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 */
Hyunyoung Song3f471442015-04-08 19:01:34 -070025public class 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://" +
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700112 LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_WORKSPACE_SCREENS);
Adam Cohendcd297f2013-06-18 13:13:40 -0700113
114 /**
115 * The rank of this screen -- ie. how it is ordered relative to the other screens.
116 * <P>Type: INTEGER</P>
117 */
118 static final String SCREEN_RANK = "screenRank";
119 }
120
121 /**
Bjorn Bringert93c45762009-12-16 13:19:47 +0000122 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800123 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700124 public static final class Favorites implements BaseLauncherColumns {
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800125 /**
126 * The content:// style URL for this table
127 */
128 static final Uri CONTENT_URI = Uri.parse("content://" +
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700129 LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800130
131 /**
132 * The content:// style URL for a given row, identified by its id.
133 *
134 * @param id The row id.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800135 *
136 * @return The unique content URL for the specified row.
137 */
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700138 static Uri getContentUri(long id) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800139 return Uri.parse("content://" + LauncherProvider.AUTHORITY +
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700140 "/" + LauncherProvider.TABLE_FAVORITES + "/" + id);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800141 }
142
143 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800144 * The container holding the favorite
145 * <P>Type: INTEGER</P>
146 */
147 static final String CONTAINER = "container";
148
149 /**
150 * The icon is a resource identified by a package name and an integer id.
151 */
152 static final int CONTAINER_DESKTOP = -100;
Winson Chung3d503fb2011-07-13 17:25:49 -0700153 static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800154
Dan Sandlerab5fa3a2014-03-06 23:48:04 -0500155 static final String containerToString(int container) {
156 switch (container) {
157 case CONTAINER_DESKTOP: return "desktop";
158 case CONTAINER_HOTSEAT: return "hotseat";
159 default: return String.valueOf(container);
160 }
161 }
162
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800163 /**
164 * The screen holding the favorite (if container is CONTAINER_DESKTOP)
165 * <P>Type: INTEGER</P>
166 */
167 static final String SCREEN = "screen";
168
169 /**
170 * The X coordinate of the cell holding the favorite
Adam Cohenc51934b2011-07-26 21:07:43 -0700171 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800172 * <P>Type: INTEGER</P>
173 */
174 static final String CELLX = "cellX";
175
176 /**
177 * The Y coordinate of the cell holding the favorite
178 * (if container is CONTAINER_DESKTOP)
179 * <P>Type: INTEGER</P>
180 */
181 static final String CELLY = "cellY";
182
183 /**
184 * The X span of the cell holding the favorite
185 * <P>Type: INTEGER</P>
186 */
187 static final String SPANX = "spanX";
188
189 /**
190 * The Y span of the cell holding the favorite
191 * <P>Type: INTEGER</P>
192 */
193 static final String SPANY = "spanY";
194
195 /**
Kenny Guyed131872014-04-30 03:02:21 +0100196 * The profile id of the item in the cell.
197 * <P>
198 * Type: INTEGER
199 * </P>
200 */
201 static final String PROFILE_ID = "profileId";
202
203 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800204 * The favorite is a user created folder
205 */
Adam Cohendf2cc412011-04-27 16:56:57 -0700206 static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800207
208 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700209 * The favorite is a live folder
210 *
211 * Note: live folders can no longer be added to Launcher, and any live folders which
212 * exist within the launcher database will be ignored when loading. That said, these
213 * entries in the database may still exist, and are not automatically stripped.
214 */
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800215 static final int ITEM_TYPE_LIVE_FOLDER = 3;
216
217 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700218 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800219 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700220 public static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800221
222 /**
Adam Cohen59400422014-03-05 18:07:04 -0800223 * The favorite is a custom widget provided by the launcher
224 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700225 public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5;
Adam Cohen59400422014-03-05 18:07:04 -0800226
227 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800228 * The favorite is a clock
229 */
230 static final int ITEM_TYPE_WIDGET_CLOCK = 1000;
231
232 /**
233 * The favorite is a search widget
234 */
235 static final int ITEM_TYPE_WIDGET_SEARCH = 1001;
236
237 /**
238 * The favorite is a photo frame
239 */
240 static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002;
241
242 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700243 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800244 *
245 * <P>Type: INTEGER</P>
246 */
The Android Open Source Projectca9475f2009-03-13 13:04:24 -0700247 static final String APPWIDGET_ID = "appWidgetId";
Chris Wrend5e66bf2013-09-16 14:02:29 -0400248
249 /**
250 * The ComponentName of the widget provider
251 *
252 * <P>Type: STRING</P>
253 */
254 public static final String APPWIDGET_PROVIDER = "appWidgetProvider";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800255
256 /**
257 * Indicates whether this favorite is an application-created shortcut or not.
258 * If the value is 0, the favorite is not an application-created shortcut, if the
259 * value is 1, it is an application-created shortcut.
260 * <P>Type: INTEGER</P>
261 */
Romain Guy73b979d2009-06-09 12:57:21 -0700262 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800263 static final String IS_SHORTCUT = "isShortcut";
264
265 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800266 * The URI associated with the favorite. It is used, for instance, by
267 * live folders to find the content provider.
268 * <P>Type: TEXT</P>
269 */
270 static final String URI = "uri";
271
272 /**
273 * The display mode if the item is a live folder.
274 * <P>Type: INTEGER</P>
275 *
276 * @see android.provider.LiveFolders#DISPLAY_MODE_GRID
277 * @see android.provider.LiveFolders#DISPLAY_MODE_LIST
278 */
Sunny Goyal08f72612015-01-05 13:41:43 -0800279 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800280 static final String DISPLAY_MODE = "displayMode";
Chris Wrenf4d08112014-01-16 18:13:56 -0500281
282 /**
283 * Boolean indicating that his item was restored and not yet successfully bound.
284 * <P>Type: INTEGER</P>
285 */
286 static final String RESTORED = "restored";
Sunny Goyal08f72612015-01-05 13:41:43 -0800287
288 /**
289 * Indicates the position of the item inside an auto-arranged view like folder or hotseat.
290 * <p>Type: INTEGER</p>
291 */
292 static final String RANK = "rank";
Sunny Goyal5d85c442015-03-10 13:14:47 -0700293
294 /**
295 * Stores general flag based options for {@link ItemInfo}s.
296 * <p>Type: INTEGER</p>
297 */
298 static final String OPTIONS = "options";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800299 }
300}