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


// 这是一个名为NoteWidgetProvider_2x的类，它继承自NoteWidgetProvider类
public class NoteWidgetProvider_2x extends NoteWidgetProvider {

    // 重写父类的onUpdate方法，用于更新小部件
    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        // 调用父类的update方法来进行实际的更新操作，传递上下文、小部件管理器和小部件ID数组
        super.update(context, appWidgetManager, appWidgetIds);
    }

    // 重写父类的getLayoutId方法，用于获取小部件的布局ID
    @Override
    protected int getLayoutId() {
        // 返回widget_2x布局资源的ID
        return R.layout.widget_2x;
    }

    // 重写父类的getBgResourceId方法，用于根据背景ID获取对应的资源ID
    @Override
    protected int getBgResourceId(int bgId) {
        // 使用ResourceParser.WidgetBgResources的getWidget2xBgResource方法，根据传入的背景ID获取对应的2x小部件背景资源ID
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
    }

    // 重写父类的getWidgetType方法，用于获取小部件的类型
    @Override
    protected int getWidgetType() {
        // 返回表示2x类型小部件的常量值
        return Notes.TYPE_WIDGET_2X;
    }
}