Commit 339f40ea by 刘鹏

feat : UI优化

parent 3e7347ae
......@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.37",
"m-home" : "0.0.22.67",
"m-im" : "0.0.19.35",
"m-im" : "0.0.19.37",
"m-dynamic" : "0.0.7.24",
"m-article" : "0.0.0.10",
......
......@@ -142,100 +142,13 @@ object IMChatUtil {
*/
@SuppressLint("CheckResult")
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
if (context == null || (!isLogin(context, true))) {
return
}
if (loadingDialog == null) {
loadingDialog = newInstance(null)
}
if (context.supportFragmentManager != null && !context.isDestroyed) {
loadingDialog?.show(context.supportFragmentManager, null)
}
getImJavaApi().getUserType(chatItemBean.toUid.toString())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null && TextUtils.equals(
res.data!!.userType,
USER_TYPE_ASSISTANT.toString()
)
) {
if (TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString())) {
//和助理私聊需要打开信息采集弹窗
prepareAssistantChatData(
context,
chatItemBean.toUid.toString(),
object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
//新前置信息收集入口
ImRetrofitApi.Companion.getImRetrofitApi()
.getSystemConfigByKeyword("lx_collect_card_config")
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
} else {
CmsExamQuestionPaperActivity.start(
context,
chatItemBean.toUid.toString(),
expertInfo, 0
)
}
}, {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
})
}
})
} else {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
})
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
/**
......@@ -264,48 +177,59 @@ object IMChatUtil {
//时间内已收集过信息,直接跳转到聊天页
startChat(context, toUid, isFromQingShu)
} else {
//超过间隔时间 判断用户类型
getImJavaApi().getChatUid(toUid)
getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseAPIResponse<DoctorAssistantRespDtoBean> ->
//获取实际聊天对象 role 1 专家 2 代运营
if (res.data != null && res.data.role == 1) {
//role=1专家
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.chatEvent) { //和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data!!.chatEvent)
}
val toUid = res.data.chatUid
prepareChatData(context, toUid, object :
ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
} else if (res.data != null && res.data!!.role == 2) {
//role=2代运营
val toUid = res.data.chatUid
prepareAssistantChatData(context, toUid,
object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
CmsExamQuestionPaperActivity.start(
context,
toUid,
expertInfo,
0
)
if (TextUtils.equals(res.data!!.userType, USER_TYPE_EXPERT.toString())
) { //专家
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp: BaseAPIResponse<DoctorAssistantRespDtoBean> ->
val bean = resp.data
val toUid = bean.chatUid
prepareChatData(context, toUid, object :
ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
if (resp.data != null && resp.data.role == 2) {
//2 代运营
CmsExamQuestionPaperActivity.start(context, toUid, expertInfo, 0)
} else {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
}
})
}) { t: Throwable? ->
handleError(context, t!!)
}
})
} else {
prepareAssistantChatData(
context,
toUid,
object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
}
} else {
startChat(context, toUid, isFromQingShu)
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
ToastUtil.toastShort(res.msg)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
startChat(context, toUid, isFromQingShu)
handleError(context, throwable!!)
})
}
}
......
......@@ -34,7 +34,6 @@
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
android:lineSpacingMultiplier="1.2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?" />
......@@ -44,7 +43,6 @@
android:layout_width="239dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:lineSpacingMultiplier="1.2"
android:text="@string/question_notes"
android:textColor="@color/color_grey_999999"
android:textSize="14sp" />
......
......@@ -32,7 +32,6 @@
android:layout_height="wrap_content"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
android:lineSpacingMultiplier="1.2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?"/>
......@@ -41,6 +40,7 @@
android:id="@+id/tv_more_list"
android:layout_width="263dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintStart_toStartOf="@id/multiple_choice_title"
......@@ -55,7 +55,7 @@
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/white"
android:layout_marginTop="8dp"
android:layout_marginTop="16dp"
android:background="@drawable/im_background_18dp_ebebeb"
android:gravity="center"
android:paddingTop="@dimen/platform_dp_8"
......
......@@ -32,7 +32,6 @@
android:id="@+id/multiple_choice_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.2"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -43,6 +42,7 @@
android:id="@+id/tv_one_list"
android:layout_width="263dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
tools:itemCount="6"
......
......@@ -26,7 +26,6 @@
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:maxWidth="270dp"
android:padding="12dp"
android:lineSpacingMultiplier="1.2"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -34,7 +34,6 @@
android:layout_marginRight="8dp"
android:background="@drawable/im_question_message_round_1da1f2_8dp_bg"
android:maxWidth="270dp"
android:lineSpacingMultiplier="1.2"
android:textColor="@color/white"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -79,7 +79,7 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/tv_finish"
tools:visibility="gone">
tools:visibility="visible">
<TextView
android:id="@+id/tv_problem"
......@@ -98,17 +98,19 @@
<EditText
android:id="@+id/et_input_problem"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="top"
android:hint="请简单描述遇到的问题......"
android:lineSpacingMultiplier="1.2"
android:maxHeight="200dp"
android:padding="12dp"
android:textColor="@color/color_242424"
android:textColorHint="@color/color_bfbfbf"
android:textSize="17sp"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ll_send"
app:layout_constraintTop_toBottomOf="@id/tv_problem" />
<HorizontalScrollView
......@@ -119,7 +121,8 @@
android:layout_marginBottom="14dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_input_problem">
app:layout_constraintTop_toBottomOf="@id/et_input_problem"
tools:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
......@@ -174,13 +177,15 @@
</HorizontalScrollView>
<LinearLayout
android:id="@+id/ll_send"
android:layout_width="86dp"
android:layout_height="36dp"
android:layout_marginBottom="8dp"
android:background="#80ffffff"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
app:layout_constraintBottom_toBottomOf="@id/et_input_problem"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/et_input_problem">
<TextView
android:id="@+id/tv_send"
......@@ -191,7 +196,8 @@
android:text="发送"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
......
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