测试修改
This commit is contained in:
parent
8aefa10ef8
commit
0a6471163c
@ -68,9 +68,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
mList = new ArrayList<>();
|
mList = new ArrayList<>();
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
model = IMLoginManager.get(context).getUserInfo();
|
model = IMLoginManager.get(context).getUserInfo();
|
||||||
mOnClickListener = new View.OnClickListener() {
|
mOnClickListener = v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Object tag = v.getTag();
|
Object tag = v.getTag();
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
LiveChatBean bean = (LiveChatBean) tag;
|
LiveChatBean bean = (LiveChatBean) tag;
|
||||||
@ -80,7 +78,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,23 +192,16 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
rv_chat_active.setLayoutManager(gridLayoutManager);
|
rv_chat_active.setLayoutManager(gridLayoutManager);
|
||||||
rv_chat_active.setAdapter(listAdapter);
|
rv_chat_active.setAdapter(listAdapter);
|
||||||
|
|
||||||
tv_chat_active_into.setOnClickListener(new View.OnClickListener() {//点击打开活动
|
//点击打开活动
|
||||||
@Override
|
tv_chat_active_into.setOnClickListener(v -> {
|
||||||
public void onClick(View v) {
|
|
||||||
String url = CommonAppConfig.HOST + "/" + bean.getContent() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + LiveRoomViewHolder.mLiveUid;
|
String url = CommonAppConfig.HOST + "/" + bean.getContent() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + LiveRoomViewHolder.mLiveUid;
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("url", url);
|
bundle.putString("url", url);
|
||||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||||
}
|
|
||||||
});
|
|
||||||
v_chat_active_close.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
removetItem(bean);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
v_chat_active_close.setOnClickListener(v -> removetItem(bean));
|
||||||
} else if (bean.getType() == -3 || bean.getType() == -4 || bean.getType() == -5) {//整蛊
|
} else if (bean.getType() == -3 || bean.getType() == -4 || bean.getType() == -5) {//整蛊
|
||||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||||
//加载.9图聊天气泡
|
//加载.9图聊天气泡
|
||||||
@ -359,41 +349,31 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertItem(LiveChatBean bean) {
|
public synchronized void insertItem(LiveChatBean bean) {
|
||||||
|
|
||||||
if (bean == null) {
|
if (bean == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int size = mList.size();
|
int size = mList.size();
|
||||||
if (size > 0) {
|
|
||||||
if (mList.get(size - 1).getType() == -10) {
|
|
||||||
mList.remove(size - 1);
|
|
||||||
size = size - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//设置最大展示99条消息
|
//设置最大展示99条消息
|
||||||
if (size == 100) {
|
if (size == 100) {
|
||||||
mList.remove(1);
|
mList.remove(0);
|
||||||
}
|
}
|
||||||
mList.add(bean);
|
mList.add(bean);
|
||||||
notifyItemChanged(size);
|
|
||||||
|
|
||||||
LiveChatBean beanNull = new LiveChatBean();
|
|
||||||
beanNull.setType(-10);
|
|
||||||
mList.add(beanNull);
|
|
||||||
notifyItemChanged(size + 1);
|
|
||||||
|
|
||||||
if (isSlideToBottom(mRecyclerView)) {
|
if (isSlideToBottom(mRecyclerView)) {
|
||||||
mRecyclerView.scrollToPosition(size + 1);
|
mRecyclerView.scrollToPosition(getItemCount() - 1);
|
||||||
} else {
|
} else {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
|
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
|
||||||
|
|
||||||
if (bean.getAtUserID()!=null&&bean.getAtUserID().contains(String.valueOf(model.getId()))) {
|
if (bean.getAtUserID() != null && bean.getAtUserID().contains(String.valueOf(model.getId()))) {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE));
|
.setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE));
|
||||||
mPosition = size + 1;
|
mPosition = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
notifyItemChanged(getItemCount() - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,10 +402,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
public void scrollToBottom() {
|
public void scrollToBottom() {
|
||||||
if (mList.size() > 0) {
|
if (mList.size() > 0) {
|
||||||
mRecyclerView.smoothScrollToPosition(getItemCount());
|
mRecyclerView.smoothScrollToPosition(getItemCount() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void scrollToAt(){
|
|
||||||
|
public void scrollToAt() {
|
||||||
if (mList.size() > 0) {
|
if (mList.size() > 0) {
|
||||||
mRecyclerView.smoothScrollToPosition(mPosition);
|
mRecyclerView.smoothScrollToPosition(mPosition);
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
mChatRecyclerView.setLayoutParams(params1);
|
mChatRecyclerView.setLayoutParams(params1);
|
||||||
|
|
||||||
mChatRecyclerView.setHasFixedSize(true);
|
mChatRecyclerView.setHasFixedSize(true);
|
||||||
mChatRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
mChatRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
mChatRecyclerView.addItemDecoration(new TopGradual());
|
mChatRecyclerView.addItemDecoration(new TopGradual());
|
||||||
mLiveChatAdapter = new LiveChatAdapter(mContext);
|
mLiveChatAdapter = new LiveChatAdapter(mContext);
|
||||||
mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener<LiveChatBean>() {
|
mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener<LiveChatBean>() {
|
||||||
|
@ -6,22 +6,32 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
|
import com.opensource.svgaplayer.SVGAParser;
|
||||||
|
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||||
import com.yunbao.common.bean.OlineUserlistModel;
|
import com.yunbao.common.bean.OlineUserlistModel;
|
||||||
import com.yunbao.common.event.OlineEvent;
|
import com.yunbao.common.event.OlineEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.utils.SVGAViewUtils;
|
||||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
public class OlineListItemViewHolder extends RecyclerView.ViewHolder {
|
public class OlineListItemViewHolder extends RecyclerView.ViewHolder {
|
||||||
private TextView userName;
|
private TextView userName;
|
||||||
private ClipPathCircleImage avatar;
|
private ClipPathCircleImage avatar;
|
||||||
|
private SVGAImageView avatarSvaga;
|
||||||
|
|
||||||
public OlineListItemViewHolder(@NonNull View itemView) {
|
public OlineListItemViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
userName = itemView.findViewById(R.id.user_name);
|
userName = itemView.findViewById(R.id.user_name);
|
||||||
avatar = itemView.findViewById(R.id.avatar);
|
avatar = itemView.findViewById(R.id.avatar);
|
||||||
|
avatarSvaga = itemView.findViewById(R.id.avatar_svaga);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,6 +40,22 @@ public class OlineListItemViewHolder extends RecyclerView.ViewHolder {
|
|||||||
* @param model 数据
|
* @param model 数据
|
||||||
*/
|
*/
|
||||||
public void setData(OlineUserlistModel model) {
|
public void setData(OlineUserlistModel model) {
|
||||||
|
try {
|
||||||
|
new SVGAParser(itemView.getContext()).parse(new URL(model.getDress().getAvatarFrame()), new SVGAParser.ParseCompletion() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(SVGAVideoEntity videoItem) {
|
||||||
|
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||||
|
avatarSvaga.setImageDrawable(drawable);
|
||||||
|
SVGAViewUtils.playEndClear(avatarSvaga,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
ImgLoader.displayAvatar(itemView.getContext(), model.getAvatar(), avatar);
|
ImgLoader.displayAvatar(itemView.getContext(), model.getAvatar(), avatar);
|
||||||
userName.setText(model.getUserNicename());
|
userName.setText(model.getUserNicename());
|
||||||
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@ -9,13 +9,25 @@
|
|||||||
android:layout_marginBottom="18dp"
|
android:layout_marginBottom="18dp"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="52dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_marginStart="20dp">
|
||||||
|
|
||||||
<com.yunbao.common.views.weight.ClipPathCircleImage
|
<com.yunbao.common.views.weight.ClipPathCircleImage
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerCrop" />
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
|
android:id="@+id/avatar_svaga"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/user_name"
|
android:id="@+id/user_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user