Commit 11c8adb3 by konghaorui

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

parent 12fece28
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -61,6 +61,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice;
import com.yidianling.im.session.extension.CustomRecommendExpertListMsg;
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.uikit.business.session.helper.MessageListPanelHelper;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
......@@ -85,6 +86,7 @@ import io.reactivex.schedulers.Schedulers;
*/
public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
private boolean notPrepared;
private String toChatUsername;
private DocInfo docInfo = new DocInfo();
private Activity mActivity;
......@@ -141,7 +143,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
if (expert.commentList != null) {
docInfo.commentList.addAll(expert.commentList);
}
this.notPrepared = false;
}
public P2PCustomActionHandlerImpl(String toChatUsername,
......@@ -150,6 +152,17 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
docInfo.toUid = toChatUsername;
docInfo.name = toName;
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 {
//发送专家推荐列表自定义消息
@Override
public void sendRecommendExpertListMessage(String sessionId, ArrayList<RecommendExpertBean> recommendExpertList, int type, boolean showExpertList) {
CustomRecommendExpertListMsg customRecommendExpertListMsg = new CustomRecommendExpertListMsg(recommendExpertList, type, showExpertList);
IMMessage message = MessageBuilder.createCustomMessage(sessionId, SessionTypeEnum.P2P, customRecommendExpertListMsg);
message.setStatus(MsgStatusEnum.success);
......@@ -492,6 +506,11 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
return docInfo == null ? new DocInfo() : docInfo;
}
@Override
public Boolean isNotPrepare() {
return notPrepared;
}
@Override
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;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.utils.AnimUtils;
import com.yidianling.im.R;
import com.yidianling.im.bean.DoctorAssistantRespDtoBean;
import com.yidianling.im.helper.IMUtil;
......@@ -38,6 +39,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
private LinearLayout recommendLlScroll;
private TextView tv_outline_left;
private TextView tv_outline_right;
private LinearLayout ll_recommend_expert;
private HorizontalScrollView recommend_ll_scroll_view;
private TextView recommend_ll_scroll_view_top_text;
......@@ -53,6 +55,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
@Override
protected void inflateContentView() {
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);
recommendLlScroll = view.findViewById(R.id.recommend_ll_scroll);
tv_outline_left = view.findViewById(R.id.tv_outline_left);
......@@ -146,6 +149,7 @@ public class MsgViewHolderRecommendExpertList extends MsgViewHolderBase {
}
hideHead();
hideItemBg();
AnimUtils.Companion.slideToUp(ll_recommend_expert);
}
@Override
......
......@@ -15,14 +15,14 @@ import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
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.event.UpdateTabUnreadNumEvent
import com.yidianling.im.helper.IMUtil
import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.helper.MsgReceiveHelper
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.ui.page.fragment.bean.ChatItemBean
import com.yidianling.im.ui.page.fragment.view.ChatItemView
......@@ -62,7 +62,8 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
SessionHelper.startP2PSession(context, -1, "4108805", null,
P2PCustomActionHandlerImpl("4108805", "课程小助手-壹壹", "4108805"))
}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(
var unReadNum: Int = 0,
var chat_type: Int = 1,//1私聊 2群聊
var content: String = "",
var doctor_id: Int = 0,//专家id
var doctorId: Int = 0,//专家id
var ds: Int = 0, //倾诉业务状态
var head: String = "",
var is_read: Int = 0,//是否已读:1未读;2已读
......
......@@ -11,9 +11,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
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.nimbase.api.model.session.SessionCustomization;
import com.yidianling.nimbase.business.preference.UserPreferences;
......@@ -23,16 +20,10 @@ import com.yidianling.nimbase.common.util.sys.ScreenUtil;
import com.yidianling.uikit.business.session.fragment.YDLMessageFragment;
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import com.yidianling.uikit.custom.widget.TitleBarBottom;
import java.net.URLEncoder;
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.
*/
......@@ -126,132 +117,15 @@ public abstract class YDLBaseMessageActivity extends UI {
if (ActionHandlerStorage.getL(sessionId) != null) {
ActionHandlerStorage.getL(sessionId).setmActivity(this);
}
if (!UserPreferences.isEarPhoneModeEnable()) {
tb.setTitleRightDraw(null);
} else {
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) {
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的右侧按钮及响应事件
private void addRightCustomViewOnActionBar(Activity activity, List<SessionCustomization.OptionsButton> buttons) {
if (buttons == null || buttons.size() == 0) {
......
......@@ -11,12 +11,14 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -42,6 +44,7 @@ import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.utils.AnimUtils;
import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
......@@ -51,6 +54,7 @@ import com.ydl.ydlcommon.view.CircleImageView;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.helper.IMChatUtil;
import com.yidianling.im.router.ImIn;
import com.yidianling.nimbase.api.UIKitOptions;
import com.yidianling.nimbase.api.model.main.CustomPushContentProvider;
......@@ -64,6 +68,7 @@ import com.yidianling.nimbase.common.fragment.TFragment;
import com.yidianling.nimbase.impl.cache.NimUserInfoCache;
import com.yidianling.uikit.api.NimUIKitImpl;
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.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
......@@ -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.widget.ConfideOrderInfoView;
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.user.api.service.IUserService;
......@@ -122,6 +128,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private ChatPrivateTips v_chattips;
// modules
protected InputPanel inputPanel;
private int rvPaddingTop;
private RelativeLayout rl_contain;
private boolean initHeightFinish;
public InputPanel getInputPanel() {
return inputPanel;
......@@ -165,7 +174,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private TextView tv_doctor_name;
private LinearLayout top_view_container;
private LinearLayout constraint_ll;
private RelativeLayout constraint_ll;
private LinearLayout ll_info_detail;
private RelativeLayout rela_zixun;
......@@ -229,12 +238,29 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
tv_from = rootView.findViewById(R.id.tv_from);
ll_info_detail = rootView.findViewById(R.id.ll_info_detail);
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);
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);
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) {
rl_common_question_enter.setOnClickListener(v -> {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
......@@ -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) {
top_expert_info_cl.setVisibility(View.VISIBLE);
AnimUtils.Companion.slideToDown(top_expert_info_cl);
initTopCustomBar();
comment_banner_view_ll.setVisibility(View.VISIBLE);
AnimUtils.Companion.slideToDown(comment_banner_view_ll);
initCommentBanner();
initAnimation(); // 初始化顶部布局的动画
initTopViewHeight(); //设置顶部专家信息栏高度
addScrollListener();
TitleBarBottom titleBar = ((YDLBaseMessageActivity) getActivity()).getTitleBarBottom();
IMChatUtil.INSTANCE.initChatOnlineState(titleBar,getContext(),sessionId);
}
if (ActionHandlerStorage.getL(sessionId) != null) {
......@@ -312,6 +352,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (type == 2 && sType == 1) {
lin_actions.setVisibility(View.VISIBLE);
ll_actions_yi.setVisibility(View.GONE);
AnimUtils.Companion.slideToDown(lin_actions);
initMenu();
} else if (type == -1 && sType == 1) {
ll_actions_yi.setVisibility(View.VISIBLE);
......@@ -332,17 +373,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
Log.e("hzs", "接收到消息状态变化-------MessageFragment");
}, 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) {
isFirst = false;
......@@ -470,7 +500,42 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
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 {
//onPause时语音消息是否停止播放
public static boolean audioIsStop = true;
public LinearLayoutManager linearLayoutManager;
public MessageListPanelEx(Container container, View rootView, boolean recordOnly, boolean remote) {
this(container, rootView, null, recordOnly, remote);
......@@ -186,7 +187,8 @@ public class MessageListPanelEx {
// RecyclerView
messageListView = rootView.findViewById(R.id.messageListView);
messageListView.setLayoutManager(new LinearLayoutManager(container.activity));
linearLayoutManager = new LinearLayoutManager(container.activity);
messageListView.setLayoutManager(linearLayoutManager);
messageListView.requestDisallowInterceptTouchEvent(true);
messageListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
......
......@@ -19,6 +19,8 @@ public interface IP2PCustomActionHandler {
DocInfo getInfo();
Boolean isNotPrepare();
boolean deleteMessage(IMMessage message); //需要筛选的消息
void setDoctorStatus(int status); //更新专家登录状态
......
......@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/ll_recommend_expert"
android:gravity="center_horizontal">
<LinearLayout
......
......@@ -75,6 +75,7 @@
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="隐私保密,安心咨询"
android:layout_weight="1"
android:autoLink="all"
android:background="#ffffff"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_F0F0F0"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_F0F0F0"
android:orientation="vertical">
<FrameLayout
android:id="@+id/message_activity_list_view_container"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
android:id="@+id/message_activity_list_view_container"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<com.yidianling.uikit.business.session.helper.MsgBkImageView
android:id="@+id/message_activity_background"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:id="@+id/message_activity_background"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/constraint_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/constraint_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
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
android:id="@+id/top_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<!-- 专家信息 -->
<LinearLayout
android:id="@+id/top_expert_info_ll"
android:id="@+id/top_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_alignParentTop="true"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone">
<!-- 专家信息 -->
<LinearLayout
android:id="@+id/top_expert_info_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.constraint.ConstraintLayout
android:id="@+id/top_expert_info_cl"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/im_white"
android:paddingLeft="@dimen/platform_dp_10"
android:visibility="gone">
android:id="@+id/top_expert_info_cl"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/im_white"
android:paddingLeft="@dimen/platform_dp_10"
android:visibility="gone"
tools:visibility="visible">
<com.ydl.ydlcommon.view.CircleImageView
android:id="@+id/small_head_img"
android:layout_width="@dimen/platform_dp_36"
android:layout_height="@dimen/platform_dp_36"
android:layout_marginTop="8dp"
android:layout_marginBottom="10dp"
android:background="@drawable/platform_head_place_hold_pic"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"></com.ydl.ydlcommon.view.CircleImageView>
android:id="@+id/small_head_img"
android:layout_width="@dimen/platform_dp_36"
android:layout_height="@dimen/platform_dp_36"
android:layout_marginTop="8dp"
android:layout_marginBottom="10dp"
android:background="@drawable/platform_head_place_hold_pic"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"></com.ydl.ydlcommon.view.CircleImageView>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="46dp"
android:layout_marginRight="10dp"
android:background="#F0F0F0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="46dp"
android:layout_marginRight="10dp"
android:background="#F0F0F0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="46dp"
android:background="#F0F0F0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="46dp"
android:background="#F0F0F0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/rl_help"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="37dp"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintLeft_toRightOf="@+id/small_head_img">
android:id="@+id/rl_help"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="37dp"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintLeft_toRightOf="@+id/small_head_img">
<TextView
android:id="@+id/help_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="2648" />
android:id="@+id/help_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="2648" />
<TextView
android:id="@+id/help_num_tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="帮助人数"
android:textColor="@color/platform_color_999999"
android:textSize="@dimen/platform_dp_10" />
android:id="@+id/help_num_tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="帮助人数"
android:textColor="@color/platform_color_999999"
android:textSize="@dimen/platform_dp_10" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="12dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/help_num_tv_desc"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="12dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/help_num_tv_desc"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_good"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintRight_toRightOf="parent">
<LinearLayout
android:id="@+id/rl_good"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
android:layout_height="match_parent"
android:layout_marginRight="30dp"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:id="@+id/good_num_tv"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="4.7" />
android:orientation="horizontal">
<TextView
android:id="@+id/good_num_tv_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="分"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_10" />
android:id="@+id/good_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="4.7" />
<TextView
android:id="@+id/good_num_tv_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="分"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_10" />
</LinearLayout>
<com.yidianling.uikit.business.session.view.ImRedStarGradeView
android:id="@+id/good_num_icons"
android:layout_width="wrap_content"
android:layout_height="11dp"
android:layout_marginBottom="1.5dp"
android:layout_alignParentBottom="true" />
android:id="@+id/good_num_icons"
android:layout_width="wrap_content"
android:layout_height="11dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="1.5dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="2dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/good_num_icons"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="2dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/good_num_icons"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_server"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintLeft_toRightOf="@+id/rl_help"
app:layout_constraintRight_toLeftOf="@+id/rl_good">
android:id="@+id/rl_server"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="13dp"
android:paddingBottom="10dp"
app:layout_constraintLeft_toRightOf="@+id/rl_help"
app:layout_constraintRight_toLeftOf="@+id/rl_good">
<TextView
android:id="@+id/server_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="1634" />
android:id="@+id/server_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/platform_dp_16"
tools:text="1634" />
<TextView
android:id="@+id/server_num_tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="服务时长 (小时)"
android:textSize="@dimen/platform_dp_10" />
android:id="@+id/server_num_tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="服务时长 (小时)"
android:textSize="@dimen/platform_dp_10" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="12dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/server_num_tv_desc"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="12dp"
android:layout_marginBottom="1.5dp"
android:layout_toRightOf="@+id/server_num_tv_desc"
android:scaleType="fitXY"
android:src="@drawable/im_more_info_icon" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
<!--用户评论banner-->
<LinearLayout
android:id="@+id/comment_banner_view_ll"
android:layout_width="match_parent"
android:layout_height="37dp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:visibility="gone">
android:id="@+id/comment_banner_view_ll"
android:layout_width="match_parent"
android:layout_height="37dp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:visibility="gone">
<TextView
android:id="@+id/im_focus_btn"
android:layout_width="46dp"
android:layout_height="20dp"
android:background="@drawable/im_focus_btn_bg"
android:gravity="center"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
tools:text="关注" />
android:id="@+id/im_focus_btn"
android:layout_width="46dp"
android:layout_height="20dp"
android:background="@drawable/im_focus_btn_bg"
android:gravity="center"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
tools:text="关注" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:background="#F0F0F0" />
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:background="#F0F0F0" />
<com.yidianling.uikit.business.session.view.ImCommentBannerView
android:id="@+id/comment_banner_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></com.yidianling.uikit.business.session.view.ImCommentBannerView>
android:id="@+id/comment_banner_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></com.yidianling.uikit.business.session.view.ImCommentBannerView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
android:text="评价" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:text="评价"
android:textColor="@color/platform_main_theme"
android:textSize="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
android:text="(" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:lines="1"
android:text="("
android:textColor="@color/platform_main_theme"
android:textSize="12dp" />
<TextView
android:id="@+id/tv_all_comment_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
tools:text="18714" />
android:id="@+id/tv_all_comment_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
tools:text="18714" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
android:layout_marginBottom="1dp"
android:text=")" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:lines="1"
android:text=")"
android:textColor="@color/platform_main_theme"
android:textSize="12dp" />
<ImageView
android:id="@+id/tv_all_comment_go"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="center"
android:src="@drawable/platform_right_arrow" />
android:id="@+id/tv_all_comment_go"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="center"
android:src="@drawable/platform_right_arrow" />
</LinearLayout>
</LinearLayout>
<!-- 客服小壹 三个快捷按钮 -->
<FrameLayout
android:id="@+id/quick_fl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="10dp">
android:id="@+id/quick_fl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="10dp">
<LinearLayout
android:id="@+id/ll_actions_yi"
android:layout_width="match_parent"
android:layout_height="53dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:visibility="gone">
android:id="@+id/ll_actions_yi"
android:layout_width="match_parent"
android:layout_height="53dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:id="@+id/action_help"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
android:id="@+id/action_help"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_ico_help" />
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_ico_help" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="常见问题"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="常见问题"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_feedback"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
android:id="@+id/action_feedback"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_ico_feedback" />
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_ico_feedback" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="投诉反馈"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="投诉反馈"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/action_call"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
android:id="@+id/action_call"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/im_bg_im_confide_action"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_free_call" />
android:layout_width="17dp"
android:layout_height="17dp"
android:src="@drawable/im_chat_free_call" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="免费热线"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="center"
android:text="免费热线"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
......@@ -392,32 +462,15 @@
</FrameLayout>
</LinearLayout>
<!-- 未支付订单提醒等 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 未支付订单提醒等 -->
<RelativeLayout
android:id="@+id/rl_contain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/top_view_container"
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:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -427,7 +480,7 @@
android:layout_marginTop="14dp"
android:visibility="visible">
<RelativeLayout
<RelativeLayout
android:id="@+id/rela_zixun"
android:layout_width="wrap_content"
android:layout_height="36dp"
......@@ -436,7 +489,7 @@
android:paddingLeft="17dp"
android:paddingRight="11dp">
<TextView
<TextView
android:id="@+id/action_yuyue"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -447,156 +500,103 @@
android:textSize="14dp"
android:textStyle="bold" />
</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>
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/layoutPlayAudio"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_gravity="center"
android:background="@drawable/im_nim_audio_record_toast_bg"
android:visibility="gone"
tools:visibility="visible">
android:id="@+id/layoutPlayAudio"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_gravity="center"
android:background="@drawable/im_nim_audio_record_toast_bg"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/img_antation"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:src="@mipmap/im_voice_search_feedback001" />
android:id="@+id/img_antation"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:src="@mipmap/im_voice_search_feedback001" />
<ImageView
android:id="@+id/img_cancel"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:src="@mipmap/im_icon_audio_cancel"
android:visibility="gone" />
android:id="@+id/img_cancel"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:src="@mipmap/im_icon_audio_cancel"
android:visibility="gone" />
<Chronometer
android:id="@+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/im_timer_default"
android:textColor="@color/im_white"
android:textSize="45sp"
android:visibility="gone" />
android:id="@+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/im_timer_default"
android:textColor="@color/im_white"
android:textSize="45sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/timer_tip_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="6dp"
android:gravity="center">
<TextView
android:id="@+id/timer_tip"
android:id="@+id/timer_tip_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/im_recording_cancel"
android:textColor="@color/im_white"
android:textSize="12sp" />
android:layout_gravity="bottom"
android:layout_margin="6dp"
android:gravity="center">
<TextView
android:id="@+id/timer_tip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/im_recording_cancel"
android:textColor="@color/im_white"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
<com.yidianling.uikit.business.session.view.ChatPrivateTips
android:id="@+id/v_chattips"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="58dp"
android:visibility="gone" />
android:id="@+id/v_chattips"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="58dp"
android:visibility="gone" />
<!-- 常见问题 快捷回复-->
<RelativeLayout
android:id="@+id/rl_common_question"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_gravity="bottom"
android:background="@drawable/im_background_chat_common_question"
android:paddingRight="13dp">
android:id="@+id/rl_common_question"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_gravity="bottom"
android:background="@drawable/im_background_chat_common_question"
android:paddingRight="13dp">
<TextView
android:id="@+id/tv_open_common_question"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:gravity="center_vertical"
android:text="常见问题"
android:textColor="@color/platform_main_theme"
android:textStyle="bold" />
android:id="@+id/tv_open_common_question"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:gravity="center_vertical"
android:text="常见问题"
android:textColor="@color/platform_main_theme"
android:textStyle="bold" />
</RelativeLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/fl_question_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:visibility="gone" />
android:id="@+id/fl_question_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:visibility="gone" />
<include layout="@layout/im_nim_message_activity_bottom_layout" />
......
......@@ -6,7 +6,7 @@
<gradient
android:angle="180"
android:startColor="@color/user_main_theme_66"
android:endColor="@color/user_main_theme_66"/>
android:startColor="@color/platform_main_gradient_start_color_un"
android:endColor="@color/platform_main_gradient_end_color_un"/>
</shape>
\ No newline at end of file
package com.ydl.ydlcommon.utils
import android.view.View
import android.view.animation.AccelerateInterpolator
import android.view.animation.Animation
import android.view.animation.TranslateAnimation
/**
* @author yuanWai
* @描述:
......@@ -13,10 +15,12 @@ import android.view.animation.TranslateAnimation
*/
class AnimUtils {
companion object {
fun slideToUp(view : View){
val slide = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
1.0f, Animation.RELATIVE_TO_SELF, 0.0f)
fun slideToUp(view: View) {
val slide = TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
1.0f, Animation.RELATIVE_TO_SELF, 0.0f
)
slide.duration = 400
slide.fillAfter = true
slide.isFillEnabled = true
......@@ -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