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