diff --git a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java index 8944dfc9d..a4de0421b 100644 --- a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java +++ b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java @@ -1,9 +1,11 @@ package com.yunbao.share.adapters; +import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; +import android.widget.ImageView; import android.widget.RadioButton; import android.widget.TextView; @@ -12,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.pdlive.shayu.R; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.ViewUtils; import com.yunbao.common.views.weight.ClipPathCircleImage; import java.util.ArrayList; @@ -23,18 +26,36 @@ import io.rong.imlib.model.Conversation; public class InternalShareAdapter extends RecyclerView.Adapter { List listData = new ArrayList<>(); int selectPosition = -1; + private int isEmpty = -233; + private Context mContext; + + public InternalShareAdapter(Context mContext) { + this.mContext = mContext; + } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == isEmpty) { + return new EmptyViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_layout_msg, parent, false)); + } return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_internal_user, parent, false)); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + if (getItemViewType(position) == isEmpty) return; holder.bind(listData.get(position), position); } + @Override + public int getItemViewType(int position) { + if (listData.get(position).mCore.getTargetId().equals("isEmpty_-233-pdl-5YK76YC8")) { + return isEmpty; + } + return super.getItemViewType(position); + } + @Override public int getItemCount() { return listData.size(); @@ -44,6 +65,11 @@ public class InternalShareAdapter extends RecyclerView.Adapter(); } + if (listData.isEmpty()) { + Conversation conversation = new Conversation(); + conversation.setTargetId("isEmpty_-233-pdl-5YK76YC8"); + listData.add(new SingleConversation(mContext, conversation)); + } this.listData = listData; notifyDataSetChanged(); @@ -53,6 +79,15 @@ public class InternalShareAdapter extends RecyclerView.Adapter