|
|
/*
|
|
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (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
|
|
|
*
|
|
|
* 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.
|
|
|
*/
|
|
|
|
|
|
/*
|
|
|
* 版权声明,声明这段代码的版权属于MiCode开源社区,网址为www.micode.net
|
|
|
*
|
|
|
* 许可证声明,声明这段代码遵循Apache许可证2.0版本
|
|
|
* 你不能使用这个文件,除非你遵守许可证。
|
|
|
* 你可以在以下网址获取许可证的副本:
|
|
|
*
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
*
|
|
|
* 除非适用法律要求或书面同意,否则根据许可证分发的软件
|
|
|
* 是以原样”为基础分发的,没有任何明示或暗示的保证。
|
|
|
* 请参阅许可证以获取特定的语言管理权限和
|
|
|
* 许可证下的限制。
|
|
|
*/
|
|
|
package net.micode.notes.widget; // 定义包名,表示这个类属于net.micode.notes.widget包
|
|
|
|
|
|
import android.appwidget.AppWidgetManager; // 导入AppWidgetManager类,用于管理App Widget
|
|
|
import android.content.Context; // 导入Context类,提供对应用环境的访问
|
|
|
|
|
|
import net.micode.notes.R; // 导入R类,包含应用的所有资源ID
|
|
|
import net.micode.notes.data.Notes; // 导入Notes类,可能包含笔记相关的数据和方法
|
|
|
import net.micode.notes.tool.ResourceParser; // 导入ResourceParser类,用于解析资源
|
|
|
|
|
|
|
|
|
public class NoteWidgetProvider_4x extends NoteWidgetProvider { // 定义NoteWidgetProvider_4x类,继承自NoteWidgetProvider
|
|
|
@Override
|
|
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // 重写onUpdate方法,用于更新App Widget
|
|
|
super.update(context, appWidgetManager, appWidgetIds); // 调用父类的update方法,进行实际的更新操作
|
|
|
}
|
|
|
|
|
|
protected int getLayoutId() { // 定义getLayoutId方法,用于获取布局资源的ID
|
|
|
return R.layout.widget_4x; // 返回4x尺寸Widget的布局资源ID
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected int getBgResourceId(int bgId) { // 重写getBgResourceId方法,根据传入的背景ID返回对应的背景资源ID
|
|
|
return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId); // 调用ResourceParser的getWidget4xBgResource方法,获取4x尺寸Widget的背景资源ID
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected int getWidgetType() { // 重写getWidgetType方法,返回Widget的类型
|
|
|
return Notes.TYPE_WIDGET_4X; // 返回4x尺寸Widget的类型
|
|
|
}
|
|
|
}
|