fix [换设备已读聊天信息依旧推送问题]
This commit is contained in:
parent
91217e6bda
commit
51ab918327
@ -4,6 +4,7 @@ import static com.yunbao.live.socket.SocketClient.mSocketHandler;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
import android.app.LauncherActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.http.HttpResponseCache;
|
import android.net.http.HttpResponseCache;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -38,6 +39,7 @@ import com.yunbao.common.CommonAppContext;
|
|||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.AnchorStartLiveBean;
|
import com.yunbao.common.bean.AnchorStartLiveBean;
|
||||||
import com.yunbao.common.bean.CrashSaveBean;
|
import com.yunbao.common.bean.CrashSaveBean;
|
||||||
|
import com.yunbao.common.dialog.DebugDialog;
|
||||||
import com.yunbao.common.event.SudGameSocketImEvent;
|
import com.yunbao.common.event.SudGameSocketImEvent;
|
||||||
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
||||||
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
||||||
@ -69,6 +71,7 @@ import com.yunbao.main.activity.MainActivity;
|
|||||||
import com.yunbao.main.activity.MainHomeCommunityActivity;
|
import com.yunbao.main.activity.MainHomeCommunityActivity;
|
||||||
import com.yunbao.main.activity.MsgSettActivity;
|
import com.yunbao.main.activity.MsgSettActivity;
|
||||||
import com.yunbao.main.activity.PDLiveConversationActivity;
|
import com.yunbao.main.activity.PDLiveConversationActivity;
|
||||||
|
import com.yunbao.main.activity.RegisterActivity;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -106,6 +109,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResumed(Activity activity) {
|
public void onActivityResumed(Activity activity) {
|
||||||
Log.e("打招呼定时器", "onActivityResumed: " + activity);
|
Log.e("打招呼定时器", "onActivityResumed: " + activity);
|
||||||
|
MessageChatNotifyManager.getInstance().restart(activity);
|
||||||
if (activity instanceof LiveActivity) {
|
if (activity instanceof LiveActivity) {
|
||||||
MessageSayHiNotifyManager.getInstance().stop();
|
MessageSayHiNotifyManager.getInstance().stop();
|
||||||
return;
|
return;
|
||||||
@ -254,6 +258,11 @@ public class AppContext extends CommonAppContext {
|
|||||||
//注册屏蔽push弹窗的类
|
//注册屏蔽push弹窗的类
|
||||||
MessageChatNotifyManager.getInstance().addShieldClass(CompleteUserInfoActivity.class);
|
MessageChatNotifyManager.getInstance().addShieldClass(CompleteUserInfoActivity.class);
|
||||||
MessageChatNotifyManager.getInstance().addShieldClass(PDLiveConversationActivity.class);
|
MessageChatNotifyManager.getInstance().addShieldClass(PDLiveConversationActivity.class);
|
||||||
|
MessageChatNotifyManager.getInstance().addShieldClass(LauncherActivity.class);
|
||||||
|
MessageChatNotifyManager.getInstance().addShieldClass(EntryActivity.class);
|
||||||
|
MessageChatNotifyManager.getInstance().addShieldClass(LoginActivity.class);
|
||||||
|
MessageChatNotifyManager.getInstance().addShieldClass(RegisterActivity.class);
|
||||||
|
|
||||||
|
|
||||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -291,14 +300,16 @@ public class AppContext extends CommonAppContext {
|
|||||||
if (AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity) {
|
if (AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Log.i("聊天推送", message.getTargetId() + "是否已读:" + message.getReceivedStatus().isRead());
|
||||||
if (message.getReceivedStatus().isRead()) {
|
if (message.getReceivedStatus().isRead()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, message.getTargetId(), new RongIMClient.ResultCallback<Integer>() {
|
RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, message.getTargetId(), new RongIMClient.ResultCallback<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Integer integer) {
|
public void onSuccess(Integer integer) {
|
||||||
|
DebugDialog.getInstance(AppManager.getActivity(MainActivity.class)).setParams("推送" + message.getTargetId(), "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer);
|
||||||
if (integer > 0) {
|
if (integer > 0) {
|
||||||
|
Log.i("聊天推送", message.getTargetId() + "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer);
|
||||||
MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity()
|
MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity()
|
||||||
, message.getTargetId(),
|
, message.getTargetId(),
|
||||||
content.getContent()
|
content.getContent()
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.view.TextureView;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public class DebugDialogAdapter extends RecyclerView.Adapter<DebugDialogAdapter.DebugViewHolder> {
|
||||||
|
TreeMap<String, String> paramMap = new TreeMap<>();
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public DebugDialogAdapter(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParamMap(TreeMap<String, String> paramMap) {
|
||||||
|
this.paramMap = paramMap;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public DebugViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new DebugViewHolder(new TextView(mContext));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull DebugViewHolder holder, int position) {
|
||||||
|
List<String> list = new ArrayList<>(paramMap.keySet());
|
||||||
|
holder.setData(list.get(position), paramMap.get(list.get(position)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return paramMap.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DebugViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
public DebugViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String tag, String msg) {
|
||||||
|
((TextView) itemView).setText(tag + ":" + msg);
|
||||||
|
((TextView) itemView).setTextColor(Color.BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.lzf.easyfloat.EasyFloat;
|
||||||
|
import com.lzf.easyfloat.enums.ShowPattern;
|
||||||
|
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
||||||
|
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||||
|
import com.yunbao.common.CommonAppContext;
|
||||||
|
import com.yunbao.common.adapter.DebugDialogAdapter;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
|
||||||
|
public class DebugDialog {
|
||||||
|
RecyclerView recyclerView;
|
||||||
|
TreeMap<String, String> params;
|
||||||
|
DebugDialogAdapter adapter;
|
||||||
|
private static DebugDialog debugDialog;
|
||||||
|
Context mContext;
|
||||||
|
|
||||||
|
public static DebugDialog getInstance(Activity mainActivity) {
|
||||||
|
if (debugDialog == null) {
|
||||||
|
debugDialog = new DebugDialog(mainActivity);
|
||||||
|
}
|
||||||
|
return debugDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DebugDialog clear() {
|
||||||
|
params.clear();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParams(String tag, String msg) {
|
||||||
|
params.put(tag, msg);
|
||||||
|
if (adapter != null)
|
||||||
|
adapter.setParamMap(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DebugDialog(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
params = new TreeMap<>();
|
||||||
|
if (PermissionUtils.checkPermission(mContext)) {
|
||||||
|
createView();
|
||||||
|
} else {
|
||||||
|
PermissionUtils.requestPermission((Activity) mContext, new OnPermissionResult() {
|
||||||
|
@Override
|
||||||
|
public void permissionResult(boolean b) {
|
||||||
|
ToastUtil.show("悬浮权限" + b);
|
||||||
|
if (b) {
|
||||||
|
createView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createView() {
|
||||||
|
recyclerView = new RecyclerView(mContext);
|
||||||
|
adapter = new DebugDialogAdapter(mContext);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
recyclerView.setBackgroundColor(Color.WHITE);
|
||||||
|
EasyFloat.with(mContext)
|
||||||
|
.setTag("debug")
|
||||||
|
.setShowPattern(ShowPattern.ALL_TIME)
|
||||||
|
.setLayout(recyclerView)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
@ -16,13 +16,12 @@ import com.yunbao.common.custom.RatioRoundImageView;
|
|||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.common.utils.ViewUtils;
|
|
||||||
|
|
||||||
import io.rong.imkit.utils.RouteUtils;
|
import io.rong.imkit.utils.RouteUtils;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
|
public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
|
||||||
|
private static boolean dialogStatusShow =false;
|
||||||
private MessageUserInfoBean liveBean;
|
private MessageUserInfoBean liveBean;
|
||||||
private DialogInterface.OnDismissListener onDismissListener;
|
private DialogInterface.OnDismissListener onDismissListener;
|
||||||
|
|
||||||
@ -44,6 +43,10 @@ public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isDialogStatusShow() {
|
||||||
|
return dialogStatusShow;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildDialog(XPopup.Builder builder) {
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
builder.positionByWindowCenter(true);
|
builder.positionByWindowCenter(true);
|
||||||
@ -67,6 +70,13 @@ public class MessageChatNotifyDialog extends AbsDialogPositionPopupWindow {
|
|||||||
@Override
|
@Override
|
||||||
protected void onShow() {
|
protected void onShow() {
|
||||||
super.onShow();
|
super.onShow();
|
||||||
|
dialogStatusShow =true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDismiss() {
|
||||||
|
super.onDismiss();
|
||||||
|
dialogStatusShow =false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,8 +115,8 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow {
|
|||||||
private void showTag() {
|
private void showTag() {
|
||||||
List<String> tags = new ArrayList<>();
|
List<String> tags = new ArrayList<>();
|
||||||
tags.add(userInfoBean.getInfo().getSex() == 1 ? WordUtil.getNewString(R.string.sex_male) : WordUtil.getNewString(R.string.sex_female));
|
tags.add(userInfoBean.getInfo().getSex() == 1 ? WordUtil.getNewString(R.string.sex_male) : WordUtil.getNewString(R.string.sex_female));
|
||||||
if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())) {
|
if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer(), userInfoBean.getInfo().getEnCareer())) {
|
||||||
tags.add(userInfoBean.getInfo().getCareer());
|
tags.add(WordUtil.isNewZh() ? userInfoBean.getInfo().getCareer() : userInfoBean.getInfo().getEnCareer());
|
||||||
}
|
}
|
||||||
if (!StringUtil.isEmpty(userInfoBean.getInfo().getHeight()) && !userInfoBean.getInfo().getHeight().equals("0")) {
|
if (!StringUtil.isEmpty(userInfoBean.getInfo().getHeight()) && !userInfoBean.getInfo().getHeight().equals("0")) {
|
||||||
tags.add(userInfoBean.getInfo().getHeight());
|
tags.add(userInfoBean.getInfo().getHeight());
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
package com.yunbao.common.utils;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||||
|
import com.yunbao.common.dialog.DebugDialog;
|
||||||
import com.yunbao.common.dialog.MessageChatNotifyDialog;
|
import com.yunbao.common.dialog.MessageChatNotifyDialog;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.rong.imlib.RongIMClient;
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class MessageChatNotifyManager {
|
public class MessageChatNotifyManager {
|
||||||
private static MessageChatNotifyManager instance;
|
private static MessageChatNotifyManager instance;
|
||||||
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
|
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
|
||||||
@ -34,23 +41,51 @@ public class MessageChatNotifyManager {
|
|||||||
notifyLiveFlot(mContext);
|
notifyLiveFlot(mContext);
|
||||||
} else {
|
} else {
|
||||||
startListNotifyList.add(userInfo);
|
startListNotifyList.add(userInfo);
|
||||||
|
if (!MessageChatNotifyDialog.isDialogStatusShow()) {
|
||||||
|
notifyLiveFlot(mContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyLiveFlot(Context mContext) {
|
public void restart(Context mContext) {
|
||||||
|
notifyLiveFlot(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private synchronized void notifyLiveFlot(Context mContext) {
|
||||||
String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
|
String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
|
||||||
if (clazzList.contains(simpleName)) {
|
if (clazzList.contains(simpleName)) {
|
||||||
ToastUtil.showDebug("屏蔽类,不展示");
|
ToastUtil.showDebug("屏蔽类,不展示");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
DebugDialog.getInstance((Activity) mContext).setParams("待推送通知数", startListNotifyList.size() + "");
|
||||||
if (startListNotifyList.iterator().hasNext()) {
|
if (startListNotifyList.iterator().hasNext()) {
|
||||||
MessageUserInfoBean bean = startListNotifyList.iterator().next();
|
MessageUserInfoBean bean = startListNotifyList.iterator().next();
|
||||||
|
RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, bean.getUser().getId() + "", new RongIMClient.ResultCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Integer integer) {
|
||||||
|
if (integer > 0) {
|
||||||
new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> {
|
new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> {
|
||||||
startListNotifyList.remove(bean);
|
startListNotifyList.remove(bean);
|
||||||
if (startListNotifyList.iterator().hasNext()) {
|
if (startListNotifyList.iterator().hasNext()) {
|
||||||
notifyLiveFlot(mContext);
|
notifyLiveFlot(mContext);
|
||||||
}
|
}
|
||||||
}).showDialog();
|
}).showDialog();
|
||||||
|
} else {
|
||||||
|
Iterator<MessageUserInfoBean> iterator = startListNotifyList.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (iterator.next().getUser().getId() == bean.getUser().getId()) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode e) {
|
||||||
|
notifyLiveFlot(mContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
ToastUtil.showDebug("Not Message");
|
ToastUtil.showDebug("Not Message");
|
||||||
}
|
}
|
||||||
@ -71,4 +106,17 @@ public class MessageChatNotifyManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
startListNotifyList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear(long id) {
|
||||||
|
Iterator<MessageUserInfoBean> iterator = startListNotifyList.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
if (iterator.next().getUser().getId() == id) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
11
common/src/main/res/layout/dialog_debug.xml
Normal file
11
common/src/main/res/layout/dialog_debug.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -36,6 +37,7 @@ import io.rong.imkit.utils.language.LangUtils;
|
|||||||
import io.rong.imkit.utils.language.RongConfigurationManager;
|
import io.rong.imkit.utils.language.RongConfigurationManager;
|
||||||
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
||||||
import io.rong.imkit.widget.adapter.ViewHolder;
|
import io.rong.imkit.widget.adapter.ViewHolder;
|
||||||
|
import io.rong.imlib.RongIMClient;
|
||||||
import io.rong.imlib.model.Message;
|
import io.rong.imlib.model.Message;
|
||||||
import io.rong.imlib.model.MessageContent;
|
import io.rong.imlib.model.MessageContent;
|
||||||
|
|
||||||
@ -72,6 +74,23 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
|
|||||||
holder.itemView.setBackgroundColor(Color.parseColor("#00000000"));
|
holder.itemView.setBackgroundColor(Color.parseColor("#00000000"));
|
||||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||||
|
|
||||||
|
if(messageDirection==Message.MessageDirection.RECEIVE){
|
||||||
|
RongIMClient.getInstance().syncConversationReadStatus(mDataList.get(position).getConversationType(),
|
||||||
|
mDataList.get(position).getTargetId(),
|
||||||
|
mDataList.get(position).getSentTime(),
|
||||||
|
new RongIMClient.OperationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
Log.i("聊天推送", "同步消息成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||||
|
Log.i("聊天推送", "同步消息失败:"+errorCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (readReceiptNew != null) {
|
if (readReceiptNew != null) {
|
||||||
if (messageDirection == Message.MessageDirection.SEND) {
|
if (messageDirection == Message.MessageDirection.SEND) {
|
||||||
readReceiptNew.setVisibility(View.VISIBLE);
|
readReceiptNew.setVisibility(View.VISIBLE);
|
||||||
|
@ -84,6 +84,7 @@ import com.yunbao.common.manager.IMLoginManager;
|
|||||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
|
import com.yunbao.common.utils.MessageChatNotifyManager;
|
||||||
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.http.LiveHttpUtil;
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
@ -184,6 +185,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
activity = this;
|
activity = this;
|
||||||
Contexts = this;
|
Contexts = this;
|
||||||
setStatusBar();
|
setStatusBar();
|
||||||
|
MessageChatNotifyManager.getInstance().clear();
|
||||||
lt_btn_facebook = findViewById(R.id.lt_btn_facebook);
|
lt_btn_facebook = findViewById(R.id.lt_btn_facebook);
|
||||||
lt_btn_twitter = findViewById(R.id.lt_btn_twitter);
|
lt_btn_twitter = findViewById(R.id.lt_btn_twitter);
|
||||||
btn_tip = findViewById(R.id.btn_tip);
|
btn_tip = findViewById(R.id.btn_tip);
|
||||||
|
@ -17,6 +17,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
@ -67,6 +68,7 @@ import com.yunbao.common.bean.LiveSvgGiftBean;
|
|||||||
import com.yunbao.common.bean.UpdataListBean;
|
import com.yunbao.common.bean.UpdataListBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.custom.TabButtonGroup;
|
import com.yunbao.common.custom.TabButtonGroup;
|
||||||
|
import com.yunbao.common.dialog.DebugDialog;
|
||||||
import com.yunbao.common.dialog.HintDialog;
|
import com.yunbao.common.dialog.HintDialog;
|
||||||
import com.yunbao.common.dialog.InstructorOperationDialog;
|
import com.yunbao.common.dialog.InstructorOperationDialog;
|
||||||
import com.yunbao.common.event.CompleteInformationEvent;
|
import com.yunbao.common.event.CompleteInformationEvent;
|
||||||
@ -150,9 +152,12 @@ import cn.rongcloud.rtc.api.RCRTCConfig;
|
|||||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.rong.imkit.RongIM;
|
||||||
import io.rong.imkit.config.RongConfigCenter;
|
import io.rong.imkit.config.RongConfigCenter;
|
||||||
import io.rong.imkit.notification.NotificationConfig;
|
import io.rong.imkit.notification.NotificationConfig;
|
||||||
|
import io.rong.imlib.RongCoreClient;
|
||||||
import io.rong.imlib.RongIMClient;
|
import io.rong.imlib.RongIMClient;
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
import io.rong.imlib.model.Message;
|
import io.rong.imlib.model.Message;
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
|
|
||||||
@ -225,6 +230,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
ActivityCompat.postponeEnterTransition(this);
|
ActivityCompat.postponeEnterTransition(this);
|
||||||
ConversationIMListManager.get(this);
|
ConversationIMListManager.get(this);
|
||||||
OpenAdManager.getInstance();
|
OpenAdManager.getInstance();
|
||||||
|
new Handler(Looper.getMainLooper())
|
||||||
|
.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
DebugDialog.getInstance(mContext).setParams("Debug", "悬浮层");
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
UserInfoManager.updateMyInfo(this, null);
|
UserInfoManager.updateMyInfo(this, null);
|
||||||
//在请求一下这个接口给我后台版本号
|
//在请求一下这个接口给我后台版本号
|
||||||
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
||||||
@ -266,6 +278,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
|
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
|
||||||
config.enableEncoderTexture(false);//新娱美颜 需要关闭这个
|
config.enableEncoderTexture(false);//新娱美颜 需要关闭这个
|
||||||
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
|
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
|
||||||
|
ConversationIMListManager.get(mContext).addUserInfoProvider();
|
||||||
|
requestNotReadMessage();
|
||||||
//推送跳直播间
|
//推送跳直播间
|
||||||
if (getIntent().getStringExtra("liveid") != null) {
|
if (getIntent().getStringExtra("liveid") != null) {
|
||||||
LiveHttpUtil.getLiveInfo(getIntent().getStringExtra("liveid") + "", new HttpCallback() {
|
LiveHttpUtil.getLiveInfo(getIntent().getStringExtra("liveid") + "", new HttpCallback() {
|
||||||
@ -550,6 +564,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
showFirstLogin();
|
showFirstLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void requestNotReadMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void showFirstLogin() {
|
private void showFirstLogin() {
|
||||||
LiveNetManager.get(mContext).isFirstLogin(new com.yunbao.common.http.base.HttpCallback<FirstLoginBean>() {
|
LiveNetManager.get(mContext).isFirstLogin(new com.yunbao.common.http.base.HttpCallback<FirstLoginBean>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,6 +47,7 @@ import com.yunbao.common.manager.NoviceInstructorManager;
|
|||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||||
|
import com.yunbao.common.utils.MessageChatNotifyManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
@ -108,6 +109,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
super.main();
|
super.main();
|
||||||
|
targetId = getIntent().getStringExtra("targetId");
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
mContext = this;
|
mContext = this;
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||||
@ -116,13 +118,13 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
WindowSoftModeAdjustResizeExecutor.assistActivity(this);
|
WindowSoftModeAdjustResizeExecutor.assistActivity(this);
|
||||||
//设置会话界面操作监听器
|
//设置会话界面操作监听器
|
||||||
MessageIMManager.get(this).addConversationClickListener();
|
MessageIMManager.get(this).addConversationClickListener();
|
||||||
|
MessageChatNotifyManager.getInstance().clear(Long.parseLong(targetId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
setUserCard();
|
setUserCard();
|
||||||
ConversationIMListManager.get(mContext).addUserInfoProvider();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideUserCard() {
|
private void hideUserCard() {
|
||||||
@ -228,7 +230,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
private void initView() {
|
private void initView() {
|
||||||
try {
|
try {
|
||||||
// 添加会话界面
|
// 添加会话界面
|
||||||
targetId = getIntent().getStringExtra("targetId");
|
|
||||||
conversationFragment = new PDLiveConversationFragment(targetId);
|
conversationFragment = new PDLiveConversationFragment(targetId);
|
||||||
FragmentManager manager = getSupportFragmentManager();
|
FragmentManager manager = getSupportFragmentManager();
|
||||||
FragmentTransaction transaction = manager.beginTransaction();
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
|
@ -14,6 +14,7 @@ import com.yunbao.common.bean.SetAttentsModel;
|
|||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.AppManager;
|
||||||
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.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
@ -23,8 +24,10 @@ import com.yunbao.main.fragment.MyAddressBookFragment;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.rong.imkit.utils.RouteUtils;
|
||||||
import io.rong.imkit.widget.adapter.BaseAdapter;
|
import io.rong.imkit.widget.adapter.BaseAdapter;
|
||||||
import io.rong.imkit.widget.adapter.ViewHolder;
|
import io.rong.imkit.widget.adapter.ViewHolder;
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBean> {
|
public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBean> {
|
||||||
public static final int TYPE_SEARCH_TITLE = 500;
|
public static final int TYPE_SEARCH_TITLE = 500;
|
||||||
@ -85,10 +88,15 @@ public class MainMsgAddressBookListAdapter extends BaseAdapter<MessageChatUserBe
|
|||||||
}
|
}
|
||||||
holder.getConvertView().setTag(mDataList.get(position));
|
holder.getConvertView().setTag(mDataList.get(position));
|
||||||
holder.getConvertView().setOnClickListener(view -> {
|
holder.getConvertView().setOnClickListener(view -> {
|
||||||
/* MessageChatUserBean userBean = (MessageChatUserBean) view.getTag();
|
AppManager.runDebugCode(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MessageChatUserBean userBean = (MessageChatUserBean) view.getTag();
|
||||||
RouteUtils.routeToConversationActivity(view.getContext(),
|
RouteUtils.routeToConversationActivity(view.getContext(),
|
||||||
Conversation.ConversationType.PRIVATE,
|
Conversation.ConversationType.PRIVATE,
|
||||||
userBean.getId());*/
|
userBean.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
|||||||
search = findViewById(R.id.search);
|
search = findViewById(R.id.search);
|
||||||
contacts.setOnClickListener(view -> {
|
contacts.setOnClickListener(view -> {
|
||||||
//通讯录
|
//通讯录
|
||||||
//RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
|
RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
|
||||||
mContext.startActivity(new Intent(mContext, com.yunbao.main.activity.CompleteUserInfoActivity.class));
|
// mContext.startActivity(new Intent(mContext, com.yunbao.main.activity.CompleteUserInfoActivity.class));
|
||||||
// mContext.startActivity(new Intent(mContext, MessageHiConfigRecordActivity.class));
|
// mContext.startActivity(new Intent(mContext, MessageHiConfigRecordActivity.class));
|
||||||
});
|
});
|
||||||
search.addTextChangedListener(new TextWatcher() {
|
search.addTextChangedListener(new TextWatcher() {
|
||||||
|
Loading…
Reference in New Issue
Block a user