LauncherAppWidgetInfo.java revision fca7c88f9dba895d9f6cf52c6f0e656445063e3e
1/* 2 * Copyright (C) 2009 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.launcher; 18 19import android.appwidget.AppWidgetHostView; 20import android.content.ContentValues; 21 22/** 23 * Represents a widget, which just contains an identifier. 24 */ 25class LauncherAppWidgetInfo extends ItemInfo { 26 27 /** 28 * Identifier for this widget when talking with {@link AppWidgetManager} for updates. 29 */ 30 int appWidgetId; 31 32 /** 33 * View that holds this widget after it's been created. This view isn't created 34 * until Launcher knows it's needed. 35 */ 36 AppWidgetHostView hostView = null; 37 38 LauncherAppWidgetInfo(int appWidgetId) { 39 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; 40 this.appWidgetId = appWidgetId; 41 } 42 43 @Override 44 void onAddToDatabase(ContentValues values) { 45 super.onAddToDatabase(values); 46 values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); 47 } 48 49 @Override 50 public String toString() { 51 return Integer.toString(appWidgetId); 52 } 53} 54