防抖,主播私聊修复
This commit is contained in:
parent
0c4448f1f2
commit
892aaab6c0
@ -109,7 +109,7 @@ public class NoviceInstructorManager extends BaseCacheManager {
|
||||
//只有和指导员对话才可以清除信息
|
||||
UserInfo model1 = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||
IMLoginModel userModel = new Gson().fromJson(model1.getExtra(), IMLoginModel.class);
|
||||
if (TextUtils.equals(userModel.getIsAdmin(), "1")) {
|
||||
if (userModel!=null&&TextUtils.equals(userModel.getIsAdmin(), "1")) {
|
||||
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
|
||||
HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg")
|
||||
.params("uid", userInfo.getId(),true)
|
||||
|
@ -50,6 +50,7 @@ import java.util.ArrayList;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.model.ResultCallback;
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imkit.userinfo.UserDataProvider;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
@ -218,7 +219,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
RongIMClient.getInstance().getTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, new RongIMClient.ResultCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
if (TextUtils.isEmpty(inputPanel.getPresetInformation()))
|
||||
if (!TextUtils.isEmpty(inputPanel.getPresetInformation()))
|
||||
inputPanel.setPresetInformation(s);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
|
||||
@ -26,12 +27,9 @@ public class SystemChatMessageViewHolder extends RecyclerView.ViewHolder {
|
||||
userMsg = itemView.findViewById(R.id.msg);
|
||||
lastTime = itemView.findViewById(R.id.time);
|
||||
redPoint = itemView.findViewById(R.id.red_point);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != listener) {
|
||||
listener.onClick(v, model);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
if (null != listener) {
|
||||
listener.onClick(itemView, model);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
package com.yunbao.main.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.bean.UserItemBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
import java.util.List;
|
||||
@ -29,25 +31,12 @@ public class MainMeAdapter extends RecyclerView.Adapter<MainMeAdapter.Vh> {
|
||||
private Context mContext;
|
||||
private List<UserItemBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<UserItemBean> mOnItemClickListener;
|
||||
|
||||
public MainMeAdapter(Context context, List<UserItemBean> list) {
|
||||
mContext = context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
UserItemBean bean = (UserItemBean) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<UserItemBean> onItemClickListener) {
|
||||
@ -121,7 +110,15 @@ public class MainMeAdapter extends RecyclerView.Adapter<MainMeAdapter.Vh> {
|
||||
super(itemView);
|
||||
mThumb = (ImageView) itemView.findViewById(R.id.thumb);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
Object tag = itemView.getTag();
|
||||
if (tag != null) {
|
||||
UserItemBean bean = (UserItemBean) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void setData(UserItemBean bean) {
|
||||
|
@ -86,7 +86,6 @@ public class SearchRecommendFragment extends BaseFragment {
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import io.rong.imkit.conversation.messgelist.provider.SightMessageItemProvider;
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imkit.userinfo.UserDataProvider;
|
||||
import io.rong.imkit.utils.RouteUtils;
|
||||
import io.rong.imkit.widget.adapter.ProviderManager;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
@ -116,11 +117,11 @@ public class ConversationIMListManager {
|
||||
* @param targetId 用户id
|
||||
*/
|
||||
public void jumpConversation(Activity context, String targetId) {
|
||||
addUserInfoProvider(targetId, context);
|
||||
if (context instanceof PDLIiveChatActivity) {
|
||||
context.finish();
|
||||
}
|
||||
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
|
||||
RouteUtils.routeToConversationActivity(context, type, targetId, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -159,12 +160,59 @@ public class ConversationIMListManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
private void addUserInfoProvider(String userId, Activity context) {
|
||||
//获取用户信息
|
||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(userId);
|
||||
if (null != userInfo){
|
||||
context.runOnUiThread(() -> {
|
||||
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
|
||||
RouteUtils.routeToConversationActivity(context, type, userId, null);
|
||||
});
|
||||
}else {
|
||||
CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0 && !TextUtils.equals("__system__", userId)) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
||||
String userNiceName = "";
|
||||
String remark = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId);
|
||||
if (!TextUtils.isEmpty(remark)) {
|
||||
userNiceName = remark;
|
||||
} else {
|
||||
userNiceName = userBean.getUserNiceName();
|
||||
}
|
||||
if (!TextUtils.isEmpty(userNiceName) && !TextUtils.isEmpty(userBean.getAvatar())) {
|
||||
UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar()));
|
||||
//使用空白字段存储自己服务器用户的所有的信息
|
||||
userInfo.setExtra(GsonUtils.toJson(userBean));
|
||||
RongUserInfoManager.getInstance().setUserInfoProvider(s -> {
|
||||
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
|
||||
return null;
|
||||
}, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() {
|
||||
@Override
|
||||
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) {
|
||||
//非指导员都可以点击
|
||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||
if (userInfo!=null&&!TextUtils.isEmpty(userInfo.getExtra())){
|
||||
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
|
||||
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
|
||||
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
|
||||
RouteUtil.forwardUserHome(mContext, targetId, 0);
|
||||
|
@ -41,6 +41,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.AbsMainViewHolder;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.activity.LiveRecordActivity;
|
||||
import com.yunbao.live.activity.RoomManageActivity;
|
||||
import com.yunbao.live.activity.WebViewActivityMedal;
|
||||
@ -110,24 +111,23 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
||||
@Override
|
||||
public void init() {
|
||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||
mAvatar.setOnClickListener(new View.OnClickListener() {
|
||||
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mName = (TextView) findViewById(R.id.name);
|
||||
gift_svga = (SVGAImageView) findViewById(com.yunbao.live.R.id.gift_svga);
|
||||
gift_svga.setOnClickListener(new View.OnClickListener() {
|
||||
ViewClicksAntiShake.clicksAntiShake(gift_svga, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
}
|
||||
});
|
||||
|
||||
user_noble_ico = (ImageView) findViewById(R.id.user_noble_ico);
|
||||
// mSex = (ImageView) findViewById(R.id.sex);
|
||||
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
|
||||
mLevel = (ImageView) findViewById(R.id.level);
|
||||
tv_level = (TextView) findViewById(R.id.tv_level);
|
||||
|
@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
@ -26,14 +27,12 @@ public class SystemMessageViewHolder extends RecyclerView.ViewHolder {
|
||||
userMsg = itemView.findViewById(R.id.msg);
|
||||
lastTime = itemView.findViewById(R.id.time);
|
||||
redPoint = itemView.findViewById(R.id.red_point);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != listener) {
|
||||
listener.onClick(v, model);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
if (null != listener) {
|
||||
listener.onClick(itemView, model);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public interface ViewHolderOnClickListener {
|
||||
|
Loading…
Reference in New Issue
Block a user