防抖,主播私聊修复
This commit is contained in:
parent
0c4448f1f2
commit
892aaab6c0
@ -109,7 +109,7 @@ public class NoviceInstructorManager extends BaseCacheManager {
|
|||||||
//只有和指导员对话才可以清除信息
|
//只有和指导员对话才可以清除信息
|
||||||
UserInfo model1 = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
UserInfo model1 = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||||
IMLoginModel userModel = new Gson().fromJson(model1.getExtra(), IMLoginModel.class);
|
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();
|
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
|
||||||
HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg")
|
HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg")
|
||||||
.params("uid", userInfo.getId(),true)
|
.params("uid", userInfo.getId(),true)
|
||||||
|
@ -50,6 +50,7 @@ import java.util.ArrayList;
|
|||||||
import io.rong.imkit.IMCenter;
|
import io.rong.imkit.IMCenter;
|
||||||
import io.rong.imkit.model.ResultCallback;
|
import io.rong.imkit.model.ResultCallback;
|
||||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||||
|
import io.rong.imkit.userinfo.UserDataProvider;
|
||||||
import io.rong.imlib.RongIMClient;
|
import io.rong.imlib.RongIMClient;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
import io.rong.imlib.model.UserInfo;
|
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>() {
|
RongIMClient.getInstance().getTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, new RongIMClient.ResultCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String s) {
|
public void onSuccess(String s) {
|
||||||
if (TextUtils.isEmpty(inputPanel.getPresetInformation()))
|
if (!TextUtils.isEmpty(inputPanel.getPresetInformation()))
|
||||||
inputPanel.setPresetInformation(s);
|
inputPanel.setPresetInformation(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.bean.ImUserBean;
|
import com.yunbao.live.bean.ImUserBean;
|
||||||
|
|
||||||
@ -26,12 +27,9 @@ public class SystemChatMessageViewHolder extends RecyclerView.ViewHolder {
|
|||||||
userMsg = itemView.findViewById(R.id.msg);
|
userMsg = itemView.findViewById(R.id.msg);
|
||||||
lastTime = itemView.findViewById(R.id.time);
|
lastTime = itemView.findViewById(R.id.time);
|
||||||
redPoint = itemView.findViewById(R.id.red_point);
|
redPoint = itemView.findViewById(R.id.red_point);
|
||||||
itemView.setOnClickListener(new View.OnClickListener() {
|
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||||
@Override
|
if (null != listener) {
|
||||||
public void onClick(View v) {
|
listener.onClick(itemView, model);
|
||||||
if (null != listener) {
|
|
||||||
listener.onClick(v, model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package com.yunbao.main.adapter;
|
package com.yunbao.main.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.common.bean.UserItemBean;
|
import com.yunbao.common.bean.UserItemBean;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,25 +31,12 @@ public class MainMeAdapter extends RecyclerView.Adapter<MainMeAdapter.Vh> {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<UserItemBean> mList;
|
private List<UserItemBean> mList;
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private View.OnClickListener mOnClickListener;
|
|
||||||
private OnItemClickListener<UserItemBean> mOnItemClickListener;
|
private OnItemClickListener<UserItemBean> mOnItemClickListener;
|
||||||
|
|
||||||
public MainMeAdapter(Context context, List<UserItemBean> list) {
|
public MainMeAdapter(Context context, List<UserItemBean> list) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mList = list;
|
mList = list;
|
||||||
mInflater = LayoutInflater.from(context);
|
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) {
|
public void setOnItemClickListener(OnItemClickListener<UserItemBean> onItemClickListener) {
|
||||||
@ -121,7 +110,15 @@ public class MainMeAdapter extends RecyclerView.Adapter<MainMeAdapter.Vh> {
|
|||||||
super(itemView);
|
super(itemView);
|
||||||
mThumb = (ImageView) itemView.findViewById(R.id.thumb);
|
mThumb = (ImageView) itemView.findViewById(R.id.thumb);
|
||||||
mName = (TextView) itemView.findViewById(R.id.name);
|
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) {
|
void setData(UserItemBean bean) {
|
||||||
|
@ -86,7 +86,6 @@ public class SearchRecommendFragment extends BaseFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
ToastUtil.show(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.model.BaseUiConversation;
|
||||||
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
|
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
|
||||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||||
|
import io.rong.imkit.userinfo.UserDataProvider;
|
||||||
import io.rong.imkit.utils.RouteUtils;
|
import io.rong.imkit.utils.RouteUtils;
|
||||||
import io.rong.imkit.widget.adapter.ProviderManager;
|
import io.rong.imkit.widget.adapter.ProviderManager;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
@ -116,11 +117,11 @@ public class ConversationIMListManager {
|
|||||||
* @param targetId 用户id
|
* @param targetId 用户id
|
||||||
*/
|
*/
|
||||||
public void jumpConversation(Activity context, String targetId) {
|
public void jumpConversation(Activity context, String targetId) {
|
||||||
|
addUserInfoProvider(targetId, context);
|
||||||
if (context instanceof PDLIiveChatActivity) {
|
if (context instanceof PDLIiveChatActivity) {
|
||||||
context.finish();
|
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() {
|
private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) {
|
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) {
|
||||||
//非指导员都可以点击
|
//非指导员都可以点击
|
||||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(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);
|
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
|
||||||
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
|
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
|
||||||
RouteUtil.forwardUserHome(mContext, targetId, 0);
|
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.RouteUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.AbsMainViewHolder;
|
import com.yunbao.common.views.AbsMainViewHolder;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.live.activity.LiveRecordActivity;
|
import com.yunbao.live.activity.LiveRecordActivity;
|
||||||
import com.yunbao.live.activity.RoomManageActivity;
|
import com.yunbao.live.activity.RoomManageActivity;
|
||||||
import com.yunbao.live.activity.WebViewActivityMedal;
|
import com.yunbao.live.activity.WebViewActivityMedal;
|
||||||
@ -110,24 +111,23 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
|||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||||
mAvatar.setOnClickListener(new View.OnClickListener() {
|
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onViewClicks() {
|
||||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
mName = (TextView) findViewById(R.id.name);
|
mName = (TextView) findViewById(R.id.name);
|
||||||
gift_svga = (SVGAImageView) findViewById(com.yunbao.live.R.id.gift_svga);
|
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
|
@Override
|
||||||
public void onClick(View view) {
|
public void onViewClicks() {
|
||||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
user_noble_ico = (ImageView) findViewById(R.id.user_noble_ico);
|
user_noble_ico = (ImageView) findViewById(R.id.user_noble_ico);
|
||||||
// mSex = (ImageView) findViewById(R.id.sex);
|
|
||||||
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
|
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
|
||||||
mLevel = (ImageView) findViewById(R.id.level);
|
mLevel = (ImageView) findViewById(R.id.level);
|
||||||
tv_level = (TextView) findViewById(R.id.tv_level);
|
tv_level = (TextView) findViewById(R.id.tv_level);
|
||||||
|
@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.live.bean.ImUserBean;
|
import com.yunbao.live.bean.ImUserBean;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
@ -26,14 +27,12 @@ public class SystemMessageViewHolder extends RecyclerView.ViewHolder {
|
|||||||
userMsg = itemView.findViewById(R.id.msg);
|
userMsg = itemView.findViewById(R.id.msg);
|
||||||
lastTime = itemView.findViewById(R.id.time);
|
lastTime = itemView.findViewById(R.id.time);
|
||||||
redPoint = itemView.findViewById(R.id.red_point);
|
redPoint = itemView.findViewById(R.id.red_point);
|
||||||
itemView.setOnClickListener(new View.OnClickListener() {
|
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||||
@Override
|
if (null != listener) {
|
||||||
public void onClick(View v) {
|
listener.onClick(itemView, model);
|
||||||
if (null != listener) {
|
|
||||||
listener.onClick(v, model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ViewHolderOnClickListener {
|
public interface ViewHolderOnClickListener {
|
||||||
|
Loading…
Reference in New Issue
Block a user