blob: eaa2e4ddbd8719b72598e77135e67f114591bb86 [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;
Michael Jurkadac85912012-05-18 15:04:49 -070022import android.content.pm.ActivityInfo;
Winson Chung55cef262010-10-28 14:14:18 -070023import android.os.Parcelable;
Michael Jurka0280c3b2010-09-17 15:00:07 -070024
25/**
26 * We pass this object with a drag from the customization tray
27 */
28class PendingAddItemInfo extends ItemInfo {
29 /**
30 * The component that will be created.
31 */
32 ComponentName componentName;
Michael Jurka3e7c7632010-10-02 16:01:03 -070033}
34
Michael Jurkadac85912012-05-18 15:04:49 -070035class PendingAddShortcutInfo extends PendingAddItemInfo {
36
37 ActivityInfo shortcutActivityInfo;
38
39 public PendingAddShortcutInfo(ActivityInfo activityInfo) {
40 shortcutActivityInfo = activityInfo;
41 }
42}
43
Michael Jurka3e7c7632010-10-02 16:01:03 -070044class PendingAddWidgetInfo extends PendingAddItemInfo {
45 int minWidth;
46 int minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080047 int minResizeWidth;
48 int minResizeHeight;
Michael Jurka038f9d82011-11-03 13:50:45 -070049 int previewImage;
50 int icon;
Adam Cohened66b2b2012-01-23 17:28:51 -080051 AppWidgetProviderInfo info;
52 AppWidgetHostView boundWidget;
Winson Chung55cef262010-10-28 14:14:18 -070053
54 // Any configuration data that we want to pass to a configuration activity when
55 // starting up a widget
Winson Chung68846fd2010-10-29 11:00:27 -070056 String mimeType;
Winson Chung55cef262010-10-28 14:14:18 -070057 Parcelable configurationData;
Winson Chung68846fd2010-10-29 11:00:27 -070058
Michael Jurkac9d95c52011-08-29 14:03:34 -070059 public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) {
Winson Chung68846fd2010-10-29 11:00:27 -070060 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
Adam Cohened66b2b2012-01-23 17:28:51 -080061 this.info = i;
Winson Chung68846fd2010-10-29 11:00:27 -070062 componentName = i.provider;
63 minWidth = i.minWidth;
64 minHeight = i.minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080065 minResizeWidth = i.minResizeWidth;
66 minResizeHeight = i.minResizeHeight;
Michael Jurka038f9d82011-11-03 13:50:45 -070067 previewImage = i.previewImage;
68 icon = i.icon;
Winson Chung68846fd2010-10-29 11:00:27 -070069 if (dataMimeType != null && data != null) {
70 mimeType = dataMimeType;
71 configurationData = data;
72 }
73 }
Adam Cohen1b36dc32012-02-13 19:27:37 -080074
75 // Copy constructor
76 public PendingAddWidgetInfo(PendingAddWidgetInfo copy) {
77 minWidth = copy.minWidth;
78 minHeight = copy.minHeight;
Adam Cohend41fbf52012-02-16 23:53:59 -080079 minResizeWidth = copy.minResizeWidth;
80 minResizeHeight = copy.minResizeHeight;
Adam Cohen1b36dc32012-02-13 19:27:37 -080081 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 Cohen1f362702012-04-04 14:58:12 -070089 spanX = copy.spanX;
90 spanY = copy.spanY;
91 minSpanX = copy.minSpanX;
92 minSpanY = copy.minSpanY;
Adam Cohen1b36dc32012-02-13 19:27:37 -080093 }
94}