blob: 2432cc365f3b0f59cdc13f8c95ca26cdc30e14f9 [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
17package com.android.launcher;
18
19import android.content.ContentValues;
20import android.content.Intent;
21import android.graphics.drawable.Drawable;
22import android.net.Uri;
23
24class LiveFolderInfo extends FolderInfo {
25
26 /**
27 * The base intent, if it exists.
28 */
29 Intent baseIntent;
30
31 /**
32 * The live folder's content uri.
33 */
34 Uri uri;
35
36 /**
37 * The live folder's display type.
38 */
39 int displayMode;
40
41 /**
42 * The live folder icon.
43 */
44 Drawable icon;
45
46 /**
47 * When set to true, indicates that the icon has been resized.
48 */
49 boolean filtered;
50
51 /**
52 * Reference to the live folder icon as an application's resource.
53 */
54 Intent.ShortcutIconResource iconResource;
55
56 LiveFolderInfo() {
57 itemType = LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER;
58 }
59
60 @Override
61 void onAddToDatabase(ContentValues values) {
62 super.onAddToDatabase(values);
63 values.put(LauncherSettings.Favorites.TITLE, title.toString());
64 values.put(LauncherSettings.Favorites.URI, uri.toString());
65 if (baseIntent != null) {
66 values.put(LauncherSettings.Favorites.INTENT, baseIntent.toURI());
67 }
68 values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE);
69 values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode);
70 if (iconResource != null) {
71 values.put(LauncherSettings.Favorites.ICON_PACKAGE, iconResource.packageName);
72 values.put(LauncherSettings.Favorites.ICON_RESOURCE, iconResource.resourceName);
73 }
74 }
75}