blob: 8499ebb7c0fbdf1bed4563e489d5392bf2f6e7a5 [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
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
Joe Onoratoa5902522009-07-30 13:37:37 -070017package com.android.launcher2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
The Android Open Source Project7376fae2009-03-11 12:11:58 -070019import android.appwidget.AppWidgetHostView;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080020import android.content.ContentValues;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080021
22/**
The Android Open Source Project7376fae2009-03-11 12:11:58 -070023 * Represents a widget, which just contains an identifier.
The Android Open Source Project31dd5032009-03-03 19:32:27 -080024 */
The Android Open Source Project7376fae2009-03-11 12:11:58 -070025class LauncherAppWidgetInfo extends ItemInfo {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080026
27 /**
Romain Guy629de3e2010-01-13 12:20:59 -080028 * Identifier for this widget when talking with
29 * {@link android.appwidget.AppWidgetManager} for updates.
The Android Open Source Project31dd5032009-03-03 19:32:27 -080030 */
The Android Open Source Project7376fae2009-03-11 12:11:58 -070031 int appWidgetId;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080032
33 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -070034 * View that holds this widget after it's been created. This view isn't created
The Android Open Source Project31dd5032009-03-03 19:32:27 -080035 * until Launcher knows it's needed.
36 */
The Android Open Source Project7376fae2009-03-11 12:11:58 -070037 AppWidgetHostView hostView = null;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080038
The Android Open Source Project7376fae2009-03-11 12:11:58 -070039 LauncherAppWidgetInfo(int appWidgetId) {
40 itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
41 this.appWidgetId = appWidgetId;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080042 }
43
44 @Override
45 void onAddToDatabase(ContentValues values) {
46 super.onAddToDatabase(values);
The Android Open Source Project7376fae2009-03-11 12:11:58 -070047 values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
The Android Open Source Project31dd5032009-03-03 19:32:27 -080048 }
49
50 @Override
51 public String toString() {
Daniel Sandler8802e962010-05-26 16:28:16 -040052 return "AppWidget(id=" + Integer.toString(appWidgetId) + ")";
The Android Open Source Project31dd5032009-03-03 19:32:27 -080053 }
Joe Onorato9c1289c2009-08-17 11:03:03 -040054
55
56 @Override
57 void unbind() {
58 super.unbind();
59 hostView = null;
60 }
The Android Open Source Project31dd5032009-03-03 19:32:27 -080061}