/* * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) */ // 版权所有 (c) 2010-2011,MiCode开源社区(www.micode.net) /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 */ // 根据Apache License, 版本2.0(“许可证”)授权; // 除非遵守许可证,否则不得使用此文件。 // 您可以在以下网址获得许可证的副本: // // http://www.apache.org/licenses/LICENSE-2.0 /* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // 除非适用法律要求或书面同意,否则按“原样”分发的软件是在没有任何明示或暗示的保证或条件的情况下分发的。 // 请参阅控制权限和限制的许可证具体条款。 package net.micode.notes.widget; // 声明该类属于net.micode.notes.widget包。 import android.appwidget.AppWidgetManager; // 导入AppWidgetManager类 import android.content.Context; // 导入Context类 import net.micode.notes.R; // 导入项目资源类 import net.micode.notes.data.Notes; // 导入Notes数据类 import net.micode.notes.tool.ResourceParser; // 导入ResourceParser工具类 public class NoteWidgetProvider_2x extends NoteWidgetProvider { // 定义一个名为NoteWidgetProvider_2x的公共类,继承自NoteWidgetProvider @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // 重写onUpdate方法,接收Context对象、AppWidgetManager对象和appWidgetIds数组作为参数 super.update(context, appWidgetManager, appWidgetIds); // 调用父类的update方法 } @Override protected int getLayoutId() { // 重写getLayoutId方法,返回布局资源ID return R.layout.widget_2x; // 返回2x布局资源ID } @Override protected int getBgResourceId(int bgId) { // 重写getBgResourceId方法,接收一个整数bgId作为参数,返回背景资源ID return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId); // 根据bgId返回2x小部件的背景资源ID } @Override protected int getWidgetType() { // 重写getWidgetType方法,返回小部件类型 return Notes.TYPE_WIDGET_2X; // 返回2x小部件类型 } } // 结束NoteWidgetProvider_2x类的定义