blob: 26e946efadb993d24e5d5ef723e89cf08bfe8249 [file] [log] [blame]
Michael Jurka0280c3b2010-09-17 15:00:07 -07001/*
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
17package com.android.launcher2;
18
Adam Cohened66b2b2012-01-23 17:28:51 -080019import android.appwidget.AppWidgetHostView;
Winson Chung68846fd2010-10-29 11:00:27 -070020import android.appwidget.AppWidgetProviderInfo;
Michael Jurka0280c3b2010-09-17 15:00:07 -070021import android.content.ComponentName;
Winson Chung55cef262010-10-28 14:14:18 -070022import android.os.Parcelable;
Michael Jurka0280c3b2010-09-17 15:00:07 -070023
24/**
25 * We pass this object with a drag from the customization tray
26 */
27class PendingAddItemInfo extends ItemInfo {
28 /**
29 * The component that will be created.
30 */
31 ComponentName componentName;
Michael Jurka3e7c7632010-10-02 16:01:03 -070032}
33
34class PendingAddWidgetInfo extends PendingAddItemInfo {
35 int minWidth;
36 int minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080037 int minResizeWidth;
38 int minResizeHeight;
Michael Jurka038f9d82011-11-03 13:50:45 -070039 int previewImage;
40 int icon;
Adam Cohened66b2b2012-01-23 17:28:51 -080041 AppWidgetProviderInfo info;
42 AppWidgetHostView boundWidget;
Winson Chung55cef262010-10-28 14:14:18 -070043
44 // Any configuration data that we want to pass to a configuration activity when
45 // starting up a widget
Winson Chung68846fd2010-10-29 11:00:27 -070046 String mimeType;
Winson Chung55cef262010-10-28 14:14:18 -070047 Parcelable configurationData;
Winson Chung68846fd2010-10-29 11:00:27 -070048
Michael Jurkac9d95c52011-08-29 14:03:34 -070049 public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) {
Winson Chung68846fd2010-10-29 11:00:27 -070050 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
Adam Cohened66b2b2012-01-23 17:28:51 -080051 this.info = i;
Winson Chung68846fd2010-10-29 11:00:27 -070052 componentName = i.provider;
53 minWidth = i.minWidth;
54 minHeight = i.minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080055 minResizeWidth = i.minResizeWidth;
56 minResizeHeight = i.minResizeHeight;
Michael Jurka038f9d82011-11-03 13:50:45 -070057 previewImage = i.previewImage;
58 icon = i.icon;
Winson Chung68846fd2010-10-29 11:00:27 -070059 if (dataMimeType != null && data != null) {
60 mimeType = dataMimeType;
61 configurationData = data;
62 }
63 }
Adam Cohen1b36dc32012-02-13 19:27:37 -080064
65 // Copy constructor
66 public PendingAddWidgetInfo(PendingAddWidgetInfo copy) {
67 minWidth = copy.minWidth;
68 minHeight = copy.minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080069 minResizeWidth = copy.minResizeWidth;
70 minResizeHeight = copy.minResizeHeight;
Adam Cohen1b36dc32012-02-13 19:27:37 -080071 previewImage = copy.previewImage;
72 icon = copy.icon;
73 info = copy.info;
74 boundWidget = copy.boundWidget;
75 mimeType = copy.mimeType;
76 configurationData = copy.configurationData;
77 componentName = copy.componentName;
78 itemType = copy.itemType;
Adam Cohen1f362702012-04-04 14:58:12 -070079 spanX = copy.spanX;
80 spanY = copy.spanY;
81 minSpanX = copy.minSpanX;
82 minSpanY = copy.minSpanY;
Adam Cohen1b36dc32012-02-13 19:27:37 -080083 }
84}