blob: 7d0a0f58feceed3ca2d6a46117046bc05cb2625d [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
Joe Onoratoa5902522009-07-30 13:37:37 -070017package com.android.launcher2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
19import android.content.ContentValues;
20import android.content.Intent;
21import android.graphics.drawable.Drawable;
Joe Onorato0589f0f2010-02-08 13:44:00 -080022import android.graphics.Bitmap;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080023import android.net.Uri;
24
25class LiveFolderInfo extends FolderInfo {
26
27 /**
28 * The base intent, if it exists.
29 */
30 Intent baseIntent;
31
32 /**
33 * The live folder's content uri.
34 */
35 Uri uri;
36
37 /**
38 * The live folder's display type.
39 */
40 int displayMode;
41
42 /**
43 * The live folder icon.
44 */
Joe Onorato0589f0f2010-02-08 13:44:00 -080045 Bitmap icon;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080046
47 /**
48 * Reference to the live folder icon as an application's resource.
49 */
50 Intent.ShortcutIconResource iconResource;
51
52 LiveFolderInfo() {
53 itemType = LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER;
54 }
55
56 @Override
57 void onAddToDatabase(ContentValues values) {
58 super.onAddToDatabase(values);
59 values.put(LauncherSettings.Favorites.TITLE, title.toString());
60 values.put(LauncherSettings.Favorites.URI, uri.toString());
61 if (baseIntent != null) {
Romain Guy1ce1a242009-06-23 17:34:54 -070062 values.put(LauncherSettings.Favorites.INTENT, baseIntent.toUri(0));
The Android Open Source Project31dd5032009-03-03 19:32:27 -080063 }
64 values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE);
65 values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode);
66 if (iconResource != null) {
67 values.put(LauncherSettings.Favorites.ICON_PACKAGE, iconResource.packageName);
68 values.put(LauncherSettings.Favorites.ICON_RESOURCE, iconResource.resourceName);
69 }
70 }
71}