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尺寸小部件的布局、背景资源和类型标识
*/
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 {
/**
* 小部件更新入口方法
* @param context 上下文环境
* @param appWidgetManager 小部件管理器
* @param appWidgetIds 需要更新小部件的ID数组
*/
@Override
public void onUpdate ( Context context , AppWidgetManager appWidgetManager , int [ ] appWidgetIds ) {
// 调用父类通用更新逻辑,保持功能一致性
super . update ( context , appWidgetManager , appWidgetIds ) ;
}
/**
* 获取2x小部件布局资源ID
* @return 返回R.layout.widget_2x布局资源标识
*/
@Override
protected int getLayoutId ( ) {
// 指定2x尺寸小部件的专属布局文件
return R . layout . widget_2x ;
}
/**
* 获取2x小部件背景资源映射
* @param bgId 背景颜色标识(来自数据库)
* @return 对应的实际背景图片资源ID
*/
@Override
protected int getBgResourceId ( int bgId ) {
// 通过资源解析工具获取2x专属背景资源
return ResourceParser . WidgetBgResources . getWidget2xBgResource ( bgId ) ;
}
/**
* 获取小部件类型标识
* @return 返回2x小部件类型常量TYPE_WIDGET_2X
*/
@Override
protected int getWidgetType ( ) {
// 在数据库和业务逻辑中用于标识2x小部件类型
return Notes . TYPE_WIDGET_2X ;
}
}