The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 1 | /* |
| 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 Onorato | a590252 | 2009-07-30 13:37:37 -0700 | [diff] [blame] | 17 | package com.android.launcher2; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 18 | |
| 19 | import android.content.ContentValues; |
| 20 | import android.content.Intent; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 21 | import android.graphics.Bitmap; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 22 | import android.net.Uri; |
| 23 | |
| 24 | class 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 | */ |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 44 | Bitmap icon; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Reference to the live folder icon as an application's resource. |
| 48 | */ |
| 49 | Intent.ShortcutIconResource iconResource; |
| 50 | |
| 51 | LiveFolderInfo() { |
| 52 | itemType = LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | void onAddToDatabase(ContentValues values) { |
| 57 | super.onAddToDatabase(values); |
| 58 | values.put(LauncherSettings.Favorites.TITLE, title.toString()); |
| 59 | values.put(LauncherSettings.Favorites.URI, uri.toString()); |
| 60 | if (baseIntent != null) { |
Romain Guy | 1ce1a24 | 2009-06-23 17:34:54 -0700 | [diff] [blame] | 61 | values.put(LauncherSettings.Favorites.INTENT, baseIntent.toUri(0)); |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 62 | } |
| 63 | values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE); |
| 64 | values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode); |
| 65 | if (iconResource != null) { |
| 66 | values.put(LauncherSettings.Favorites.ICON_PACKAGE, iconResource.packageName); |
| 67 | values.put(LauncherSettings.Favorites.ICON_RESOURCE, iconResource.resourceName); |
| 68 | } |
| 69 | } |
| 70 | } |