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 19 import android.appwidget.AppWidgetProviderInfo; 20 import android.content.ComponentName; 21 import android.os.Parcelable; 22 23 /** 24 * We pass this object with a drag from the customization tray 25 */ 26 class PendingAddItemInfo extends ItemInfo { 27 /** 28 * The component that will be created. 29 */ 30 ComponentName componentName; 31 } 32 33 class PendingAddWidgetInfo extends PendingAddItemInfo { 34 int minWidth; 35 int minHeight; 36 boolean hasDefaultPreview; 37 38 // Any configuration data that we want to pass to a configuration activity when 39 // starting up a widget 40 String mimeType; 41 Parcelable configurationData; 42 PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data)43 public PendingAddWidgetInfo(AppWidgetProviderInfo i, String dataMimeType, Parcelable data) { 44 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; 45 componentName = i.provider; 46 minWidth = i.minWidth; 47 minHeight = i.minHeight; 48 hasDefaultPreview = i.previewImage <= 0; 49 if (dataMimeType != null && data != null) { 50 mimeType = dataMimeType; 51 configurationData = data; 52 } 53 } 54 }