/*
 * 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.
 */

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 的子类 NoteWidgetProvider_2x
    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.update(context, appWidgetManager, appWidgetIds);
    }/*重写父类的 onUpdate() 方法，并在其中调用父类的 update() 方法，以更新小部件的显示内容和点击事件。*/

    @Override
    protected int getLayoutId() {
        return R.layout.widget_2x;
    }/*重写父类的 getLayoutId() 方法，返回用于小部件的布局资源 ID。这里返回 R.layout.widget_2x，表示使用 widget_2x.xml 文件作为布局资源。*/

    @Override
    protected int getBgResourceId(int bgId) {
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
    }/*重写父类的 getBgResourceId() 方法，返回用于小部件的背景资源 ID。这里调用了 ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId) 方法，该方法根据传入的背景 ID 返回相应的背景资源 ID。*/

    @Override
    protected int getWidgetType() {
        return Notes.TYPE_WIDGET_2X;
    }/*重写父类的 getWidgetType() 方法，返回小部件的类型。这里返回 Notes.TYPE_WIDGET_2X，表示这是一个 2x 大小的小部件。*/
}
