Commit 49fe9542 by 徐健

增加咨询模块的导医代码

parent ef62f674
......@@ -167,6 +167,7 @@ dependencies {
if (true) {
//开发模式
api project(':m-user')
implementation modularPublication('com.ydl:m-user-api')
api project(':m-tests')
api project(':m-consultant')
api project(':m-confide')
......
......@@ -27,6 +27,7 @@ public final class DemoGlobalConfig implements IConfigModule {
public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) {
builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX)
.addUrl("github", APP_DOMAIN)
.setEnv(YDLConstants.ENV_TEST)
.setDebug(BuildConfig.DEBUG);
}
}
......@@ -30,6 +30,7 @@ import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.GlobalInfo
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.ui.LogoLoadingView
......@@ -45,6 +46,7 @@ import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.dialog.ConsultAssistantDialog
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.listener.OnFilterConfirmListener
import com.yidianling.consultant.listener.OnSortItemSelectedListener
......@@ -55,6 +57,9 @@ import com.yidianling.consultant.ui.view.AreaPopupWindow
import com.yidianling.consultant.ui.view.CategoryPopupWindow
import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_activity_expert_search_list.*
import kotlinx.android.synthetic.main.consultant_item_filter_online.view.*
import kotlinx.android.synthetic.main.consultant_layout_search_content.*
......@@ -62,6 +67,7 @@ import kotlinx.android.synthetic.main.consultant_layout_search_head_bg.*
import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
import org.json.JSONObject
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@Route(path = "/consult/list")
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(), View.OnClickListener, IExpertSearchView,
......@@ -182,6 +188,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var hasSelectedArea = false //是否选择过地区
private var hasSelectedSort = false //是否选择过排序
private var consultAssistantDialog: ConsultAssistantDialog? = null
override fun createPresenter(): ExpertSearchPresenter = ExpertSearchPresenter()
private fun initViews() {
......@@ -990,9 +998,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} else {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL)
}
consultAssistantDialog?.let {
consultAssistantDialog?.show()
}
}
filterPopupWindow.isClippingEnabled = false
filterPopupWindow.showAtLocation(viewSep2.rootView, Gravity.TOP + Gravity.RIGHT, 0, 0)
consultAssistantDialog?.let {
consultAssistantDialog?.hide()
}
filterPopupWindow.onFilterConfirmListener = this
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
// viewDim.visibility = View.VISIBLE
......@@ -1458,5 +1472,30 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onResume() {
super.onResume()
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_PAGE_VISIT)
//登录状态且是普通用户且是华为渠道,上述条件成立的情况下,调用接口判断是否展示咨询助理按钮
//todo xujian 条件添加完整
if (ConsultantIn.isLogin() &&
ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
/** && YdlDataManager.getRam().getChannelName() == "android_huawei"*/) {
getPresenter().requestConsultAssistantBtnShown()
}
}
override fun showConsultAssistantDialog() {
Observable.timer(10000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe {
if (null == consultAssistantDialog) {
consultAssistantDialog = ConsultAssistantDialog(this, object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() {
getPresenter().requestConsultAssistantUid()
}
})
consultAssistantDialog?.show()
}
}
}override fun jumpToChat(uid: Long) {
ConsultantIn.startP2PSession(this, uid.toString())
}
}
......@@ -11,6 +11,7 @@ import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.AllFilter
......@@ -25,6 +26,37 @@ import io.reactivex.schedulers.Schedulers
*/
class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
/**
* 请求接口判断导医咨询助理按钮是否展示
*/
fun requestConsultAssistantBtnShown() {
SearchApi.instance
SearchApi.getSearchApi().getConsultAssistantRequest("doctor_list")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe{
if (it.data) {
mView.showConsultAssistantDialog()
}
}
}
/**
* 请求接口获取咨询助理的uid
*/
fun requestConsultAssistantUid() {
SearchApi.getSearchApi().getConsultAssistantUidRequest()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe{
if (it.code == "200" && it.data != 0.toLong()) {
mView.jumpToChat(it.data)
}else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
}
}
}
@SuppressLint("CheckResult")
fun fetchListHead() {
......
......@@ -38,4 +38,14 @@ interface IExpertSearchView : IView {
* 加载图片
*/
fun showImage(url : String?, imgView : ImageView, ops : SimpleImageOpConfiger)
/**
* 导医
*/
fun showConsultAssistantDialog()
/**
* 跳去私聊
*/
fun jumpToChat(uid: Long)
}
\ No newline at end of file
package com.yidianling.consultant.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.yidianling.consultant.R
import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_window.*
/**
* 咨询助理浮层
* Created by xj on 2019/10/30.
*/
class ConsultAssistantDialog(context: Context, val consultAssistantClickListener: OnConsultAssistantClickListener?) : Dialog(context, R.style.consultant_expert_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.consultant_expert_consult_assistant_popup_window)
val params = window.attributes
params.width = WindowManager.LayoutParams.WRAP_CONTENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
params.gravity = Gravity.RIGHT + Gravity.BOTTOM
params.verticalMargin = 0.07f
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE //不拦截外部点击事件
window.attributes = params
window.setDimAmount(0f)
window.setWindowAnimations(R.style.consultant_expert_consult_assistant_dialog_animate)
consult_assistant.setOnClickListener {
consultAssistantClickListener?.onClickAction()
}
setCanceledOnTouchOutside(false)
}
interface OnConsultAssistantClickListener {
fun onClickAction() //隐私设置
}
}
\ No newline at end of file
......@@ -60,4 +60,14 @@ interface SearchApi {
@retrofit2.http.Headers("Content-Type:application/json")
@GET
fun getFilterCount(@Url url : String?): Observable<BaseAPIResponse<Int>>
//导医
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("consult/assistant/guide-switch")
fun getConsultAssistantRequest(@Query("switchKey") switchKey: String): Observable<BaseAPIResponse<Boolean>>
//获取咨询助理uid
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("consult/assistant/chat-distribute")
fun getConsultAssistantUidRequest(): Observable<BaseAPIResponse<Long>>
}
\ No newline at end of file
......@@ -20,6 +20,10 @@ object ConsultantIn {
RouterManager.getImRouter().startP2PXiaoYi(context)
}
fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin()
}
fun startP2PSession(context: AppCompatActivity, toUid: String) {
RouterManager.getImRouter().startP2PSession(context, toUid)
}
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="0"
android:toXDelta="100%p" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="100%p"
android:toXDelta="0" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="60dp"
android:paddingRight="11dp">
<ImageView
android:id="@+id/consult_assistant"
android:layout_width="66dp"
android:layout_height="68dp"
android:scaleType="centerCrop"
android:src="@drawable/consultant_expert_consult_assistant_img"/>
</RelativeLayout>
\ No newline at end of file
......@@ -22,4 +22,19 @@
<item name="android:windowEnterAnimation">@anim/consultant_expert_service_popupwindow_filter_show_anim</item>
<item name="android:windowExitAnimation">@anim/consultant_expert_service_popupwindow_filter_hide_anim</item>
</style>
<style name="consultant_expert_consult_assistant_dialog_animate">
<!-- 指定显示的动画xml -->
<item name="android:windowEnterAnimation">@anim/consultant_expert_consult_assistant_dialog_animate_show_anim</item>
<item name="android:windowExitAnimation">@anim/consultant_expert_consult_assistant_dialog_animate_hide_anim</item>
</style>
<style name="consultant_expert_dialog_default_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
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