1 /* 2 * Copyright (C) 2015 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 package com.android.launcher3.widget; 17 18 import android.appwidget.AppWidgetHostView; 19 import android.os.Bundle; 20 21 import com.android.launcher3.LauncherAppWidgetProviderInfo; 22 import com.android.launcher3.LauncherSettings; 23 import com.android.launcher3.PendingAddItemInfo; 24 25 /** 26 * Meta data used for late binding of {@link LauncherAppWidgetProviderInfo}. 27 * 28 * @see {@link PendingAddItemInfo} 29 */ 30 public class PendingAddWidgetInfo extends PendingAddItemInfo { 31 public int previewImage; 32 public int icon; 33 public LauncherAppWidgetProviderInfo info; 34 public AppWidgetHostView boundWidget; 35 public Bundle bindOptions = null; 36 PendingAddWidgetInfo(LauncherAppWidgetProviderInfo i)37 public PendingAddWidgetInfo(LauncherAppWidgetProviderInfo i) { 38 if (i.isCustomWidget) { 39 itemType = LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET; 40 } else { 41 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; 42 } 43 this.info = i; 44 user = i.getUser(); 45 componentName = i.provider; 46 previewImage = i.previewImage; 47 icon = i.icon; 48 49 spanX = i.spanX; 50 spanY = i.spanY; 51 minSpanX = i.minSpanX; 52 minSpanY = i.minSpanY; 53 } 54 getHandler()55 public WidgetAddFlowHandler getHandler() { 56 return new WidgetAddFlowHandler(info); 57 } 58 } 59