OSDN Git Service

auto import from //depot/cupcake/@135843
[android-x86/packages-apps-Launcher.git] / src / com / android / launcher / LauncherGadgetInfo.java
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
17 package com.android.launcher;
18
19 import android.content.ContentValues;
20 import android.gadget.GadgetHostView;
21
22 /**
23  * Represents a gadget, which just contains an identifier.
24  */
25 class LauncherGadgetInfo extends ItemInfo {
26
27     /**
28      * Identifier for this gadget when talking with {@link GadgetManager} for updates.
29      */
30     int gadgetId;
31     
32     /**
33      * View that holds this gadget after it's been created.  This view isn't created
34      * until Launcher knows it's needed.
35      */
36     GadgetHostView hostView = null;
37
38     LauncherGadgetInfo(int gadgetId) {
39         itemType = LauncherSettings.Favorites.ITEM_TYPE_GADGET;
40         this.gadgetId = gadgetId;
41     }
42     
43     @Override
44     void onAddToDatabase(ContentValues values) {
45         super.onAddToDatabase(values);
46         values.put(LauncherSettings.Favorites.GADGET_ID, gadgetId);
47     }
48
49     @Override
50     public String toString() {
51         return Integer.toString(gadgetId);
52     }
53 }