From 25fbf11fbc61f920d4fa6e7b2ad7f1f5c17d13b0 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 26 Mar 2024 18:28:18 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E5=88=86=E4=BA=AB=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=97=B6=E5=80=99=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=9B=BE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/adapters/InternalShareAdapter.java | 35 +++++++++++++++++++ .../share/ui/AppInternalShareDialog.java | 3 +- 2 files changed, 37 insertions(+), 1 deletion(-) 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