/*
 * 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 {
    @Override
    //小组件需要更新时被调用。它调用父类的update方法，并传入相应的参数。
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.update(context, appWidgetManager, appWidgetIds);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.widget_2x;
    }

    @Override
    //根据给定的背景ID返回相应的背景资源ID。这里调用了ResourceParser类的静态方法getWidget2xBgResource来获取2x小组件的背景资源ID。
    protected int getBgResourceId(int bgId) {
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
    }

    @Override
    //返回小组件的类型
    protected int getWidgetType() {
        return Notes.TYPE_WIDGET_2X;
    }
}
