Commit 392cdfd7 by 霍志良

feat:删除聊天记录、群聊艾特我、群聊已读相关的

parent 578b8e94
...@@ -44,7 +44,7 @@ ext { ...@@ -44,7 +44,7 @@ ext {
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.92", "ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.2", "ydl-utils" : "0.0.3.2",
] ]
ydl_app = [ ydl_app = [
...@@ -127,7 +127,7 @@ ext { ...@@ -127,7 +127,7 @@ ext {
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.92", "ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.1", "ydl-utils" : "0.0.3.1",
] ]
......
package com.yidianling.im.bean;
import com.ydl.ydlcommon.data.http.BaseCommand;
public class TeamAlreadyReadBean extends BaseCommand {
public String tid;
public String uid;
public TeamAlreadyReadBean(String tid, String uid) {
this.tid = tid;
this.uid = uid;
}
}
package com.yidianling.im.event
class ChatGroupStatusEvent()
\ No newline at end of file
...@@ -70,6 +70,7 @@ interface ImApi { ...@@ -70,6 +70,7 @@ interface ImApi {
@POST("consult/get-expert") @POST("consult/get-expert")
fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>> fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>>
//以下接口为消息改版后新加 //以下接口为消息改版后新加
//私聊 获取各消息未读数 //私聊 获取各消息未读数
@GET("chat/getNotifyCountMessage") @GET("chat/getNotifyCountMessage")
......
...@@ -50,4 +50,5 @@ interface ImHttp { ...@@ -50,4 +50,5 @@ interface ImHttp {
fun getInteractMessage(param: InteractMessageParam): Observable<BaseAPIResponse<InteractBean>> fun getInteractMessage(param: InteractMessageParam): Observable<BaseAPIResponse<InteractBean>>
fun getUnreadMessage(param: UnreadParam): Observable<BaseAPIResponse<UnreadMessageBean>> fun getUnreadMessage(param: UnreadParam): Observable<BaseAPIResponse<UnreadMessageBean>>
} }
\ No newline at end of file
...@@ -37,6 +37,11 @@ interface ImRetrofitApi { ...@@ -37,6 +37,11 @@ interface ImRetrofitApi {
@POST("consult/get-expert") @POST("consult/get-expert")
fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>> fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>>
//群聊 群聊Ait艾特符号已读
@POST("message/chatRoom/readApnsMessage")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun teamChatALreadyRead(@Body params: Map<String, String>): Observable<BaseResponse<Any>>
//获取用户的状态(用户、专家、助理) //获取用户的状态(用户、专家、助理)
@GET("user/userType") @GET("user/userType")
......
...@@ -7,12 +7,17 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -7,12 +7,17 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.jcodecraeer.xrecyclerview.CustomFooterViewCallBack import com.jcodecraeer.xrecyclerview.CustomFooterViewCallBack
import com.jcodecraeer.xrecyclerview.XRecyclerView import com.jcodecraeer.xrecyclerview.XRecyclerView
import com.ydl.ydlcommon.base.BaseFragment import com.ydl.ydlcommon.base.BaseFragment
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlcommon.utils.NetworkParamsUtils.getMaps
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R import com.yidianling.im.R
import com.yidianling.im.bean.TeamAlreadyReadBean
import com.yidianling.im.event.MessageListRefreshEvent import com.yidianling.im.event.MessageListRefreshEvent
import com.yidianling.im.helper.MsgReceiveHelper import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.http.ImHttpImpl import com.yidianling.im.http.ImHttpImpl
import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.im.router.ImIn import com.yidianling.im.router.ImIn
import com.yidianling.im.ui.page.fragment.adapter.ChatAdapter import com.yidianling.im.ui.page.fragment.adapter.ChatAdapter
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
...@@ -21,6 +26,8 @@ import com.yidianling.im.ui.page.fragment.view.ChatFooterItemView ...@@ -21,6 +26,8 @@ import com.yidianling.im.ui.page.fragment.view.ChatFooterItemView
import com.yidianling.im.ui.page.widget.ChatUnusualView import com.yidianling.im.ui.page.widget.ChatUnusualView
import com.yidianling.im.ui.param.ChatParam import com.yidianling.im.ui.param.ChatParam
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.im_chat_fragment_layout.* import kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/** /**
...@@ -224,6 +231,12 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -224,6 +231,12 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
getChatMessageData() getChatMessageData()
} }
}) })
chatAdapter?.setChatAitReadlistener(object :ChatAdapter.ChatAitAlreadyRead{
override fun alreadyReadAit(tid:String) {
//群聊已读消息
TeamAlreadyRead(tid)
}
})
chat_recyclerview.layoutManager = LinearLayoutManager(context) chat_recyclerview.layoutManager = LinearLayoutManager(context)
chat_recyclerview.adapter = chatAdapter chat_recyclerview.adapter = chatAdapter
chat_recyclerview.setLoadingListener(this) chat_recyclerview.setLoadingListener(this)
...@@ -241,6 +254,20 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener { ...@@ -241,6 +254,20 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
}) })
} }
private fun TeamAlreadyRead(tid: String) {
val cmd = TeamAlreadyReadBean(tid, ImIn.getUserInfo()?.uid.toString())
val disposable =
ImRetrofitApi.getImJavaApi().teamChatALreadyRead(getMaps(cmd))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp: BaseResponse<Any> ->
}
) { throwable: Throwable ->
}
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
resetPageShow() resetPageShow()
......
...@@ -15,6 +15,7 @@ import com.ydl.ydlcommon.data.http.RxUtils ...@@ -15,6 +15,7 @@ import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.ListNoCancelDialog import com.ydl.ydlcommon.view.ListNoCancelDialog
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.param.RmHistoryParam import com.yidianling.im.api.param.RmHistoryParam
import com.yidianling.im.api.param.RmTalkParam import com.yidianling.im.api.param.RmTalkParam
import com.yidianling.im.api.param.TopMessageParam import com.yidianling.im.api.param.TopMessageParam
...@@ -23,11 +24,15 @@ import com.yidianling.im.event.UpdateTabUnreadNumEvent ...@@ -23,11 +24,15 @@ import com.yidianling.im.event.UpdateTabUnreadNumEvent
import com.yidianling.im.helper.IMChatUtil import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.helper.MsgReceiveHelper import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.http.ImHttpImpl import com.yidianling.im.http.ImHttpImpl
import com.yidianling.im.router.ImIn
import com.yidianling.im.session.SessionHelper import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import com.yidianling.im.ui.page.fragment.view.ChatItemView import com.yidianling.im.ui.page.fragment.view.ChatItemView
import com.yidianling.im.ui.page.fragment.view.ChatTimeItemView import com.yidianling.im.ui.page.fragment.view.ChatTimeItemView
import com.yidianling.im.ui.param.ChatParam
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/** /**
* 互动列表适配器 * 互动列表适配器
...@@ -63,9 +68,11 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea ...@@ -63,9 +68,11 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
P2PCustomActionHandlerImpl("4108805", "课程小助手-壹壹", "4108805")) P2PCustomActionHandlerImpl("4108805", "课程小助手-壹壹", "4108805"))
}else { }else {
// IMUtil.startChat(context as AppCompatActivity, mList[position].toUid.toString(), 0, 0, null, 0, true) // IMUtil.startChat(context as AppCompatActivity, mList[position].toUid.toString(), 0, 0, null, 0, true)
if (mList[position].chat_type==2){ if (mList[position].chat_type==2){//群聊
mChatListener?.alreadyReadAit(mList[position].toUid.toString())
SessionHelper.startTeamSession(context,mList[position].toUid.toString()) SessionHelper.startTeamSession(context,mList[position].toUid.toString())
}else{
}else{//单聊
IMChatUtil.startChat(context as AppCompatActivity, mList[position]) IMChatUtil.startChat(context as AppCompatActivity, mList[position])
} }
} }
...@@ -218,6 +225,16 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea ...@@ -218,6 +225,16 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
fun onRefresh() //刷新聊天列表 fun onRefresh() //刷新聊天列表
} }
private var mChatListener: ChatAitAlreadyRead? = null
fun setChatAitReadlistener(mChatListener: ChatAitAlreadyRead) {
this.mChatListener = mChatListener
}
interface ChatAitAlreadyRead {
fun alreadyReadAit( tid:String) //群聊艾特符号
}
/** /**
* 互动列表正常item的holder * 互动列表正常item的holder
*/ */
......
...@@ -28,5 +28,6 @@ class ChatItemBean( ...@@ -28,5 +28,6 @@ class ChatItemBean(
var doctorTitle: String = "", var doctorTitle: String = "",
var isThreeItem: Boolean = false, //是否是三周前时间展示item var isThreeItem: Boolean = false, //是否是三周前时间展示item
var listenOrderStatus: Int = 0, // 倾诉状态 var listenOrderStatus: Int = 0, // 倾诉状态
var orderStatus: Int = 0 //咨询状态 var orderStatus: Int = 0 ,//咨询状态
var noReadAtContent:String?=""
) )
\ No newline at end of file
...@@ -73,6 +73,9 @@ class ChatItemView(mContext: Context) : LinearLayout(mContext) { ...@@ -73,6 +73,9 @@ class ChatItemView(mContext: Context) : LinearLayout(mContext) {
bean.toUid.toString() bean.toUid.toString()
) )
chat_message_content.setText(Html.fromHtml(th)) chat_message_content.setText(Html.fromHtml(th))
}else if (!bean.noReadAtContent.isNullOrEmpty()){
var th = "<font color='#FF7766' charset='utf-8'>[有人@我]</font> " + bean.content;
chat_message_content.setText(Html.fromHtml(th));
}else { }else {
chat_message_content.text = bean.content chat_message_content.text = bean.content
} }
......
...@@ -167,8 +167,10 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity { ...@@ -167,8 +167,10 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
//读取未发送的临时消息 //读取未发送的临时消息
if (ActionHandlerStorage.getL(sessionId) != null) { if (ActionHandlerStorage.getL(sessionId) != null) {
if (messageFragment.getInputPanel().getInputContent() == null || messageFragment.getInputPanel().getInputContent().equals("")) { if (messageFragment.getInputPanel()==null||messageFragment.getInputPanel().getInputContent() == null || messageFragment.getInputPanel().getInputContent().equals("")) {
messageFragment.getInputPanel().setInputContent(ActionHandlerStorage.getL(sessionId).getImTempData(sessionId)); if (messageFragment.getInputPanel()!=null){
messageFragment.getInputPanel().setInputContent(ActionHandlerStorage.getL(sessionId).getImTempData(sessionId));
}
} }
if (ActionHandlerStorage.needLoadNewMsg) { if (ActionHandlerStorage.needLoadNewMsg) {
((BaseFetchLoadAdapter.RequestFetchMoreListener) messageFragment.getMessageListPanelEx().getMessageLoder(null)).onFetchMoreRequested(); ((BaseFetchLoadAdapter.RequestFetchMoreListener) messageFragment.getMessageListPanelEx().getMessageLoder(null)).onFetchMoreRequested();
......
...@@ -162,7 +162,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -162,7 +162,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private int rvPaddingTop; private int rvPaddingTop;
private RelativeLayout rl_contain; private RelativeLayout rl_contain;
private boolean initHeightFinish; private boolean initHeightFinish;
public TitleBarBottom titleBar;
public InputPanel getInputPanel() { public InputPanel getInputPanel() {
return inputPanel; return inputPanel;
} }
...@@ -208,8 +208,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -208,8 +208,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private LinearLayout ll_info_detail; private LinearLayout ll_info_detail;
protected RelativeLayout rela_zixun; protected RelativeLayout rela_zixun;
private LinearLayout team_over_end;
private RelativeLayout textMessageLayout;
private ValueAnimator anim_out; private ValueAnimator anim_out;
private ObjectAnimator sourceLayoutAnim; private ObjectAnimator sourceLayoutAnim;
private ValueAnimator anim_in; private ValueAnimator anim_in;
...@@ -256,70 +254,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -256,70 +254,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
parseIntent(); parseIntent();
TitleBarBottom titleBar = ((YDLBaseMessageActivity) getActivity()).getTitleBarBottom(); titleBar = ((YDLBaseMessageActivity) getActivity()).getTitleBarBottom();
titleBar.setTitleLeftDraw(getResources().getDrawable(R.drawable.loading_01)); titleBar.setTitleLeftDraw(getResources().getDrawable(R.drawable.loading_01));
titleBar.setTitle("正在连接中..."); titleBar.setTitle("正在连接中...");
if (sessionType==SessionTypeEnum.Team){ if (sessionType==SessionTypeEnum.Team){
titleBar.setRightIcon(getContext().getDrawable(R.drawable.platform_common_more)); titleBar.setRightIcon(getContext().getDrawable(R.drawable.platform_common_more));
} }
titleBar.setOnRightTextClick(new TitleBarBottom.OnTitleBarTextClick() {
@Override
public void onClick(View view, boolean isActive) {
List<String> list = new ArrayList<>();
// if (ImConstants.KEFUXIAOYI.equals(toChatUsername) || "4108805".equals(toChatUsername)) {
// list.add("历史聊天记录");
// list.add("客服热线");
// } else {
// list.add("投诉反馈");
//
// list.add("历史聊天记录");
// list.add("删除聊天记录");
// }
list.add("删除聊天记录");
ListDialog.Builder dialog = new ListDialog.Builder(getContext(), list, 0);
list.add("取消");
dialog.create().show();
dialog.SetOnItemClickLister(new ListDialog.Builder.OnItemClickLister() {
@Override
public void onItemClick(Dialog dialog, View view, int position) {
LogHelper.Companion.getInstance().writeLogSync(String.format("聊天界面:%s", list.get(position)));
switch (list.get(position)) {
case "投诉反馈":
ImIn.INSTANCE.feedBackIntent((Activity) getContext());
break;
case "返回首页":
ImIn.INSTANCE.mainIntent(getContext(), 0);
break;
case "客服热线":
// showCallDialog();
break;
case "历史聊天记录":
// historyMsg();
break;
case "删除聊天记录":
deleteChatHistory();
break;
case "ta的主页":
// showUserHome();
break;
case "取消":
break;
}
dialog.dismiss();
}
@Override
public void onItemLongClick(Dialog dialog, View view, int position) {
}
});
}
});
fl_container = rootView.findViewById(R.id.message_activity_list_view_container); fl_container = rootView.findViewById(R.id.message_activity_list_view_container);
v_chattips = rootView.findViewById(R.id.v_chattips); v_chattips = rootView.findViewById(R.id.v_chattips);
lin_actions = rootView.findViewById(R.id.lin_actions); lin_actions = rootView.findViewById(R.id.lin_actions);
...@@ -345,8 +286,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -345,8 +286,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
ll_info_detail = rootView.findViewById(R.id.ll_info_detail); ll_info_detail = rootView.findViewById(R.id.ll_info_detail);
tv_doctor_name = rootView.findViewById(R.id.tv_doctor_name); tv_doctor_name = rootView.findViewById(R.id.tv_doctor_name);
rl_contain = rootView.findViewById(R.id.rl_contain); rl_contain = rootView.findViewById(R.id.rl_contain);
team_over_end = rootView.findViewById(R.id.team_over_end);
textMessageLayout = rootView.findViewById(R.id.textMessageLayout);
messageListView.setItemAnimator(null); messageListView.setItemAnimator(null);
//和助理私聊时的常用语逻辑 //和助理私聊时的常用语逻辑
// rl_common_question_enter = rootView.findViewById(R.id.rl_common_question); // rl_common_question_enter = rootView.findViewById(R.id.rl_common_question);
...@@ -381,41 +320,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -381,41 +320,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (SessionTypeEnum.Team==sessionType){ if (SessionTypeEnum.Team==sessionType){
rela_zixun.setVisibility(View.GONE); rela_zixun.setVisibility(View.GONE);
titleBar.setTitleRightDraw(null); titleBar.setTitleRightDraw(null);
// textMessageLayout.setVisibility(View.GONE);
// team_over_end.setVisibility(View.VISIBLE);
} }
} }
/**
* 删除聊天记录
*/
private void deleteChatHistory() {
CommonDialog dialog = CommonDialog.create(getContext());
dialog.setMessage("确定删除与ta的聊天记录?");
dialog.setCancelAble(true);
dialog.setLeftOnclick("再考虑下", v -> dialog.dismiss());
dialog.setRightClick("立即删除", v -> {
LoadingDialogFragment loadingDialog = LoadingDialogFragment.Companion.newInstance("正在删除");
loadingDialog.show(((AppCompatActivity) getContext()).getSupportFragmentManager(), null);
RemoveHistory cmd = new RemoveHistory();
// cmd.toUid = getInfo().toUid;
cmd.type = 1;
Disposable disposable = ImRetrofitApi.Companion.getImRetrofitApi().rmHistory(NetworkParamsUtils.getMaps(cmd))
.subscribeOn(Schedulers.io())
.compose(RxUtils.INSTANCE.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(objectBaseResponse -> {
loadingDialog.hide();
ToastUtil.toastShort("聊天记录已删除");
NIMClient.getService(MsgService.class).clearChattingHistory(cmd.toUid, SessionTypeEnum.P2P);
MessageListPanelHelper.getInstance().notifyClearMessages(cmd.toUid);
}, throwable -> {
loadingDialog.hide();
HttpErrorUtils.Companion.handleError(getContext(), throwable);
});
});
dialog.show();
}
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void initView() { private void initView() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) { if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
...@@ -523,7 +430,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -523,7 +430,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
} }
/**
* 是否隐藏输入框相关控件
*/
public void setGoneInput(boolean isGone){
if (isGone){
inputPanel.messageInputBar.setVisibility(View.GONE);
inputPanel.hideInputMethod();
}else {
inputPanel.messageInputBar.setVisibility(View.VISIBLE);
}
}
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void initDefaultConfig() { private void initDefaultConfig() {
ServiceImpl.Companion.getInstance().getChatViewConfig() ServiceImpl.Companion.getInstance().getChatViewConfig()
......
package com.yidianling.uikit.business.session.fragment; package com.yidianling.uikit.business.session.fragment;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage; import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.netease.nimlib.sdk.team.TeamService;
import com.netease.nimlib.sdk.team.constant.TeamMemberType; import com.netease.nimlib.sdk.team.constant.TeamMemberType;
import com.netease.nimlib.sdk.team.model.Team; import com.netease.nimlib.sdk.team.model.Team;
import com.netease.nimlib.sdk.team.model.TeamMember; import com.netease.nimlib.sdk.team.model.TeamMember;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.ui.LoadingDialogFragment;
import com.ydl.ydlcommon.utils.NetworkParamsUtils;
import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ListDialog;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.bean.RemoveHistory;
import com.yidianling.im.event.ChatGroupStatusEvent;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.nimbase.impl.cache.TeamDataCache; import com.yidianling.nimbase.impl.cache.TeamDataCache;
import com.yidianling.uikit.api.NimUIKit; import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper;
import com.yidianling.uikit.custom.widget.TitleBarBottom;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/** /**
* Created by zhoujianghua on 2015/9/10. * Created by zhoujianghua on 2015/9/10.
*/ */
...@@ -22,6 +52,7 @@ public class YDLTeamMessageFragment extends YDLMessageFragment { ...@@ -22,6 +52,7 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
private Team team; private Team team;
@Override @Override
public boolean isAllowSendMessage(IMMessage message) { public boolean isAllowSendMessage(IMMessage message) {
TeamMember teamMember= TeamDataCache.getInstance().getTeamMember(team.getId(), NimUIKit.getAccount()); TeamMember teamMember= TeamDataCache.getInstance().getTeamMember(team.getId(), NimUIKit.getAccount());
...@@ -35,6 +66,11 @@ public class YDLTeamMessageFragment extends YDLMessageFragment { ...@@ -35,6 +66,11 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
return true; return true;
} }
@Override
public void onResume() {
super.onResume();
getChatGroupMute();
}
@Override @Override
public boolean sendMessage(IMMessage message) { public boolean sendMessage(IMMessage message) {
...@@ -51,8 +87,110 @@ public class YDLTeamMessageFragment extends YDLMessageFragment { ...@@ -51,8 +87,110 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
return super.sendMessage(message); return super.sendMessage(message);
} }
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
titleBar.setOnRightTextClick(new TitleBarBottom.OnTitleBarTextClick() {
@Override
public void onClick(View view, boolean isActive) {
List<String> list = new ArrayList<>();
// if (ImConstants.KEFUXIAOYI.equals(toChatUsername) || "4108805".equals(toChatUsername)) {
// list.add("历史聊天记录");
// list.add("客服热线");
// } else {
list.add("投诉反馈");
//
// list.add("历史聊天记录");
// list.add("删除聊天记录");
// }
list.add("删除聊天记录");
ListDialog.Builder dialog = new ListDialog.Builder(getContext(), list, 0);
list.add("取消");
dialog.create().show();
dialog.SetOnItemClickLister(new ListDialog.Builder.OnItemClickLister() {
@Override
public void onItemClick(Dialog dialog, View view, int position) {
LogHelper.Companion.getInstance().writeLogSync(String.format("聊天界面:%s", list.get(position)));
switch (list.get(position)) {
case "投诉反馈":
ImIn.INSTANCE.feedBackIntent((Activity) getContext());
break;
case "返回首页":
ImIn.INSTANCE.mainIntent(getContext(), 0);
break;
case "客服热线":
// showCallDialog();
break;
case "历史聊天记录":
// historyMsg();
break;
case "删除聊天记录":
deleteChatHistory();
break;
case "ta的主页":
// showUserHome();
break;
case "取消":
break;
}
dialog.dismiss();
}
@Override
public void onItemLongClick(Dialog dialog, View view, int position) {
}
});
}
});
}
public void onEventMainThread(ChatGroupStatusEvent event){
getChatGroupMute();
}
//获取群聊是否全员禁言
private void getChatGroupMute(){
boolean mute = NIMClient.getService(TeamService.class).queryTeamBlock(sessionId).isAllMute();
setGoneInput(mute);
}
public void setTeam(Team team) { public void setTeam(Team team) {
Log.e("hzs","-------------setTeam------------TeammessageFragment"); Log.e("hzs","-------------setTeam------------TeammessageFragment");
this.team = team; this.team = team;
} }
/**
* 删除聊天记录
*/
private void deleteChatHistory() {
CommonDialog dialog = CommonDialog.create(getContext());
dialog.setMessage("确定删除与ta的聊天记录?");
dialog.setCancelAble(true);
dialog.setLeftOnclick("再考虑下", v -> dialog.dismiss());
dialog.setRightClick("立即删除", v -> {
LoadingDialogFragment loadingDialog = LoadingDialogFragment.Companion.newInstance("正在删除");
loadingDialog.show(((AppCompatActivity) getContext()).getSupportFragmentManager(), null);
RemoveHistory cmd = new RemoveHistory();
cmd.toUid = team.getId();
cmd.type = 1;
Disposable disposable = ImRetrofitApi.Companion.getImRetrofitApi().rmHistory(NetworkParamsUtils.getMaps(cmd))
.subscribeOn(Schedulers.io())
.compose(RxUtils.INSTANCE.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(objectBaseResponse -> {
loadingDialog.hide();
ToastUtil.toastShort("聊天记录已删除");
NIMClient.getService(MsgService.class).clearChattingHistory(cmd.toUid, SessionTypeEnum.P2P);
MessageListPanelHelper.getInstance().notifyClearMessages(cmd.toUid);
}, throwable -> {
loadingDialog.hide();
HttpErrorUtils.Companion.handleError(getContext(), throwable);
});
});
dialog.show();
}
} }
\ No newline at end of file
...@@ -14,12 +14,15 @@ import com.netease.nimlib.sdk.team.model.MuteMemberAttachment; ...@@ -14,12 +14,15 @@ import com.netease.nimlib.sdk.team.model.MuteMemberAttachment;
import com.netease.nimlib.sdk.team.model.Team; import com.netease.nimlib.sdk.team.model.Team;
import com.netease.nimlib.sdk.team.model.UpdateTeamAttachment; import com.netease.nimlib.sdk.team.model.UpdateTeamAttachment;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.event.ChatGroupStatusEvent;
import com.yidianling.uikit.api.NimUIKit; import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.team.helper.TeamHelper; import com.yidianling.uikit.business.team.helper.TeamHelper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import de.greenrobot.event.EventBus;
/** /**
* 系统消息描述文本构造器。主要是将各个系统消息转换为显示的文本内容。<br> * 系统消息描述文本构造器。主要是将各个系统消息转换为显示的文本内容。<br>
* Created by huangjun on 2015/3/11. * Created by huangjun on 2015/3/11.
...@@ -199,8 +202,10 @@ public class TeamNotificationHelper { ...@@ -199,8 +202,10 @@ public class TeamNotificationHelper {
if (teamAllMuteModeEnum == TeamAllMuteModeEnum.Cancel) { if (teamAllMuteModeEnum == TeamAllMuteModeEnum.Cancel) {
sb.append("取消群全员禁言"); sb.append("取消群全员禁言");
} else { } else {
sb.append("群全员禁言"); sb.append("群聊已结束,如有问题请联系个案管理师");
} }
//发送通知告知群聊界面全员禁言或者取消全员禁言
EventBus.getDefault().post(new ChatGroupStatusEvent());
} else { } else {
sb.append("群" + field.getKey() + "被更新为 " + field.getValue()); sb.append("群" + field.getKey() + "被更新为 " + field.getValue());
} }
......
...@@ -103,7 +103,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba ...@@ -103,7 +103,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
protected View sendMessageButtonInInputBar; protected View sendMessageButtonInInputBar;
/***发送消息按钮*/ /***发送消息按钮*/
protected View emojiButtonInInputBar; protected View emojiButtonInInputBar;
protected View messageInputBar; public View messageInputBar;
protected View messageEditLL; protected View messageEditLL;
protected FrameLayout audioTextSwitchLayout; protected FrameLayout audioTextSwitchLayout;
...@@ -656,7 +656,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba ...@@ -656,7 +656,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
/** /**
* 隐藏键盘布局 * 隐藏键盘布局
*/ */
private void hideInputMethod() { public void hideInputMethod() {
isKeyboardShowed = false; isKeyboardShowed = false;
uiHandler.removeCallbacks(showTextRunnable); uiHandler.removeCallbacks(showTextRunnable);
InputMethodManager imm = (InputMethodManager) container.activity.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) container.activity.getSystemService(Context.INPUT_METHOD_SERVICE);
......
...@@ -2,6 +2,8 @@ package com.yidianling.uikit.business.session.viewholder; ...@@ -2,6 +2,8 @@ package com.yidianling.uikit.business.session.viewholder;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan; import android.text.style.ImageSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.yidianling.im.R; import com.yidianling.im.R;
...@@ -16,6 +18,7 @@ public class MsgViewHolderNotification extends MsgViewHolderBase { ...@@ -16,6 +18,7 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
} }
protected TextView notificationTextView; protected TextView notificationTextView;
protected ImageView ivLabel;
@Override @Override
protected int getContentResId() { protected int getContentResId() {
...@@ -25,6 +28,8 @@ public class MsgViewHolderNotification extends MsgViewHolderBase { ...@@ -25,6 +28,8 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
@Override @Override
protected void inflateContentView() { protected void inflateContentView() {
notificationTextView = (TextView) view.findViewById(R.id.message_item_notification_label); notificationTextView = (TextView) view.findViewById(R.id.message_item_notification_label);
ivLabel = view.findViewById(R.id.iv_label);
} }
@Override @Override
...@@ -39,6 +44,12 @@ public class MsgViewHolderNotification extends MsgViewHolderBase { ...@@ -39,6 +44,12 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
private void handleTextNotification(String text) { private void handleTextNotification(String text) {
MoonUtil.identifyFaceExpressionAndATags(context, notificationTextView, text, ImageSpan.ALIGN_BOTTOM); MoonUtil.identifyFaceExpressionAndATags(context, notificationTextView, text, ImageSpan.ALIGN_BOTTOM);
notificationTextView.setMovementMethod(LinkMovementMethod.getInstance()); notificationTextView.setMovementMethod(LinkMovementMethod.getInstance());
if (getDisplayText().contains("群聊已结束")){
ivLabel.setVisibility(View.VISIBLE);
}else {
ivLabel.setVisibility(View.GONE);
}
} }
@Override @Override
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:radius="@dimen/dp_4"/>
<solid android:color="#E7ECF0" />
</shape>
\ No newline at end of file
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/im_nim_message_activity_text_layout" /> <include layout="@layout/im_nim_message_activity_text_layout" />
<include layout="@layout/im_nim_message_activity_team_over_layout" />
<com.yidianling.nimbase.business.session.emoji.EmoticonPickerView <com.yidianling.nimbase.business.session.emoji.EmoticonPickerView
android:id="@+id/emoticon_picker_view" android:id="@+id/emoticon_picker_view"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_72"
tools:ignore="MissingDefaultResource"
android:gravity="center"
android:background="@drawable/im_background_team_over"
android:visibility="visible"
android:id="@+id/team_over_end"
android:layout_marginStart="@dimen/platform_dp_40"
android:layout_marginEnd="@dimen/platform_dp_40"
android:layout_marginBottom="@dimen/platform_dp_12"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="群聊已结束,如有问题请联系个案管理师"
android:textColor="#0c1d31"
android:textSize="@dimen/im_text_size_16"
>
</TextView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message_item_notification_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="7dip" android:orientation="horizontal"
android:layout_marginRight="7dip"
android:background="@drawable/im_nim_bg_message_tip" android:background="@drawable/im_nim_bg_message_tip"
android:gravity="center" android:gravity="center"
android:paddingLeft="7dip" android:paddingLeft="7dip"
android:paddingRight="7dip" android:paddingRight="7dip"
android:textColor="#ffffff" >
android:textSize="12sp"/>
</merge> <ImageView
android:id="@+id/iv_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:src="@drawable/ic_group_chat_end"
/>
<TextView
android:id="@+id/message_item_notification_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:includeFontPadding="false"
android:textColor="#ffffff"
android:textSize="12sp"/>
</LinearLayout>
</merge>
\ No newline at end of file
...@@ -607,7 +607,6 @@ ...@@ -607,7 +607,6 @@
android:layout_marginEnd="@dimen/platform_dp_12" android:layout_marginEnd="@dimen/platform_dp_12"
android:layout_marginBottom="@dimen/platform_dp_8" android:layout_marginBottom="@dimen/platform_dp_8"
> >
</TextView> </TextView>
<FrameLayout <FrameLayout
android:id="@+id/fl_question_content" android:id="@+id/fl_question_content"
...@@ -615,9 +614,6 @@ ...@@ -615,9 +614,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white"
android:visibility="gone" /> android:visibility="gone" />
<include <include
layout="@layout/im_nim_message_activity_bottom_layout" /> layout="@layout/im_nim_message_activity_bottom_layout" />
</LinearLayout> </LinearLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment