// Path: app/src/main/java/top/soyask/calendarii/entity/Birthday.java
// public class Birthday implements Serializable {
// 
//     private int id;
//     private String who;
//     private String when;
//     private boolean isLunar;
// 
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public String getWho() {
//         return who;
//     }
// 
//     public void setWho(String who) {
//         this.who = who;
//     }
// 
//     public String getWhen() {
//         return when;
//     }
// 
//     public void setWhen(String when) {
//         this.when = when;
//     }
// 
//     public boolean isLunar() {
//         return isLunar;
//     }
// 
//     public void setLunar(boolean lunar) {
//         isLunar = lunar;
//     }
// 
//     @Override
//     public String toString() {
//         return "Birthday{" +
//                 "id=" + id +
//                 ", who='" + who + '\'' +
//                 ", when='" + when + '\'' +
//                 ", isLunar=" + isLunar +
//                 '}';
//     }
// }


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import top.soyask.calendarii.R;
import top.soyask.calendarii.entity.Birthday;

    @Override
    public void onBindViewHolder(BirthdayViewHolder holder, final int position) {
        holder.itemView.setOnClickListener(null);
        holder.itemView.setOnLongClickListener(null);
        holder.itemView.setAlpha(1f);
        if (position == mBirthdays.size()) {
            holder.tv_who.setText("新增生日");
            holder.tv_when.setText("+");
            holder.itemView.setOnClickListener(v -> mOnBirthdayClickListener.addBirthday());
            holder.itemView.setAlpha(0.2f);
        } else {
            final Birthday birthday = mBirthdays.get(position);
            holder.tv_when.setText(birthday.getWhen());
            holder.tv_who.setText(birthday.getWho() + "的生日");
            holder.itemView.setOnLongClickListener(v -> {
                mOnBirthdayClickListener.onBirthdayLongClick(position, birthday);
                return true;
            });
        }
    }

    @Override
    public int getItemCount() {
        return mBirthdays.size() + 1;
    }

    public interface OnBirthdayClickListener {
        void onBirthdayClick();

// Path: app/src/main/java/top/soyask/calendarii/entity/Birthday.java
// public class Birthday implements Serializable {
// 
//     private int id;
//     private String who;
//     private String when;
//     private boolean isLunar;
// 
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public String getWho() {
//         return who;
//     }
// 
//     public void setWho(String who) {
//         this.who = who;
//     }
// 
//     public String getWhen() {
//         return when;
//     }
// 
//     public void setWhen(String when) {
//         this.when = when;
//     }
// 
//     public boolean isLunar() {
//         return isLunar;
//     }
// 
//     public void setLunar(boolean lunar) {
//         isLunar = lunar;
//     }
// 
//     @Override
//     public String toString() {
//         return "Birthday{" +
//                 "id=" + id +
//                 ", who='" + who + '\'' +
//                 ", when='" + when + '\'' +
//                 ", isLunar=" + isLunar +
//                 '}';
//     }
// }


// Path: app/src/main/java/top/soyask/calendarii/ui/adapter/birth/BirthdayAdapter.java
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import top.soyask.calendarii.R;
import top.soyask.calendarii.entity.Birthday;


    @Override
    public void onBindViewHolder(BirthdayViewHolder holder, final int position) {
        holder.itemView.setOnClickListener(null);
        holder.itemView.setOnLongClickListener(null);
        holder.itemView.setAlpha(1f);
        if (position == mBirthdays.size()) {
            holder.tv_who.setText("新增生日");
            holder.tv_when.setText("+");
            holder.itemView.setOnClickListener(v -> mOnBirthdayClickListener.addBirthday());
            holder.itemView.setAlpha(0.2f);
        } else {
            final Birthday birthday = mBirthdays.get(position);
            holder.tv_when.setText(birthday.getWhen());
            holder.tv_who.setText(birthday.getWho() + "的生日");
            holder.itemView.setOnLongClickListener(v -> {
                mOnBirthdayClickListener.onBirthdayLongClick(position, birthday);
                return true;
            });
        }
    }

    @Override
    public int getItemCount() {
        return mBirthdays.size() + 1;
    }

    public interface OnBirthdayClickListener {
        void onBirthdayClick();

        void onBirthdayLongClick(int position, Birthday birthday);