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.
xiaomi/src/net/micode/notes/widget/NoteWidgetProvider_2x.java

65 lines
2.7 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)
*/
// 版权所有 (c) 2010-2011MiCode开源社区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
*/
// 根据Apache License, 版本2.0(“许可证”)授权;
// 除非遵守许可证,否则不得使用此文件。
// 您可以在以下网址获得许可证的副本:
//
// 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.
*/
// 除非适用法律要求或书面同意,否则按“原样”分发的软件是在没有任何明示或暗示的保证或条件的情况下分发的。
// 请参阅控制权限和限制的许可证具体条款。
package net.micode.notes.widget;
// 声明该类属于net.micode.notes.widget包。
import android.appwidget.AppWidgetManager;
// 导入AppWidgetManager类
import android.content.Context;
// 导入Context类
import net.micode.notes.R;
// 导入项目资源类
import net.micode.notes.data.Notes;
// 导入Notes数据类
import net.micode.notes.tool.ResourceParser;
// 导入ResourceParser工具类
public class NoteWidgetProvider_2x extends NoteWidgetProvider {
// 定义一个名为NoteWidgetProvider_2x的公共类继承自NoteWidgetProvider
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// 重写onUpdate方法接收Context对象、AppWidgetManager对象和appWidgetIds数组作为参数
super.update(context, appWidgetManager, appWidgetIds);
// 调用父类的update方法
}
@Override
protected int getLayoutId() {
// 重写getLayoutId方法返回布局资源ID
return R.layout.widget_2x;
// 返回2x布局资源ID
}
@Override
protected int getBgResourceId(int bgId) {
// 重写getBgResourceId方法接收一个整数bgId作为参数返回背景资源ID
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
// 根据bgId返回2x小部件的背景资源ID
}
@Override
protected int getWidgetType() {
// 重写getWidgetType方法返回小部件类型
return Notes.TYPE_WIDGET_2X;
// 返回2x小部件类型
}
}
// 结束NoteWidgetProvider_2x类的定义