// Path: app/src/main/java/com/itheima/mobilesafe/ui/recycler_view/OnItemTouch.java
// public interface OnItemTouch {
// 
//     void onItemMove(int fromPosition, int toPosition);
// 
//     void onItemDismiss(int position);
// }
// 
// Path: app/src/main/java/com/itheima/mobilesafe/utils/objects/BlockedCaller.java
// public class BlockedCaller implements BaseContact {
//     private String name;
//     private String number;
// 
//     public int getMODE() {
//         return MODE;
//     }
// 
//     public void setMODE(int MODE) {
//         this.MODE = MODE;
//     }
// 
//     private int MODE;
// 
//     @Override
//     public String toString() {
//         return "BlockedCaller{" +
//                 "name='" + name + '\'' +
//                 ", number='" + number + '\'' +
//                 ", MODE=" + MODE +
//                 '}';
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String getNumber() {
//         return number;
//     }
// 
//     @Override
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public void setNumber(String number) {
//         this.number = number;
//     }
// }


import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.itheima.mobilesafe.R;
import com.itheima.mobilesafe.ui.recycler_view.OnItemTouch;
import com.itheima.mobilesafe.utils.objects.BlockedCaller;
import java.util.Collections;
import java.util.List;

        void onItemLongClick(View view, int position);

        void onItemSwap(int fromPosition, int toPosition);

        void onItemDismiss(int position, BlockedCaller item);

    }

    private OnItemClickLitener mOnItemClickLitener;

    public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) {
        this.mOnItemClickLitener = mOnItemClickLitener;
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, final int position) {
        holder.tv_name.setText(mDatas.get(position).getName());
        holder.tv_phone.setText(mDatas.get(position).getNumber());

        // 如果设置了回调，则设置点击事件
        if (mOnItemClickLitener != null) {
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int pos = holder.getLayoutPosition();
                    mOnItemClickLitener.onItemClick(holder.itemView, pos);
                }
            });

// Path: app/src/main/java/com/itheima/mobilesafe/ui/recycler_view/OnItemTouch.java
// public interface OnItemTouch {
// 
//     void onItemMove(int fromPosition, int toPosition);
// 
//     void onItemDismiss(int position);
// }
// 
// Path: app/src/main/java/com/itheima/mobilesafe/utils/objects/BlockedCaller.java
// public class BlockedCaller implements BaseContact {
//     private String name;
//     private String number;
// 
//     public int getMODE() {
//         return MODE;
//     }
// 
//     public void setMODE(int MODE) {
//         this.MODE = MODE;
//     }
// 
//     private int MODE;
// 
//     @Override
//     public String toString() {
//         return "BlockedCaller{" +
//                 "name='" + name + '\'' +
//                 ", number='" + number + '\'' +
//                 ", MODE=" + MODE +
//                 '}';
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String getNumber() {
//         return number;
//     }
// 
//     @Override
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public void setNumber(String number) {
//         this.number = number;
//     }
// }


// Path: app/src/main/java/com/itheima/mobilesafe/adapter/BlacklistAdapter.java
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.itheima.mobilesafe.R;
import com.itheima.mobilesafe.ui.recycler_view.OnItemTouch;
import com.itheima.mobilesafe.utils.objects.BlockedCaller;
import java.util.Collections;
import java.util.List;


        void onItemLongClick(View view, int position);

        void onItemSwap(int fromPosition, int toPosition);

        void onItemDismiss(int position, BlockedCaller item);

    }

    private OnItemClickLitener mOnItemClickLitener;

    public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) {
        this.mOnItemClickLitener = mOnItemClickLitener;
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, final int position) {
        holder.tv_name.setText(mDatas.get(position).getName());
        holder.tv_phone.setText(mDatas.get(position).getNumber());

        // 如果设置了回调，则设置点击事件
        if (mOnItemClickLitener != null) {
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int pos = holder.getLayoutPosition();
                    mOnItemClickLitener.onItemClick(holder.itemView, pos);
                }
            });

            holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {