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

import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;

import net.micode.notes.R;

/**
 * 笔记ViewHolder
 * <p>
 * RecyclerView的ViewHolder实现，持有笔记列表项的所有视图引用。
 * 避免重复findViewById，提升列表滚动性能。
 * </p>
 */
public class NoteViewHolder extends RecyclerView.ViewHolder {
    public ImageView mAlert;
    public TextView mTitle;
    public TextView mTime;
    public TextView mCallName;
    public CheckBox mCheckBox;
    
    /**
     * 构造函数
     * @param itemView 列表项的根视图
     */
    public NoteViewHolder(View itemView) {
        super(itemView);
        // 查找所有子视图（只执行一次）
        mAlert = (ImageView) itemView.findViewById(R.id.iv_alert_icon);
        mTitle = (TextView) itemView.findViewById(R.id.tv_title);
        mTime = (TextView) itemView.findViewById(R.id.tv_time);
        mCallName = (TextView) itemView.findViewById(R.id.tv_name);
        mCheckBox = (CheckBox) itemView.findViewById(android.R.id.checkbox);
    }
}
