Commit 339f40ea by 刘鹏

feat : UI优化

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