|
|
|
@ -14,34 +14,34 @@
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.widget;
|
|
|
|
|
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_2x extends NoteWidgetProvider {
|
|
|
|
|
public class NoteWidgetProvider_2x extends NoteWidgetProvider {// 声明NoteWidgetProvider_2x类,继承自NoteWidgetProvider
|
|
|
|
|
@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方法,更新小部件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getLayoutId() {
|
|
|
|
|
return R.layout.widget_2x;
|
|
|
|
|
protected int getLayoutId() {// 重写getLayoutId方法,获取布局ID
|
|
|
|
|
return R.layout.widget_2x;// 返回widget_2x布局的资源ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getBgResourceId(int bgId) {
|
|
|
|
|
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
|
|
|
|
|
protected int getBgResourceId(int bgId) {// 重写getBgResourceId方法,获取背景资源ID
|
|
|
|
|
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);// 返回2x小部件背景资源ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getWidgetType() {
|
|
|
|
|
return Notes.TYPE_WIDGET_2X;
|
|
|
|
|
return Notes.TYPE_WIDGET_2X;// 返回2x小部件类型
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|