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


/**
 * 2x尺寸笔记桌面小部件提供者
 * 负责创建和更新2x尺寸的笔记小部件
 */
public class NoteWidgetProvider_2x extends NoteWidgetProvider {
    @Override
    /**
     * 处理小部件更新事件
     * 调用父类的更新方法完成小部件内容的刷新
     */
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        // 委托给父类实现通用的小部件更新逻辑
        super.update(context, appWidgetManager, appWidgetIds);
    }

    @Override
    /**
     * 获取小部件布局资源ID
     * @return 2x尺寸小部件的布局资源ID
     */
    protected int getLayoutId() {
        // 返回适合2x尺寸的小部件布局
        return R.layout.widget_2x;
    }

    @Override
    /**
     * 获取背景资源ID
     * @param bgId 背景颜色ID
     * @return 对应的2x尺寸小部件背景资源ID
     */
    protected int getBgResourceId(int bgId) {
        // 根据背景颜色ID获取对应的2x尺寸小部件背景资源
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
    }

    @Override
    /**
     * 获取小部件类型
     * @return 小部件类型常量（2x尺寸）
     */
    protected int getWidgetType() {
        // 返回表示2x尺寸小部件的类型常量
        return Notes.TYPE_WIDGET_2X;
    }
}
