Commit 11c8adb3 by konghaorui

私聊列表点击条目接口后置 - 待发布

parent 12fece28
...@@ -20,8 +20,8 @@ import java.util.List; ...@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST; public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD; // public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
...@@ -61,6 +61,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderStatus; ...@@ -61,6 +61,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice; import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice;
import com.yidianling.im.session.extension.CustomRecommendExpertListMsg; import com.yidianling.im.session.extension.CustomRecommendExpertListMsg;
import com.yidianling.im.session.extension.CustomSystemTips; import com.yidianling.im.session.extension.CustomSystemTips;
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean;
import com.yidianling.im.ui.widget.ChatTeamHisDialog; import com.yidianling.im.ui.widget.ChatTeamHisDialog;
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper; import com.yidianling.uikit.business.session.helper.MessageListPanelHelper;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler; import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
...@@ -85,6 +86,7 @@ import io.reactivex.schedulers.Schedulers; ...@@ -85,6 +86,7 @@ import io.reactivex.schedulers.Schedulers;
*/ */
public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
private boolean notPrepared;
private String toChatUsername; private String toChatUsername;
private DocInfo docInfo = new DocInfo(); private DocInfo docInfo = new DocInfo();
private Activity mActivity; private Activity mActivity;
...@@ -141,7 +143,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { ...@@ -141,7 +143,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
if (expert.commentList != null) { if (expert.commentList != null) {
docInfo.commentList.addAll(expert.commentList); docInfo.commentList.addAll(expert.commentList);
} }
this.notPrepared = false;
} }
public P2PCustomActionHandlerImpl(String toChatUsername, public P2PCustomActionHandlerImpl(String toChatUsername,
...@@ -150,6 +152,17 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { ...@@ -150,6 +152,17 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
docInfo.toUid = toChatUsername; docInfo.toUid = toChatUsername;
docInfo.name = toName; docInfo.name = toName;
docInfo.cover = head; docInfo.cover = head;
this.notPrepared = false;
}
public P2PCustomActionHandlerImpl(ChatItemBean chatItemBean) {
this.toChatUsername = String.valueOf(chatItemBean.getToUid());
this.userType = chatItemBean.getUtype();
this.notPrepared = true;
docInfo.toUid = String.valueOf(chatItemBean.getToUid());
docInfo.name = chatItemBean.getTitle();
docInfo.cover = chatItemBean.getHead();
} }
//聊天室使用 //聊天室使用
...@@ -223,6 +236,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { ...@@ -223,6 +236,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
//发送专家推荐列表自定义消息 //发送专家推荐列表自定义消息
@Override @Override
public void sendRecommendExpertListMessage(String sessionId, ArrayList<RecommendExpertBean> recommendExpertList, int type, boolean showExpertList) { public void sendRecommendExpertListMessage(String sessionId, ArrayList<RecommendExpertBean> recommendExpertList, int type, boolean showExpertList) {
CustomRecommendExpertListMsg customRecommendExpertListMsg = new CustomRecommendExpertListMsg(recommendExpertList, type, showExpertList); CustomRecommendExpertListMsg customRecommendExpertListMsg = new CustomRecommendExpertListMsg(recommendExpertList, type, showExpertList);
IMMessage message = MessageBuilder.createCustomMessage(sessionId, SessionTypeEnum.P2P, customRecommendExpertListMsg); IMMessage message = MessageBuilder.createCustomMessage(sessionId, SessionTypeEnum.P2P, customRecommendExpertListMsg);
message.setStatus(MsgStatusEnum.success); message.setStatus(MsgStatusEnum.success);
...@@ -492,6 +506,11 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { ...@@ -492,6 +506,11 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
return docInfo == null ? new DocInfo() : docInfo; return docInfo == null ? new DocInfo() : docInfo;
} }
@Override
public Boolean isNotPrepare() {
return notPrepared;
}
@Override @Override
public boolean deleteMessage(IMMessage message) { public boolean deleteMessage(IMMessage message) {
......
package com.yidianling.im.helper
import android.annotation.SuppressLint
import android.content.Context
import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils.applySchedulers
import com.ydl.ydlcommon.data.http.UpLoadLogUtils.upLoadLog
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils.Companion.handleError
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.bean.GetExpert
import com.yidianling.im.bean.UserTypeBean
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import com.yidianling.im.config.constants.ImConstants
import com.yidianling.im.http.ImRetrofitApi.Companion.getImJavaApi
import com.yidianling.im.http.ImRetrofitApi.Companion.getImRetrofitApi
import com.yidianling.im.router.ImIn.isLogin
import com.yidianling.im.router.ImIn.loginWayIntent
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler
import com.yidianling.uikit.custom.http.ServiceImpl.Companion.instance
import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.widget.TitleBarBottom
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import retrofit2.HttpException
import java.net.URLEncoder
/**
* Created by Jim on 2017/12/13 0013.
* 聊天接口封装
*/
object IMChatUtil {
interface ChatDataRequestListener {
fun onSuccess()
}
// private var dialog: LoadingDialogFragment? = null
fun showSilencedDialog(
context: Context,
tips: String?,
url: String?
) {
CommonDialog.create(context)
.setMessage(tips)
.setCancelAble(false)
.setLeftOnclick(
context.getString(R.string.im_details)
) {
val realUrl =
if (TextUtils.isEmpty(url)) ImConstants.HELP_URL else url!!
val params = H5Params(realUrl, "")
NewH5Activity.start(context, params)
}
.setRightClick(context.getString(R.string.im_approval), null)
.show()
}
/**
* 私聊列表进入
*
* @param context
* @param chatItemBean
*/
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
@SuppressLint("CheckResult")
fun prepareChatData(
context: AppCompatActivity, toUid: String, listener: ChatDataRequestListener
) {
if (!isLogin(context, true)) {
return
}
// if (dialog == null) {
// dialog = newInstance(null)
// }
// if (context.supportFragmentManager != null && !context.isDestroyed) {
// dialog!!.show(context.supportFragmentManager, null)
// }
getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.chatEvent) { //和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache(
"chatEvent",
res.data!!.chatEvent
)
}
if (res.data!!.collectEvent) { //和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache(
"collectEvent",
res.data!!.collectEvent
)
}
if (TextUtils.equals(res.data!!.userType, "2")) {
//接口返回值是专家,java接口
prepareExpertChatData(context, toUid, res.data!!.userType, listener)
} else { //非专家 php接口
prepareAssistantChatData(context, toUid, res.data!!.userType, listener)
}
} else {
// if (dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
ToastUtil.toastShort(res.msg)
}
},
{ throwable: Throwable? ->
// if (dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
handleError(context, throwable!!)
}
)
}
/**
* 专家私聊
*/
fun prepareExpertChatData(
context: AppCompatActivity,
toUid: String?,
userType: String?,
listener: ChatDataRequestListener
) {
val disposable = getImJavaApi().getPersonalChat(toUid!!)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ resp: BaseResponse<IMExpertBuild> ->
// if (null != dialog && dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
if (resp.code == 200) {
val expert = resp.data
UserInfoCache.getInstance().saveYDLUser(
expert.shareData.toUid,
expert.shareData.doctorName,
expert.shareData.cover
)
val handler = P2PCustomActionHandlerImpl(toUid, expert)
handler.userType = userType!!.toInt()
ActionHandlerStorage.setL(toUid, handler)
listener.onSuccess()
} else {
upLoadLog("consult/get-expert", resp.code, resp.msg)
if (resp.code == ImConstants.HTTP_CODE_UNLOGIN) {
context.startActivity(loginWayIntent(context))
ToastUtil.toastShort(resp.msg)
} else if (resp.code == ImConstants.SILENCED_CODE) { //禁言
showSilencedDialog(
context,
resp.data.tips,
resp.data.url
)
} else {
ToastUtil.toastShort(resp.msg)
}
}
}
) { throwable: Throwable ->
// if (null != dialog && dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
handleError(context, throwable)
if (throwable is HttpException) {
upLoadLog(
"consult/get-expert",
throwable.code(),
throwable.message!!
)
}
}
}
/**
* 助理私聊
*/
fun prepareAssistantChatData(
context: AppCompatActivity,
toUid: String,
userType: String,
listener: ChatDataRequestListener
) {
val cmd =
GetExpert(toUid.toInt(), 0)
val disposable =
getImRetrofitApi().getExpert(NetworkParamsUtils.getMaps(cmd))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ resp: BaseResponse<IMExpertBuild> ->
// if (null != dialog && dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
if (resp.code == 0) {
val expert = resp.data
UserInfoCache.getInstance().saveYDLUser(
expert.shareData.toUid,
expert.shareData.doctorName,
expert.shareData.cover
)
val handler = P2PCustomActionHandlerImpl(toUid, expert)
handler.userType = userType.toInt()
ActionHandlerStorage.setL(toUid, handler)
listener?.onSuccess()
} else {
upLoadLog("consult/get-expert", resp.code, resp.msg)
if (resp.code == ImConstants.HTTP_CODE_UNLOGIN) {
context.startActivity(loginWayIntent(context))
ToastUtil.toastShort(resp.msg)
} else if (resp.code == ImConstants.SILENCED_CODE) { //禁言
showSilencedDialog(
context,
resp.data.tips,
resp.data.url
)
} else {
ToastUtil.toastShort(resp.msg)
}
}
}
) { throwable: Throwable ->
// if (null != dialog && dialog!!.isVisible) {
// dialog!!.dismissAllowingStateLoss()
// }
handleError(context, throwable)
if (throwable is HttpException) {
upLoadLog(
"consult/get-expert",
throwable.code(),
throwable.message!!
)
}
}
}
fun initChatOnlineState(tb: TitleBarBottom, context: Context, toUid: String) {
val actionHandler = ActionHandlerStorage.getL(toUid)
//获取私聊对方在线状态
if (null != actionHandler) {
val docInfo = actionHandler.info
if (null != docInfo && ("14" == docInfo.toUid || "4108805" == docInfo.toUid)) { //小壹客服 不显示是否在线
tb.setmMinTitleVisiable(View.GONE)
} else {
if (actionHandler.userType == 2) { // 专家
// 调取接口获取专家状态
val dis = instance
.getDoctorChatStatus(actionHandler.info.toUid.toLong())
.compose(
applySchedulers()
)
.subscribe(
{ chatStatusBean: BaseAPIResponse<ChatStatusBean> ->
if (actionHandler != null) {
val status = chatStatusBean.data.status
actionHandler.setDoctorStatus(status)
actionHandler
.setDoctorBusyNum(chatStatusBean.data.busyTotal)
//1.在线,2.离线,3.忙碌 4咨询中, 5倾述中 6咨询前准备
if (status == 2) { //离线
tb.setMinTitleText("离线")
tb.setMinTitleColor(context.getResources().getColor(R.color.platform_color_666666))
tb.setMinTitleDrawable(context.getResources().getDrawable(R.drawable.im_background_chat_top_status_off_line))
} else if (status == 4 || status == 5) { //服务中
tb.setMinTitleText("服务中")
tb.setMinTitleColor(context.getResources().getColor(R.color.platform_color_666666))
tb.setMinTitleDrawable(context.getResources().getDrawable(R.drawable.im_background_chat_top_status_online_server))
} else { //在线 1,3,6..
tb.setMinTitleText("在线")
tb.setMinTitleColor(context.getResources().getColor(R.color.platform_color_666666))
tb.setMinTitleDrawable(context.getResources().getDrawable(R.drawable.im_background_chat_top_status_online))
}
initSystemMessage(
chatStatusBean.data.promptRule,
status,
toUid,
actionHandler
)
}
}
) { throwable: Throwable ->
LogUtil.i("getDoctorChatStatus throwable:$throwable")
}
} else if (actionHandler.userType == 3) { // 助理
// 调取接口获取助理状态
instance.getAssistantChatStatus(
actionHandler.info.toUid.toLong()
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ res: BaseAPIResponse<Int> ->
if (actionHandler != null) {
if (res.data == 1) { //在线
tb.setMinTitleText("在线")
tb.setMinTitleColor(context.getResources().getColor(R.color.platform_color_666666))
tb.setMinTitleDrawable(context.getResources().getDrawable(R.drawable.im_background_chat_top_status_online))
} else { //离线
tb.setMinTitleText("离线")
tb.setMinTitleColor(context.getResources().getColor(R.color.platform_color_666666))
tb.setMinTitleDrawable(context.getResources().getDrawable(R.drawable.im_background_chat_top_status_off_line))
}
}
}
) { throwable: Throwable? -> }
} else {
tb.setmMinTitleVisiable(View.GONE)
}
}
}
}
// promptRule 判断是否推荐专家 4,5直接不走文本提示和推荐逻辑,1,3不走推荐逻辑
//初始化 根据专家在线状态来发送提示消息或者推荐消息
private fun initSystemMessage(
promptRule: Int,
status: Int,
toUid: String,
actionHandler: IP2PCustomActionHandler
) {
if (!(promptRule == 4 || promptRule == 5)) {
val showExpertList = !(promptRule == 1 || promptRule == 3)
if (actionHandler.userType == 2 && status == 2) { //当该专家离线时
sendRecommendExpertListMessage(1, showExpertList, toUid, actionHandler)
} else if (actionHandler.userType == 2 && status >= 3) { //当该专家忙碌时
sendRecommendExpertListMessage(2, showExpertList, toUid, actionHandler)
}
}
}
/**
* 发送推荐专家列表
*/
@SuppressLint("CheckResult")
fun sendRecommendExpertListMessage(
type: Int,
showExpertList: Boolean,
toUid: String,
actionHandler: IP2PCustomActionHandler
) { // 调取接口获取推荐专家列表
instance.getRecommendExpertList(
actionHandler.info.toUid.toLong(),
URLEncoder.encode(actionHandler.info.tag1),
3
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseAPIResponse<ArrayList<RecommendExpertBean>> ->
//发送推荐专家列表消息
actionHandler.sendRecommendExpertListMessage(
toUid,
res.data,
type,
showExpertList
)
},
{ throwable: Throwable ->
ToastUtil.toastShort(throwable.toString())
}
)
}
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import android.widget.TextView; ...@@ -9,6 +9,7 @@ import android.widget.TextView;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment; import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.utils.AnimUtils;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.bean.DoctorAssistantRespDtoBean; import com.yidianling.im.bean.DoctorAssistantRespDtoBean;
import com.yidianling.im.helper.IMUtil; import com.yidianling.im.helper.IMUtil;
...@@ -38,6 +39,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase { ...@@ -38,6 +39,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
private LinearLayout recommendLlScroll; private LinearLayout recommendLlScroll;
private TextView tv_outline_left; private TextView tv_outline_left;
private TextView tv_outline_right; private TextView tv_outline_right;
private LinearLayout ll_recommend_expert;
private HorizontalScrollView recommend_ll_scroll_view; private HorizontalScrollView recommend_ll_scroll_view;
private TextView recommend_ll_scroll_view_top_text; private TextView recommend_ll_scroll_view_top_text;
...@@ -53,6 +55,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase { ...@@ -53,6 +55,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
@Override @Override
protected void inflateContentView() { protected void inflateContentView() {
recommend_ll_scroll_view = view.findViewById(R.id.recommend_ll_scroll_view); recommend_ll_scroll_view = view.findViewById(R.id.recommend_ll_scroll_view);
ll_recommend_expert = view.findViewById(R.id.ll_recommend_expert);
recommend_ll_scroll_view_top_text = view.findViewById(R.id.recommend_ll_scroll_view_top_text); recommend_ll_scroll_view_top_text = view.findViewById(R.id.recommend_ll_scroll_view_top_text);
recommendLlScroll = view.findViewById(R.id.recommend_ll_scroll); recommendLlScroll = view.findViewById(R.id.recommend_ll_scroll);
tv_outline_left = view.findViewById(R.id.tv_outline_left); tv_outline_left = view.findViewById(R.id.tv_outline_left);
...@@ -146,6 +149,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase { ...@@ -146,6 +149,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
} }
hideHead(); hideHead();
hideItemBg(); hideItemBg();
AnimUtils.Companion.slideToUp(ll_recommend_expert);
} }
@Override @Override
......
...@@ -15,14 +15,14 @@ import com.ydl.ydlcommon.data.http.RxUtils ...@@ -15,14 +15,14 @@ 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.im.api.param.RmHistoryParam
import com.yidianling.im.api.param.RmTalkParam
import com.yidianling.im.api.param.TopMessageParam
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import com.yidianling.im.event.UpdateTabUnreadNumEvent import com.yidianling.im.event.UpdateTabUnreadNumEvent
import com.yidianling.im.helper.IMUtil 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.api.param.RmHistoryParam
import com.yidianling.im.api.param.RmTalkParam
import com.yidianling.im.api.param.TopMessageParam
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.view.ChatItemView import com.yidianling.im.ui.page.fragment.view.ChatItemView
...@@ -62,7 +62,8 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea ...@@ -62,7 +62,8 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
SessionHelper.startP2PSession(context, -1, "4108805", null, SessionHelper.startP2PSession(context, -1, "4108805", null,
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)
IMChatUtil.startChat(context as AppCompatActivity, mList[position])
} }
} }
......
...@@ -8,7 +8,7 @@ class ChatItemBean( ...@@ -8,7 +8,7 @@ class ChatItemBean(
var unReadNum: Int = 0, var unReadNum: Int = 0,
var chat_type: Int = 1,//1私聊 2群聊 var chat_type: Int = 1,//1私聊 2群聊
var content: String = "", var content: String = "",
var doctor_id: Int = 0,//专家id var doctorId: Int = 0,//专家id
var ds: Int = 0, //倾诉业务状态 var ds: Int = 0, //倾诉业务状态
var head: String = "", var head: String = "",
var is_read: Int = 0,//是否已读:1未读;2已读 var is_read: Int = 0,//是否已读:1未读;2已读
......
...@@ -11,9 +11,6 @@ import android.widget.ImageView; ...@@ -11,9 +11,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.nimbase.api.model.session.SessionCustomization; import com.yidianling.nimbase.api.model.session.SessionCustomization;
import com.yidianling.nimbase.business.preference.UserPreferences; import com.yidianling.nimbase.business.preference.UserPreferences;
...@@ -23,16 +20,10 @@ import com.yidianling.nimbase.common.util.sys.ScreenUtil; ...@@ -23,16 +20,10 @@ import com.yidianling.nimbase.common.util.sys.ScreenUtil;
import com.yidianling.uikit.business.session.fragment.YDLMessageFragment; import com.yidianling.uikit.business.session.fragment.YDLMessageFragment;
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage; import com.yidianling.uikit.custom.bridge.ActionHandlerStorage;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler; import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import com.yidianling.uikit.custom.widget.TitleBarBottom; import com.yidianling.uikit.custom.widget.TitleBarBottom;
import java.net.URLEncoder;
import java.util.List; import java.util.List;
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.
*/ */
...@@ -126,132 +117,15 @@ public abstract class YDLBaseMessageActivity extends UI { ...@@ -126,132 +117,15 @@ public abstract class YDLBaseMessageActivity extends UI {
if (ActionHandlerStorage.getL(sessionId) != null) { if (ActionHandlerStorage.getL(sessionId) != null) {
ActionHandlerStorage.getL(sessionId).setmActivity(this); ActionHandlerStorage.getL(sessionId).setmActivity(this);
} }
if (!UserPreferences.isEarPhoneModeEnable()) { if (!UserPreferences.isEarPhoneModeEnable()) {
tb.setTitleRightDraw(null); tb.setTitleRightDraw(null);
} else { } else {
tb.setTitleRightDraw(getResources().getDrawable(R.drawable.im_erduoxiaolv)); tb.setTitleRightDraw(getResources().getDrawable(R.drawable.im_erduoxiaolv));
} }
IP2PCustomActionHandler actionHandler = ActionHandlerStorage.getL(sessionId);
//获取私聊对方在线状态
if (null != actionHandler) {
IP2PCustomActionHandler.DocInfo docInfo = actionHandler.getInfo();
if (null != docInfo && ("14".equals(docInfo.toUid) || "4108805".equals(docInfo.toUid))) {
//小壹客服 不显示是否在线
tb.setmMinTitleVisiable(View.GONE);
} else {
if (ActionHandlerStorage.getL(sessionId).getUserType() == 2) {
// 专家
// 调取接口获取专家状态
Disposable dis = ServiceImpl.Companion.getInstance()
.getDoctorChatStatus(Long.parseLong(ActionHandlerStorage.getL(sessionId).getInfo().toUid))
.compose(RxUtils.applySchedulers())
.subscribe(chatStatusBean -> {
if (ActionHandlerStorage.getL(sessionId) != null) {
int status = chatStatusBean.data.getStatus();
ActionHandlerStorage.getL(sessionId).setDoctorStatus(status);
ActionHandlerStorage.getL(sessionId).setDoctorBusyNum(chatStatusBean.data.getBusyTotal());
//1.在线,2.离线,3.忙碌 4咨询中, 5倾述中 6咨询前准备
if (status == 2) {
//离线
tb.setMinTitleText("离线");
tb.setMinTitleColor(getResources().getColor(R.color.platform_color_666666));
tb.setMinTitleDrawable(getResources().getDrawable(R.drawable.im_background_chat_top_status_off_line));
} else if (status == 4 || status == 5) {
//服务中
tb.setMinTitleText("服务中");
tb.setMinTitleColor(getResources().getColor(R.color.platform_color_666666));
tb.setMinTitleDrawable(getResources().getDrawable(R.drawable.im_background_chat_top_status_online_server));
} else {
//在线 1,3,6..
tb.setMinTitleText("在线");
tb.setMinTitleColor(getResources().getColor(R.color.platform_color_666666));
tb.setMinTitleDrawable(getResources().getDrawable(R.drawable.im_background_chat_top_status_online));
}
initSystemMessage(chatStatusBean.data.getPromptRule(), status);
}
}, throwable -> {
LogUtil.i("getDoctorChatStatus throwable:"+throwable);
});
} else if (ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
// 助理
// 调取接口获取助理状态
ServiceImpl.Companion.getInstance().getAssistantChatStatus(Long.parseLong(ActionHandlerStorage.getL(sessionId).getInfo().toUid))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (ActionHandlerStorage.getL(sessionId) != null) {
if (res.data == 1) {
//在线
tb.setMinTitleText("在线");
tb.setMinTitleColor(getResources().getColor(R.color.platform_color_666666));
tb.setMinTitleDrawable(getResources().getDrawable(R.drawable.im_background_chat_top_status_online));
} else {
//离线
tb.setMinTitleText("离线");
tb.setMinTitleColor(getResources().getColor(R.color.platform_color_666666));
tb.setMinTitleDrawable(getResources().getDrawable(R.drawable.im_background_chat_top_status_off_line));
}
}
}, throwable -> {
});
} else {
tb.setmMinTitleVisiable(View.GONE);
}
}
}
if (customization != null) { if (customization != null) {
addRightCustomViewOnActionBar(this, customization.buttons); addRightCustomViewOnActionBar(this, customization.buttons);
} }
} }
// promptRule 判断是否推荐专家 4,5直接不走文本提示和推荐逻辑,1,3不走推荐逻辑
//初始化 根据专家在线状态来发送提示消息或者推荐消息
private void initSystemMessage(int promptRule, int status) {
if (!(promptRule == 4 || promptRule == 5)) {
boolean showExpertList = !(promptRule == 1 || promptRule == 3);
if (ActionHandlerStorage.getL(sessionId).getUserType() == 2 && status == 2) {
//当该专家离线时
sendRecommendExpertListMessage(1, showExpertList);
} else if (ActionHandlerStorage.getL(sessionId).getUserType() == 2 && status >= 3) {
//当该专家忙碌时
sendRecommendExpertListMessage(2, showExpertList);
}
}
}
/**
* 发送推荐专家列表
*/
@SuppressLint("CheckResult")
public void sendRecommendExpertListMessage(int type, boolean showExpertList) {
// 调取接口获取推荐专家列表
ServiceImpl.Companion.getInstance().getRecommendExpertList(
Long.parseLong(ActionHandlerStorage.getL(sessionId).getInfo().toUid),
URLEncoder.encode(ActionHandlerStorage.getL(sessionId).getInfo().tag1),
3)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
//发送推荐专家列表消息
if (ActionHandlerStorage.getL(sessionId) != null) {
ActionHandlerStorage.getL(sessionId).sendRecommendExpertListMessage(sessionId, res.data, type, showExpertList);
}
}, throwable -> {
ToastUtil.toastShort(throwable.toString());
});
}
// 添加action bar的右侧按钮及响应事件 // 添加action bar的右侧按钮及响应事件
private void addRightCustomViewOnActionBar(Activity activity, List<SessionCustomization.OptionsButton> buttons) { private void addRightCustomViewOnActionBar(Activity activity, List<SessionCustomization.OptionsButton> buttons) {
if (buttons == null || buttons.size() == 0) { if (buttons == null || buttons.size() == 0) {
......
...@@ -11,12 +11,14 @@ import android.os.Bundle; ...@@ -11,12 +11,14 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.constraint.ConstraintLayout; import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
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.view.ViewTreeObserver;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -42,6 +44,7 @@ import com.ydl.webview.H5Params; ...@@ -42,6 +44,7 @@ import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.modular.ModularServiceManager; import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.utils.AnimUtils;
import com.ydl.ydlcommon.utils.LogUtil; import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.SharedPreferencesEditor; import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil; import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
...@@ -51,6 +54,7 @@ import com.ydl.ydlcommon.view.CircleImageView; ...@@ -51,6 +54,7 @@ import com.ydl.ydlcommon.view.CircleImageView;
import com.ydl.ydlcommon.view.dialog.CommonDialog; import com.ydl.ydlcommon.view.dialog.CommonDialog;
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.helper.IMChatUtil;
import com.yidianling.im.router.ImIn; import com.yidianling.im.router.ImIn;
import com.yidianling.nimbase.api.UIKitOptions; import com.yidianling.nimbase.api.UIKitOptions;
import com.yidianling.nimbase.api.model.main.CustomPushContentProvider; import com.yidianling.nimbase.api.model.main.CustomPushContentProvider;
...@@ -64,6 +68,7 @@ import com.yidianling.nimbase.common.fragment.TFragment; ...@@ -64,6 +68,7 @@ import com.yidianling.nimbase.common.fragment.TFragment;
import com.yidianling.nimbase.impl.cache.NimUserInfoCache; import com.yidianling.nimbase.impl.cache.NimUserInfoCache;
import com.yidianling.uikit.api.NimUIKitImpl; import com.yidianling.uikit.api.NimUIKitImpl;
import com.yidianling.uikit.business.ait.AitManager; import com.yidianling.uikit.business.ait.AitManager;
import com.yidianling.uikit.business.session.activity.YDLBaseMessageActivity;
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper; import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import com.yidianling.uikit.business.session.module.input.InputPanel; import com.yidianling.uikit.business.session.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx; import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
...@@ -80,6 +85,7 @@ import com.yidianling.uikit.custom.http.response.SubmitUserInfoBean; ...@@ -80,6 +85,7 @@ import com.yidianling.uikit.custom.http.response.SubmitUserInfoBean;
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean; import com.yidianling.uikit.custom.http.response.UserQuestInfoBean;
import com.yidianling.uikit.custom.widget.ConfideOrderInfoView; import com.yidianling.uikit.custom.widget.ConfideOrderInfoView;
import com.yidianling.uikit.custom.widget.ExpertInfoDialog; import com.yidianling.uikit.custom.widget.ExpertInfoDialog;
import com.yidianling.uikit.custom.widget.TitleBarBottom;
import com.yidianling.uikit.custom.widget.expertConsultService.view.ExpertConsultServiceListDialog; import com.yidianling.uikit.custom.widget.expertConsultService.view.ExpertConsultServiceListDialog;
import com.yidianling.user.api.service.IUserService; import com.yidianling.user.api.service.IUserService;
...@@ -122,6 +128,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -122,6 +128,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private ChatPrivateTips v_chattips; private ChatPrivateTips v_chattips;
// modules // modules
protected InputPanel inputPanel; protected InputPanel inputPanel;
private int rvPaddingTop;
private RelativeLayout rl_contain;
private boolean initHeightFinish;
public InputPanel getInputPanel() { public InputPanel getInputPanel() {
return inputPanel; return inputPanel;
...@@ -165,7 +174,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -165,7 +174,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private TextView tv_doctor_name; private TextView tv_doctor_name;
private LinearLayout top_view_container; private LinearLayout top_view_container;
private LinearLayout constraint_ll; private RelativeLayout constraint_ll;
private LinearLayout ll_info_detail; private LinearLayout ll_info_detail;
private RelativeLayout rela_zixun; private RelativeLayout rela_zixun;
...@@ -229,12 +238,29 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -229,12 +238,29 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
tv_from = rootView.findViewById(R.id.tv_from); tv_from = rootView.findViewById(R.id.tv_from);
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_common_question_enter = rootView.findViewById(R.id.rl_common_question); rl_common_question_enter = rootView.findViewById(R.id.rl_common_question);
fl_question_content = rootView.findViewById(R.id.fl_question_content); fl_question_content = rootView.findViewById(R.id.fl_question_content);
rl_common_question_enter.setVisibility(ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3 ? View.VISIBLE : View.GONE); rl_common_question_enter.setVisibility(ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3 ? View.VISIBLE : View.GONE);
if(ActionHandlerStorage.getL(sessionId).getUserType()!=2) {
if (null != getActivity() && null != rela_zixun) {
rela_zixun.setVisibility(View.GONE);
}
}
if(ActionHandlerStorage.getL(sessionId).isNotPrepare()) {
IMChatUtil.INSTANCE.prepareChatData((AppCompatActivity) getActivity(),sessionId, () -> {
initView();
});
}else {
initView();
}
}
private void initView() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) { if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
rl_common_question_enter.setOnClickListener(v -> { rl_common_question_enter.setOnClickListener(v -> {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) { if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
...@@ -295,15 +321,29 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -295,15 +321,29 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
} }
//有未完成订单或者有未评价订单时,显示订单布局
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (ActionHandlerStorage.getL(sessionId).getInfo().hasAvailableListenOrder == 2 || ActionHandlerStorage.getL(sessionId).getInfo().listenOrderCommentStatus == 1) {
ConfideOrderInfoView confideOrderInfoView = new ConfideOrderInfoView(getContext(), sessionId);
confideOrderInfoView.setData(ActionHandlerStorage.getL(sessionId).getInfo());
rl_contain.addView(confideOrderInfoView);
AnimUtils.Companion.slideToDown(rl_contain);
}
}
// 初始化顶部专家信息栏 // 初始化顶部专家信息栏
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 2) { if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 2) {
top_expert_info_cl.setVisibility(View.VISIBLE); top_expert_info_cl.setVisibility(View.VISIBLE);
AnimUtils.Companion.slideToDown(top_expert_info_cl);
initTopCustomBar(); initTopCustomBar();
comment_banner_view_ll.setVisibility(View.VISIBLE); comment_banner_view_ll.setVisibility(View.VISIBLE);
AnimUtils.Companion.slideToDown(comment_banner_view_ll);
initCommentBanner(); initCommentBanner();
initAnimation(); // 初始化顶部布局的动画 initAnimation(); // 初始化顶部布局的动画
initTopViewHeight(); //设置顶部专家信息栏高度 initTopViewHeight(); //设置顶部专家信息栏高度
addScrollListener(); addScrollListener();
TitleBarBottom titleBar = ((YDLBaseMessageActivity) getActivity()).getTitleBarBottom();
IMChatUtil.INSTANCE.initChatOnlineState(titleBar,getContext(),sessionId);
} }
if (ActionHandlerStorage.getL(sessionId) != null) { if (ActionHandlerStorage.getL(sessionId) != null) {
...@@ -312,6 +352,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -312,6 +352,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (type == 2 && sType == 1) { if (type == 2 && sType == 1) {
lin_actions.setVisibility(View.VISIBLE); lin_actions.setVisibility(View.VISIBLE);
ll_actions_yi.setVisibility(View.GONE); ll_actions_yi.setVisibility(View.GONE);
AnimUtils.Companion.slideToDown(lin_actions);
initMenu(); initMenu();
} else if (type == -1 && sType == 1) { } else if (type == -1 && sType == 1) {
ll_actions_yi.setVisibility(View.VISIBLE); ll_actions_yi.setVisibility(View.VISIBLE);
...@@ -332,17 +373,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -332,17 +373,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
Log.e("hzs", "接收到消息状态变化-------MessageFragment"); Log.e("hzs", "接收到消息状态变化-------MessageFragment");
}, true); }, true);
RelativeLayout rl_contain = rootView.findViewById(R.id.rl_contain);
//有未完成订单或者有未评价订单时,显示订单布局
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (ActionHandlerStorage.getL(sessionId).getInfo().hasAvailableListenOrder == 2 || ActionHandlerStorage.getL(sessionId).getInfo().listenOrderCommentStatus == 1) {
ConfideOrderInfoView confideOrderInfoView = new ConfideOrderInfoView(getContext(), sessionId);
confideOrderInfoView.setData(ActionHandlerStorage.getL(sessionId).getInfo());
rl_contain.addView(confideOrderInfoView);
}
}
//判断是否需要发送自定义消息 //判断是否需要发送自定义消息
if (isFirst && ActionHandlerStorage.getL(sessionId) != null) { if (isFirst && ActionHandlerStorage.getL(sessionId) != null) {
isFirst = false; isFirst = false;
...@@ -470,7 +500,42 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -470,7 +500,42 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
private void initTopViewHeight() { private void initTopViewHeight() {
top_expert_info_ll.getViewTreeObserver().addOnGlobalLayoutListener(() -> expertInfoViewHeight = top_expert_info_ll.getHeight()); rl_contain.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if(initHeightFinish) {
rvPaddingTop+=rl_contain.getHeight();
messageListView.setPadding(0,rvPaddingTop,0,0);
}else {
rvPaddingTop+=rl_contain.getHeight();
}
initHeightFinish = true;
rl_contain.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
top_expert_info_ll.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
expertInfoViewHeight = top_expert_info_ll.getHeight();
if(messageListPanel.linearLayoutManager.findLastVisibleItemPosition()==0) {
initHeightFinish = true;
//如果页面未充满时,设置padding会出现覆盖问题,必须设置margin才可以
messageListView.setPadding(0,rvPaddingTop,0,0);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) messageListView.getLayoutParams();
layoutParams.topMargin = expertInfoViewHeight;
messageListView.setLayoutParams(layoutParams);
} else {
if(initHeightFinish) {
rvPaddingTop+=expertInfoViewHeight;
messageListView.setPadding(0,rvPaddingTop,0,0);
}else {
rvPaddingTop+=expertInfoViewHeight;
}
}
initHeightFinish = true;
top_expert_info_ll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
} }
......
...@@ -124,6 +124,7 @@ public class MessageListPanelEx { ...@@ -124,6 +124,7 @@ public class MessageListPanelEx {
//onPause时语音消息是否停止播放 //onPause时语音消息是否停止播放
public static boolean audioIsStop = true; public static boolean audioIsStop = true;
public LinearLayoutManager linearLayoutManager;
public MessageListPanelEx(Container container, View rootView, boolean recordOnly, boolean remote) { public MessageListPanelEx(Container container, View rootView, boolean recordOnly, boolean remote) {
this(container, rootView, null, recordOnly, remote); this(container, rootView, null, recordOnly, remote);
...@@ -186,7 +187,8 @@ public class MessageListPanelEx { ...@@ -186,7 +187,8 @@ public class MessageListPanelEx {
// RecyclerView // RecyclerView
messageListView = rootView.findViewById(R.id.messageListView); messageListView = rootView.findViewById(R.id.messageListView);
messageListView.setLayoutManager(new LinearLayoutManager(container.activity)); linearLayoutManager = new LinearLayoutManager(container.activity);
messageListView.setLayoutManager(linearLayoutManager);
messageListView.requestDisallowInterceptTouchEvent(true); messageListView.requestDisallowInterceptTouchEvent(true);
messageListView.addOnScrollListener(new RecyclerView.OnScrollListener() { messageListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
......
...@@ -19,6 +19,8 @@ public interface IP2PCustomActionHandler { ...@@ -19,6 +19,8 @@ public interface IP2PCustomActionHandler {
DocInfo getInfo(); DocInfo getInfo();
Boolean isNotPrepare();
boolean deleteMessage(IMMessage message); //需要筛选的消息 boolean deleteMessage(IMMessage message); //需要筛选的消息
void setDoctorStatus(int status); //更新专家登录状态 void setDoctorStatus(int status); //更新专家登录状态
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:id="@+id/ll_recommend_expert"
android:gravity="center_horizontal"> android:gravity="center_horizontal">
<LinearLayout <LinearLayout
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:hint="隐私保密,安心咨询"
android:layout_weight="1" android:layout_weight="1"
android:autoLink="all" android:autoLink="all"
android:background="#ffffff" android:background="#ffffff"
......
...@@ -18,18 +18,87 @@ ...@@ -18,18 +18,87 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<LinearLayout <RelativeLayout
android:id="@+id/constraint_ll" android:id="@+id/constraint_ll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/messageListView"
style="@style/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="@android:color/transparent"
android:divider="@null"
android:fadingEdge="none"
android:listSelector="@android:color/transparent"
android:scrollbars="vertical" />
<!--和助理聊天时,显示关联的咨询师的信息-->
<RelativeLayout
android:id="@+id/rl_doctor_name"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/ll_info_detail"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_toRightOf="@+id/view_empty"
android:background="@drawable/im_background_chat_assistant_to_doctor_name"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingRight="12dp">
<TextView
android:id="@+id/tv_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingRight="3dp"
android:text="来自"
android:textColor="@color/platform_color_242424"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_doctor_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/platform_main_theme"
android:textSize="12sp"
tools:text="雷水寿" />
</LinearLayout>
<View
android:id="@+id/view_empty"
android:layout_width="12dp"
android:layout_height="34dp"
android:background="@color/white" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/top_view_container" android:id="@+id/top_view_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone">
<!-- 专家信息 --> <!-- 专家信息 -->
<LinearLayout <LinearLayout
android:id="@+id/top_expert_info_ll" android:id="@+id/top_expert_info_ll"
...@@ -43,7 +112,8 @@ ...@@ -43,7 +112,8 @@
android:layout_height="56dp" android:layout_height="56dp"
android:background="@color/im_white" android:background="@color/im_white"
android:paddingLeft="@dimen/platform_dp_10" android:paddingLeft="@dimen/platform_dp_10"
android:visibility="gone"> android:visibility="gone"
tools:visibility="visible">
<com.ydl.ydlcommon.view.CircleImageView <com.ydl.ydlcommon.view.CircleImageView
android:id="@+id/small_head_img" android:id="@+id/small_head_img"
...@@ -154,8 +224,8 @@ ...@@ -154,8 +224,8 @@
android:id="@+id/good_num_icons" android:id="@+id/good_num_icons"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="11dp" android:layout_height="11dp"
android:layout_marginBottom="1.5dp" android:layout_alignParentBottom="true"
android:layout_alignParentBottom="true" /> android:layout_marginBottom="1.5dp" />
<ImageView <ImageView
android:layout_width="10dp" android:layout_width="10dp"
...@@ -248,9 +318,9 @@ ...@@ -248,9 +318,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:lines="1" android:lines="1"
android:text="评价"
android:textColor="@color/platform_main_theme" android:textColor="@color/platform_main_theme"
android:textSize="12dp" android:textSize="12dp" />
android:text="评价" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -258,9 +328,9 @@ ...@@ -258,9 +328,9 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:lines="1" android:lines="1"
android:text="("
android:textColor="@color/platform_main_theme" android:textColor="@color/platform_main_theme"
android:textSize="12dp" android:textSize="12dp" />
android:text="(" />
<TextView <TextView
android:id="@+id/tv_all_comment_desc" android:id="@+id/tv_all_comment_desc"
...@@ -276,11 +346,11 @@ ...@@ -276,11 +346,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:lines="1" android:lines="1"
android:text=")"
android:textColor="@color/platform_main_theme" android:textColor="@color/platform_main_theme"
android:textSize="12dp" android:textSize="12dp" />
android:layout_marginBottom="1dp"
android:text=")" />
<ImageView <ImageView
android:id="@+id/tv_all_comment_go" android:id="@+id/tv_all_comment_go"
...@@ -392,30 +462,13 @@ ...@@ -392,30 +462,13 @@
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 未支付订单提醒等 --> <!-- 未支付订单提醒等 -->
<RelativeLayout <RelativeLayout
android:id="@+id/rl_contain" android:id="@+id/rl_contain"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/top_view_container"
tools:layout_height="50dp" /> tools:layout_height="50dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/messageListView"
style="@style/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/rl_contain"
android:cacheColorHint="@android:color/transparent"
android:divider="@null"
android:fadingEdge="none"
android:listSelector="@android:color/transparent"
android:scrollbars="vertical" />
<!--右边的两个快捷回复按钮--> <!--右边的两个快捷回复按钮-->
<RelativeLayout <RelativeLayout
android:id="@+id/lin_actions" android:id="@+id/lin_actions"
...@@ -451,61 +504,8 @@ ...@@ -451,61 +504,8 @@
</RelativeLayout> </RelativeLayout>
<!--和助理聊天时,显示关联的咨询师的信息-->
<RelativeLayout
android:id="@+id/rl_doctor_name"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/ll_info_detail"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_toRightOf="@+id/view_empty"
android:background="@drawable/im_background_chat_assistant_to_doctor_name"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingRight="12dp">
<TextView
android:id="@+id/tv_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingRight="3dp"
android:text="来自"
android:textColor="@color/platform_color_242424"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_doctor_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/platform_main_theme"
android:textSize="12sp"
tools:text="雷水寿" />
</LinearLayout>
<View
android:id="@+id/view_empty"
android:layout_width="12dp"
android:layout_height="34dp"
android:background="@color/white" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout>
</LinearLayout>
<FrameLayout <FrameLayout
android:id="@+id/layoutPlayAudio" android:id="@+id/layoutPlayAudio"
android:layout_width="128dp" android:layout_width="128dp"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<gradient <gradient
android:angle="180" android:angle="180"
android:startColor="@color/user_main_theme_66" android:startColor="@color/platform_main_gradient_start_color_un"
android:endColor="@color/user_main_theme_66"/> android:endColor="@color/platform_main_gradient_end_color_un"/>
</shape> </shape>
\ No newline at end of file
package com.ydl.ydlcommon.utils package com.ydl.ydlcommon.utils
import android.view.View import android.view.View
import android.view.animation.AccelerateInterpolator
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.TranslateAnimation import android.view.animation.TranslateAnimation
/** /**
* @author yuanWai * @author yuanWai
* @描述: * @描述:
...@@ -13,10 +15,12 @@ import android.view.animation.TranslateAnimation ...@@ -13,10 +15,12 @@ import android.view.animation.TranslateAnimation
*/ */
class AnimUtils { class AnimUtils {
companion object { companion object {
fun slideToUp(view : View){ fun slideToUp(view: View) {
val slide = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, val slide = TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
1.0f, Animation.RELATIVE_TO_SELF, 0.0f) 1.0f, Animation.RELATIVE_TO_SELF, 0.0f
)
slide.duration = 400 slide.duration = 400
slide.fillAfter = true slide.fillAfter = true
slide.isFillEnabled = true slide.isFillEnabled = true
...@@ -35,5 +39,18 @@ class AnimUtils { ...@@ -35,5 +39,18 @@ class AnimUtils {
} }
}) })
} }
fun slideToDown(view: View?) {
val animation = TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0F, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0F
)
animation.duration = 400
animation.repeatMode = Animation.REVERSE
animation.interpolator = AccelerateInterpolator()
animation.fillAfter = true
view?.startAnimation(animation)
}
} }
} }
\ No newline at end of file
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