Michael Jurka | 0280c3b | 2010-09-17 15:00:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | |
| 17 | package com.android.launcher2; |
| 18 | |
Adam Cohen | ed66b2b | 2012-01-23 17:28:51 -0800 | [diff] [blame] | 19 | import android.appwidget.AppWidgetHostView; |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 20 | import android.appwidget.AppWidgetProviderInfo; |
Michael Jurka | 0280c3b | 2010-09-17 15:00:07 -0700 | [diff] [blame] | 21 | import android.content.ComponentName; |
Winson Chung | 55cef26 | 2010-10-28 14:14:18 -0700 | [diff] [blame] | 22 | import android.os.Parcelable; |
Michael Jurka | 0280c3b | 2010-09-17 15:00:07 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * We pass this object with a drag from the customization tray |
| 26 | */ |
| 27 | class PendingAddItemInfo extends ItemInfo { |
| 28 | /** |
| 29 | * The component that will be created. |
| 30 | */ |
| 31 | ComponentName componentName; |
Michael Jurka | 3e7c763 | 2010-10-02 16:01:03 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | class PendingAddWidgetInfo extends PendingAddItemInfo { |
| 35 | int minWidth; |
| 36 | int minHeight; |
Michael Jurka | 038f9d8 | 2011-11-03 13:50:45 -0700 | [diff] [blame] | 37 | int previewImage; |
| 38 | int icon; |
Adam Cohen | ed66b2b | 2012-01-23 17:28:51 -0800 | [diff] [blame] | 39 | AppWidgetProviderInfo info; |
| 40 | AppWidgetHostView boundWidget; |
Winson Chung | 55cef26 | 2010-10-28 14:14:18 -0700 | [diff] [blame] | 41 | |
| 42 | // Any configuration data that we want to pass to a configuration activity when |
| 43 | // starting up a widget |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 44 | String mimeType; |
Winson Chung | 55cef26 | 2010-10-28 14:14:18 -0700 | [diff] [blame] | 45 | Parcelable configurationData; |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 46 | |
Michael Jurka | c9d95c5 | 2011-08-29 14:03:34 -0700 | [diff] [blame] | 47 | public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) { |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 48 | itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; |
Adam Cohen | ed66b2b | 2012-01-23 17:28:51 -0800 | [diff] [blame] | 49 | this.info = i; |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 50 | componentName = i.provider; |
| 51 | minWidth = i.minWidth; |
| 52 | minHeight = i.minHeight; |
Michael Jurka | 038f9d8 | 2011-11-03 13:50:45 -0700 | [diff] [blame] | 53 | previewImage = i.previewImage; |
| 54 | icon = i.icon; |
Winson Chung | 68846fd | 2010-10-29 11:00:27 -0700 | [diff] [blame] | 55 | if (dataMimeType != null && data != null) { |
| 56 | mimeType = dataMimeType; |
| 57 | configurationData = data; |
| 58 | } |
| 59 | } |
Adam Cohen | 1b36dc3 | 2012-02-13 19:27:37 -0800 | [diff] [blame^] | 60 | |
| 61 | // Copy constructor |
| 62 | public PendingAddWidgetInfo(PendingAddWidgetInfo copy) { |
| 63 | minWidth = copy.minWidth; |
| 64 | minHeight = copy.minHeight; |
| 65 | previewImage = copy.previewImage; |
| 66 | icon = copy.icon; |
| 67 | info = copy.info; |
| 68 | boundWidget = copy.boundWidget; |
| 69 | mimeType = copy.mimeType; |
| 70 | configurationData = copy.configurationData; |
| 71 | componentName = copy.componentName; |
| 72 | itemType = copy.itemType; |
| 73 | } |
| 74 | } |