blob: 09a8a9ebc63bef788d1c69c1e97011fc213c2ee4 [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;
Michael Jurka038f9d82011-11-03 13:50:45 -070037 int previewImage;
38 int icon;
Adam Cohened66b2b2012-01-23 17:28:51 -080039 AppWidgetProviderInfo info;
40 AppWidgetHostView boundWidget;
Winson Chung55cef262010-10-28 14:14:18 -070041
42 // Any configuration data that we want to pass to a configuration activity when
43 // starting up a widget
Winson Chung68846fd2010-10-29 11:00:27 -070044 String mimeType;
Winson Chung55cef262010-10-28 14:14:18 -070045 Parcelable configurationData;
Winson Chung68846fd2010-10-29 11:00:27 -070046
Michael Jurkac9d95c52011-08-29 14:03:34 -070047 public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) {
Winson Chung68846fd2010-10-29 11:00:27 -070048 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
Adam Cohened66b2b2012-01-23 17:28:51 -080049 this.info = i;
Winson Chung68846fd2010-10-29 11:00:27 -070050 componentName = i.provider;
51 minWidth = i.minWidth;
52 minHeight = i.minHeight;
Michael Jurka038f9d82011-11-03 13:50:45 -070053 previewImage = i.previewImage;
54 icon = i.icon;
Winson Chung68846fd2010-10-29 11:00:27 -070055 if (dataMimeType != null && data != null) {
56 mimeType = dataMimeType;
57 configurationData = data;
58 }
59 }
Adam Cohen1b36dc32012-02-13 19:27:37 -080060
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}