blob: 90e60e450e8371125acf0914f51b4694a292a9e7 [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
Sunny Goyal18b640c2015-04-17 09:24:01 -070022import com.android.launcher3.config.ProviderConfig;
23
The Android Open Source Project31dd5032009-03-03 19:32:27 -080024/**
25 * Settings related utilities.
26 */
Hyunyoung Song3f471442015-04-08 19:01:34 -070027public class LauncherSettings {
Chris Wren1ada10d2013-09-13 18:01:38 -040028 /** 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 Guy73b979d2009-06-09 12:57:21 -070038 /**
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 Guy1ce1a242009-06-23 17:34:54 -070046 * value is given to {@link android.content.Intent#parseUri(String, int)} to create
Romain Guy73b979d2009-06-09 12:57:21 -070047 * an Intent that can be launched.
48 * <P>Type: TEXT</P>
49 */
Sunny Goyal18b640c2015-04-17 09:24:01 -070050 public static final String INTENT = "intent";
Romain Guy73b979d2009-06-09 12:57:21 -070051
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 Project31dd5032009-03-03 19:32:27 -0800104 /**
Adam Cohendcd297f2013-06-18 13:13:40 -0700105 * Workspace Screens.
106 *
107 * Tracks the order of workspace screens.
108 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700109 public static final class WorkspaceScreens implements ChangeLogColumns {
110
111 public static final String TABLE_NAME = "workspaceScreens";
112
Adam Cohendcd297f2013-06-18 13:13:40 -0700113 /**
114 * The content:// style URL for this table
115 */
116 static final Uri CONTENT_URI = Uri.parse("content://" +
Sunny Goyal18b640c2015-04-17 09:24:01 -0700117 ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
Adam Cohendcd297f2013-06-18 13:13:40 -0700118
119 /**
120 * The rank of this screen -- ie. how it is ordered relative to the other screens.
121 * <P>Type: INTEGER</P>
122 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700123 public static final String SCREEN_RANK = "screenRank";
Adam Cohendcd297f2013-06-18 13:13:40 -0700124 }
125
126 /**
Bjorn Bringert93c45762009-12-16 13:19:47 +0000127 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800128 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700129 public static final class Favorites implements BaseLauncherColumns {
Sunny Goyal18b640c2015-04-17 09:24:01 -0700130
131 public static final String TABLE_NAME = "favorites";
132
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800133 /**
134 * The content:// style URL for this table
135 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700136 public static final Uri CONTENT_URI = Uri.parse("content://" +
137 ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800138
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 Project31dd5032009-03-03 19:32:27 -0800143 *
144 * @return The unique content URL for the specified row.
145 */
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700146 static Uri getContentUri(long id) {
Sunny Goyal18b640c2015-04-17 09:24:01 -0700147 return Uri.parse("content://" + ProviderConfig.AUTHORITY +
148 "/" + TABLE_NAME + "/" + id);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800149 }
150
151 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800152 * The container holding the favorite
153 * <P>Type: INTEGER</P>
154 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700155 public static final String CONTAINER = "container";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800156
157 /**
158 * The icon is a resource identified by a package name and an integer id.
159 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700160 public static final int CONTAINER_DESKTOP = -100;
161 public static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800162
Dan Sandlerab5fa3a2014-03-06 23:48:04 -0500163 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 Project31dd5032009-03-03 19:32:27 -0800171 /**
172 * The screen holding the favorite (if container is CONTAINER_DESKTOP)
173 * <P>Type: INTEGER</P>
174 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700175 public static final String SCREEN = "screen";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800176
177 /**
178 * The X coordinate of the cell holding the favorite
Adam Cohenc51934b2011-07-26 21:07:43 -0700179 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800180 * <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 Guyed131872014-04-30 03:02:21 +0100204 * 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 Project31dd5032009-03-03 19:32:27 -0800212 * The favorite is a user created folder
213 */
Adam Cohendf2cc412011-04-27 16:56:57 -0700214 static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800215
216 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700217 * 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 Project31dd5032009-03-03 19:32:27 -0800223 static final int ITEM_TYPE_LIVE_FOLDER = 3;
224
225 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700226 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800227 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700228 public static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800229
230 /**
Adam Cohen59400422014-03-05 18:07:04 -0800231 * The favorite is a custom widget provided by the launcher
232 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700233 public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5;
Adam Cohen59400422014-03-05 18:07:04 -0800234
235 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800236 * 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 Project7376fae2009-03-11 12:11:58 -0700251 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800252 *
253 * <P>Type: INTEGER</P>
254 */
The Android Open Source Projectca9475f2009-03-13 13:04:24 -0700255 static final String APPWIDGET_ID = "appWidgetId";
Chris Wrend5e66bf2013-09-16 14:02:29 -0400256
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 Project31dd5032009-03-03 19:32:27 -0800263
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 Guy73b979d2009-06-09 12:57:21 -0700270 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800271 static final String IS_SHORTCUT = "isShortcut";
272
273 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800274 * 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 Goyal08f72612015-01-05 13:41:43 -0800287 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800288 static final String DISPLAY_MODE = "displayMode";
Chris Wrenf4d08112014-01-16 18:13:56 -0500289
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 Goyal08f72612015-01-05 13:41:43 -0800295
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 Goyal5d85c442015-03-10 13:14:47 -0700301
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 Project31dd5032009-03-03 19:32:27 -0800307 }
308}