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.
WXYMZX1/Desktop/xiaomi1/src/widget/NoteWidgetProvider_4x.java

61 lines
2.8 KiB

This file contains ambiguous Unicode characters!

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.

/*
* 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的类型
}
}