You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
//主要功能包括:
//指定2x小部件使用布局
//提供2x小部件专用的背景资源
//标识小部件类型为2x尺寸
//处理小部件更新逻辑
package net.micode.notes.widget ;
import android.appwidget.AppWidgetManager ;
import android.content.Context ;
import net.micode.notes.R ;
import net.micode.notes.data.Notes ;
import net.micode.notes.tool.ResourceParser ;
public class NoteWidgetProvider_2x extends NoteWidgetProvider { //继承自NotewidgetProvider, 专门处理2x尺寸的小部件
@Override
public void onUpdate ( Context context , AppWidgetManager appWidgetManager , int [ ] appWidgetIds ) {
super . update ( context , appWidgetManager , appWidgetIds ) ;
} //这是APP widget 的核心方法, 当小部件需要更新时调用, 直接调用父类的update方法更新逻辑
@Override
protected int getLayoutId ( ) {
return R . layout . widget_2x ;
} //返回2x尺寸小部件使用布局资源ID( R.layout.widget_2x)
@Override
protected int getBgResourceId ( int bgId ) {
return ResourceParser . WidgetBgResources . getWidget2xBgResource ( bgId ) ;
} //根据背景ID返回对应的2X尺寸资源
@Override
protected int getWidgetType ( ) {
return Notes . TYPE_WIDGET_2X ;
} //用于标识这个2x尺寸的小部件
}