blob: eb395c8bfa72ca5f4d2659c5aaf94d779edbc3d4 [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 {
Romain Guy73b979d2009-06-09 12:57:21 -070026 static interface BaseLauncherColumns extends BaseColumns {
27 /**
28 * Descriptive name of the gesture that can be displayed to the user.
29 * <P>Type: TEXT</P>
30 */
31 static final String TITLE = "title";
32
33 /**
34 * The Intent URL of the gesture, describing what it points to. This
Romain Guy1ce1a242009-06-23 17:34:54 -070035 * value is given to {@link android.content.Intent#parseUri(String, int)} to create
Romain Guy73b979d2009-06-09 12:57:21 -070036 * an Intent that can be launched.
37 * <P>Type: TEXT</P>
38 */
39 static final String INTENT = "intent";
40
41 /**
42 * The type of the gesture
43 *
44 * <P>Type: INTEGER</P>
45 */
46 static final String ITEM_TYPE = "itemType";
47
48 /**
49 * The gesture is an application
50 */
51 static final int ITEM_TYPE_APPLICATION = 0;
52
53 /**
54 * The gesture is an application created shortcut
55 */
56 static final int ITEM_TYPE_SHORTCUT = 1;
57
58 /**
59 * The icon type.
60 * <P>Type: INTEGER</P>
61 */
62 static final String ICON_TYPE = "iconType";
63
64 /**
65 * The icon is a resource identified by a package name and an integer id.
66 */
67 static final int ICON_TYPE_RESOURCE = 0;
68
69 /**
70 * The icon is a bitmap.
71 */
72 static final int ICON_TYPE_BITMAP = 1;
73
74 /**
75 * The icon package name, if icon type is ICON_TYPE_RESOURCE.
76 * <P>Type: TEXT</P>
77 */
78 static final String ICON_PACKAGE = "iconPackage";
79
80 /**
81 * The icon resource id, if icon type is ICON_TYPE_RESOURCE.
82 * <P>Type: TEXT</P>
83 */
84 static final String ICON_RESOURCE = "iconResource";
85
86 /**
87 * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP.
88 * <P>Type: BLOB</P>
89 */
90 static final String ICON = "icon";
91 }
92
The Android Open Source Project31dd5032009-03-03 19:32:27 -080093 /**
Bjorn Bringert93c45762009-12-16 13:19:47 +000094 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -080095 */
Romain Guy73b979d2009-06-09 12:57:21 -070096 static final class Favorites implements BaseLauncherColumns {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080097 /**
98 * The content:// style URL for this table
99 */
100 static final Uri CONTENT_URI = Uri.parse("content://" +
101 LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES +
102 "?" + LauncherProvider.PARAMETER_NOTIFY + "=true");
103
104 /**
Adam Cohene25af792013-06-06 23:08:25 -0700105 * The content:// style URL for this table
106 */
107 static final Uri OLD_CONTENT_URI = Uri.parse("content://" +
108 LauncherProvider.OLD_AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES +
109 "?" + LauncherProvider.PARAMETER_NOTIFY + "=true");
110
111 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800112 * The content:// style URL for this table. When this Uri is used, no notification is
113 * sent if the content changes.
114 */
115 static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" +
116 LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES +
117 "?" + LauncherProvider.PARAMETER_NOTIFY + "=false");
118
119 /**
120 * The content:// style URL for a given row, identified by its id.
121 *
122 * @param id The row id.
123 * @param notify True to send a notification is the content changes.
124 *
125 * @return The unique content URL for the specified row.
126 */
127 static Uri getContentUri(long id, boolean notify) {
128 return Uri.parse("content://" + LauncherProvider.AUTHORITY +
129 "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" +
130 LauncherProvider.PARAMETER_NOTIFY + "=" + notify);
131 }
132
133 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800134 * The container holding the favorite
135 * <P>Type: INTEGER</P>
136 */
137 static final String CONTAINER = "container";
138
139 /**
140 * The icon is a resource identified by a package name and an integer id.
141 */
142 static final int CONTAINER_DESKTOP = -100;
Winson Chung3d503fb2011-07-13 17:25:49 -0700143 static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800144
145 /**
146 * The screen holding the favorite (if container is CONTAINER_DESKTOP)
147 * <P>Type: INTEGER</P>
148 */
149 static final String SCREEN = "screen";
150
151 /**
152 * The X coordinate of the cell holding the favorite
Adam Cohenc51934b2011-07-26 21:07:43 -0700153 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800154 * <P>Type: INTEGER</P>
155 */
156 static final String CELLX = "cellX";
157
158 /**
159 * The Y coordinate of the cell holding the favorite
160 * (if container is CONTAINER_DESKTOP)
161 * <P>Type: INTEGER</P>
162 */
163 static final String CELLY = "cellY";
164
165 /**
166 * The X span of the cell holding the favorite
167 * <P>Type: INTEGER</P>
168 */
169 static final String SPANX = "spanX";
170
171 /**
172 * The Y span of the cell holding the favorite
173 * <P>Type: INTEGER</P>
174 */
175 static final String SPANY = "spanY";
176
177 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800178 * The favorite is a user created folder
179 */
Adam Cohendf2cc412011-04-27 16:56:57 -0700180 static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800181
182 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700183 * The favorite is a live folder
184 *
185 * Note: live folders can no longer be added to Launcher, and any live folders which
186 * exist within the launcher database will be ignored when loading. That said, these
187 * entries in the database may still exist, and are not automatically stripped.
188 */
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800189 static final int ITEM_TYPE_LIVE_FOLDER = 3;
190
191 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700192 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800193 */
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700194 static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800195
196 /**
197 * The favorite is a clock
198 */
199 static final int ITEM_TYPE_WIDGET_CLOCK = 1000;
200
201 /**
202 * The favorite is a search widget
203 */
204 static final int ITEM_TYPE_WIDGET_SEARCH = 1001;
205
206 /**
207 * The favorite is a photo frame
208 */
209 static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002;
210
211 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700212 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800213 *
214 * <P>Type: INTEGER</P>
215 */
The Android Open Source Projectca9475f2009-03-13 13:04:24 -0700216 static final String APPWIDGET_ID = "appWidgetId";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800217
218 /**
219 * Indicates whether this favorite is an application-created shortcut or not.
220 * If the value is 0, the favorite is not an application-created shortcut, if the
221 * value is 1, it is an application-created shortcut.
222 * <P>Type: INTEGER</P>
223 */
Romain Guy73b979d2009-06-09 12:57:21 -0700224 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800225 static final String IS_SHORTCUT = "isShortcut";
226
227 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800228 * The URI associated with the favorite. It is used, for instance, by
229 * live folders to find the content provider.
230 * <P>Type: TEXT</P>
231 */
232 static final String URI = "uri";
233
234 /**
235 * The display mode if the item is a live folder.
236 * <P>Type: INTEGER</P>
237 *
238 * @see android.provider.LiveFolders#DISPLAY_MODE_GRID
239 * @see android.provider.LiveFolders#DISPLAY_MODE_LIST
240 */
241 static final String DISPLAY_MODE = "displayMode";
242 }
243}