/*
 * 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; //使用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类，定义了2*2大小的窗口，并对部分函数进行重载
    @Override 
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { //更新窗口
        super.update(context, appWidgetManager, appWidgetIds);
    }
                                                                        //获取挂件信息
    @Override //返回2x2型小米便签挂件
    protected int getLayoutId() { //获取外部资源id
        return R.layout.widget_2x; //获取窗口布局信息
    }

    @Override
    protected int getBgResourceId(int bgId) { //获取背景id
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId); //返回了小米便签2x2型挂件的背景类型ID，即确定了2x2型的背景
    }

    @Override
    protected int getWidgetType() { //确定窗口类型
        return Notes.TYPE_WIDGET_2X; // 宽度为2x
    }
}
