|
|
|
@ -16,31 +16,32 @@
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.widget;
|
|
|
|
|
|
|
|
|
|
import android.appwidget.AppWidgetManager;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.appwidget.AppWidgetManager;// 导入AppWidgetManager类,用于管理小部件
|
|
|
|
|
import android.content.Context;// 导入Context类,用于获取应用程序环境信息
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.R;
|
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
|
import net.micode.notes.tool.ResourceParser;
|
|
|
|
|
import net.micode.notes.R;// 导入R类,用于访问应用程序资源
|
|
|
|
|
import net.micode.notes.data.Notes;// 导入Notes类,用于访问笔记数据
|
|
|
|
|
import net.micode.notes.tool.ResourceParser;// 导入ResourceParser类,用于解析资源
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class NoteWidgetProvider_4x extends NoteWidgetProvider {
|
|
|
|
|
public class NoteWidgetProvider_4x extends NoteWidgetProvider {// 声明NoteWidgetProvider_4x类,继承自NoteWidgetProvider,用于4x大小的小部件
|
|
|
|
|
@Override
|
|
|
|
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
|
|
|
|
super.update(context, appWidgetManager, appWidgetIds);
|
|
|
|
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {// 重写onUpdate方法,当小部件需要更新时调用
|
|
|
|
|
super.update(context, appWidgetManager, appWidgetIds);// 调用父类的update方法,更新小部件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected int getLayoutId() {
|
|
|
|
|
return R.layout.widget_4x;
|
|
|
|
|
protected int getLayoutId() {// 定义getLayoutId方法,获取小部件的布局ID
|
|
|
|
|
return R.layout.widget_4x;// 返回4x小部件的布局资源ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getBgResourceId(int bgId) {
|
|
|
|
|
protected int getBgResourceId(int bgId) {// 重写getBgResourceId方法,获取小部件的背景资源ID
|
|
|
|
|
return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getWidgetType() {
|
|
|
|
|
return Notes.TYPE_WIDGET_4X;
|
|
|
|
|
protected int getWidgetType() {// 重写getWidgetType方法,获取小部件类型
|
|
|
|
|
|
|
|
|
|
return Notes.TYPE_WIDGET_4X;// 返回4x小部件类型
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|