Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
fd5e7e89
Commit
fd5e7e89
authored
Nov 14, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导医代码封装
parent
29831a89
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
81 deletions
+92
-81
config.gradle
config.gradle
+1
-1
modular.gradle
m-consultant/modular.gradle
+2
-2
ExpertSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
+9
-30
ExpertSearchPresenter.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
+0
-32
IExpertSearchView.kt
m-consultant/src/main/java/com/yidianling/consultant/IExpertSearchView.kt
+0
-10
ConsultantServiceImp.kt
m-consultant/src/main/java/com/yidianling/consultant/modular/ConsultantServiceImp.kt
+6
-2
ConsultAssistantDialogUtils.kt
m-consultant/src/main/java/com/yidianling/consultant/modular/singlton/ConsultAssistantDialogUtils.kt
+74
-4
No files found.
config.gradle
View file @
fd5e7e89
ext
{
ext
{
kotlin_version
=
'1.3.21'
kotlin_version
=
'1.3.21'
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
appName
:
"心理咨询壹点灵"
,
...
...
m-consultant/modular.gradle
View file @
fd5e7e89
...
@@ -15,7 +15,7 @@ modular {
...
@@ -15,7 +15,7 @@ modular {
groupId
=
"com.ydl"
groupId
=
"com.ydl"
artifactId
=
"m-consultant-module-ydl"
artifactId
=
"m-consultant-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
// 上报的 壹点灵 业务模块 aar 包的版本号
version
=
"0.0.1
5
"
version
=
"0.0.1
8
"
}
}
}
}
...
@@ -24,7 +24,7 @@ modular {
...
@@ -24,7 +24,7 @@ modular {
groupId
=
"com.ydl"
groupId
=
"com.ydl"
artifactId
=
"m-consultant-api"
artifactId
=
"m-consultant-api"
//开发时注释掉版本号,发布api时打开
//开发时注释掉版本号,发布api时打开
version
=
"0.0.
1
"
version
=
"0.0.
2
"
// API 层打包时需要引入的依赖
// API 层打包时需要引入的依赖
apiDependencies
{
apiDependencies
{
implementation
"com.google.code.gson:gson:2.8.2"
implementation
"com.google.code.gson:gson:2.8.2"
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
View file @
fd5e7e89
...
@@ -46,11 +46,11 @@ import com.yidianling.common.tools.RxImageTool
...
@@ -46,11 +46,11 @@ import com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.consultant.adapter.ExpertSearchAdapter
import
com.yidianling.consultant.adapter.ExpertSearchAdapter
import
com.yidianling.consultant.constants.ConsultBIConstants
import
com.yidianling.consultant.constants.ConsultBIConstants
import
com.yidianling.consultant.dialog.ConsultAssistantDialog
import
com.yidianling.consultant.listener.OnCategoriesSelectedListener
import
com.yidianling.consultant.listener.OnCategoriesSelectedListener
import
com.yidianling.consultant.listener.OnFilterConfirmListener
import
com.yidianling.consultant.listener.OnFilterConfirmListener
import
com.yidianling.consultant.listener.OnSortItemSelectedListener
import
com.yidianling.consultant.listener.OnSortItemSelectedListener
import
com.yidianling.consultant.model.bean.*
import
com.yidianling.consultant.model.bean.*
import
com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import
com.yidianling.consultant.modular.utils.TempH5RouteUtils
import
com.yidianling.consultant.modular.utils.TempH5RouteUtils
import
com.yidianling.consultant.router.ConsultantIn
import
com.yidianling.consultant.router.ConsultantIn
import
com.yidianling.consultant.ui.view.AreaPopupWindow
import
com.yidianling.consultant.ui.view.AreaPopupWindow
...
@@ -188,7 +188,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -188,7 +188,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private
var
hasSelectedArea
=
false
//是否选择过地区
private
var
hasSelectedArea
=
false
//是否选择过地区
private
var
hasSelectedSort
=
false
//是否选择过排序
private
var
hasSelectedSort
=
false
//是否选择过排序
private
var
consultAssistantDialog
:
ConsultAssistantDialog
?
=
null
override
fun
createPresenter
():
ExpertSearchPresenter
=
ExpertSearchPresenter
()
override
fun
createPresenter
():
ExpertSearchPresenter
=
ExpertSearchPresenter
()
...
@@ -998,15 +997,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -998,15 +997,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
else
{
}
else
{
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_NORMAL
)
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_NORMAL
)
}
}
consultAssistantDialog
?.
let
{
ConsultAssistantDialogUtils
.
INSTANCE
.
fitRequest
(
this
,
"doctor_list"
)
consultAssistantDialog
?.
show
()
}
}
}
filterPopupWindow
.
isClippingEnabled
=
false
filterPopupWindow
.
isClippingEnabled
=
false
filterPopupWindow
.
showAtLocation
(
viewSep2
.
rootView
,
Gravity
.
TOP
+
Gravity
.
RIGHT
,
0
,
0
)
filterPopupWindow
.
showAtLocation
(
viewSep2
.
rootView
,
Gravity
.
TOP
+
Gravity
.
RIGHT
,
0
,
0
)
consultAssistantDialog
?.
let
{
ConsultAssistantDialogUtils
.
INSTANCE
.
hide
()
consultAssistantDialog
?.
hide
()
}
filterPopupWindow
.
onFilterConfirmListener
=
this
filterPopupWindow
.
onFilterConfirmListener
=
this
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_OPEN
)
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_OPEN
)
// viewDim.visibility = View.VISIBLE
// viewDim.visibility = View.VISIBLE
...
@@ -1473,30 +1468,14 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -1473,30 +1468,14 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
super
.
onResume
()
super
.
onResume
()
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_PAGE_VISIT
)
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_PAGE_VISIT
)
//登录状态且是普通用户且是华为渠道,上述条件成立的情况下,调用接口判断是否展示咨询助理按钮
ConsultAssistantDialogUtils
.
INSTANCE
.
fitRequest
(
this
,
"doctor_list"
)
//todo xujian 条件添加完整
if
(
ConsultantIn
.
isLogin
()
&&
ConsultantIn
.
getUserImpl
().
getUserInfo
()
?.
user_type
==
1
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */
)
{
getPresenter
().
requestConsultAssistantBtnShown
()
}
}
}
override
fun
showConsultAssistantDialog
()
{
override
fun
onDestroy
()
{
Observable
.
timer
(
10000
,
TimeUnit
.
MILLISECONDS
).
subscribeOn
(
Schedulers
.
io
())
super
.
onDestroy
()
.
observeOn
(
AndroidSchedulers
.
mainThread
()).
subscribe
{
if
(
null
==
consultAssistantDialog
)
{
ConsultAssistantDialogUtils
.
INSTANCE
.
hide
()
consultAssistantDialog
=
ConsultAssistantDialog
(
this
,
object
:
ConsultAssistantDialog
.
OnConsultAssistantClickListener
{
ConsultAssistantDialogUtils
.
INSTANCE
.
resetStatus
()
override
fun
onClickAction
()
{
getPresenter
().
requestConsultAssistantUid
()
}
})
consultAssistantDialog
?.
show
()
}
}
}
override
fun
jumpToChat
(
uid
:
Long
)
{
ConsultantIn
.
startP2PSession
(
this
,
uid
.
toString
())
}
}
}
}
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
View file @
fd5e7e89
...
@@ -26,38 +26,6 @@ import io.reactivex.schedulers.Schedulers
...
@@ -26,38 +26,6 @@ import io.reactivex.schedulers.Schedulers
*/
*/
class
ExpertSearchPresenter
:
SimplePresenter
<
IExpertSearchView
>()
{
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"
)
@SuppressLint
(
"CheckResult"
)
fun
fetchListHead
()
{
fun
fetchListHead
()
{
SearchApi
.
getSearchApi
()
SearchApi
.
getSearchApi
()
...
...
m-consultant/src/main/java/com/yidianling/consultant/IExpertSearchView.kt
View file @
fd5e7e89
...
@@ -39,13 +39,4 @@ interface IExpertSearchView : IView {
...
@@ -39,13 +39,4 @@ interface IExpertSearchView : IView {
*/
*/
fun
showImage
(
url
:
String
?,
imgView
:
ImageView
,
ops
:
SimpleImageOpConfiger
)
fun
showImage
(
url
:
String
?,
imgView
:
ImageView
,
ops
:
SimpleImageOpConfiger
)
/**
* 导医
*/
fun
showConsultAssistantDialog
()
/**
* 跳去私聊
*/
fun
jumpToChat
(
uid
:
Long
)
}
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/modular/ConsultantServiceImp.kt
View file @
fd5e7e89
...
@@ -15,12 +15,15 @@ class ConsultantServiceImp: IConsultantService {
...
@@ -15,12 +15,15 @@ class ConsultantServiceImp: IConsultantService {
override
fun
init
(
context
:
Context
?)
{
override
fun
init
(
context
:
Context
?)
{
}
}
/**
* 首页咨询助理入口
*/
override
fun
showConsultAssistantDialog
(
activity
:
Activity
)
{
override
fun
showConsultAssistantDialog
(
activity
:
Activity
)
{
ConsultAssistantDialogUtils
.
INSTANCE
.
showDialog
(
activity
)
ConsultAssistantDialogUtils
.
INSTANCE
.
fitRequest
(
activity
,
"home_index"
)
}
}
override
fun
hideConsultAssistantDialog
()
{
override
fun
hideConsultAssistantDialog
()
{
ConsultAssistantDialogUtils
.
INSTANCE
.
hide
Dialog
()
ConsultAssistantDialogUtils
.
INSTANCE
.
hide
()
}
}
}
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/modular/singlton/ConsultAssistantDialogUtils.kt
View file @
fd5e7e89
package
com.yidianling.consultant.modular.singlton
package
com.yidianling.consultant.modular.singlton
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.consultant.dialog.ConsultAssistantDialog
import
com.yidianling.consultant.dialog.ConsultAssistantDialog
...
@@ -9,6 +8,7 @@ import com.yidianling.consultant.model.SearchApi
...
@@ -9,6 +8,7 @@ import com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.router.ConsultantIn
import
com.yidianling.consultant.router.ConsultantIn
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
java.util.*
/**
/**
* Created by xj on 2019/11/14.
* Created by xj on 2019/11/14.
...
@@ -20,7 +20,64 @@ class ConsultAssistantDialogUtils private constructor(){
...
@@ -20,7 +20,64 @@ class ConsultAssistantDialogUtils private constructor(){
}
}
var
consultAssistantDialog
:
ConsultAssistantDialog
?
=
null
var
consultAssistantDialog
:
ConsultAssistantDialog
?
=
null
var
expertSearchPageHasShown
:
Boolean
=
false
// 专家咨询列表页面是否已经展示
var
timer
:
Timer
?
=
null
/**
*判断是否符合代码展示逻辑
* origin 展示请求来源 首页 home_index 咨询列表 doctor_list
*/
fun
fitRequest
(
activity
:
Activity
,
origin
:
String
)
{
if
(
ConsultantIn
.
isLogin
()
&&
ConsultantIn
.
getUserImpl
().
getUserInfo
()
?.
user_type
==
1
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */
)
{
shouldShowDialog
(
activity
,
origin
)
}
}
/**
* 判断是否符合接口展示逻辑
*/
private
fun
shouldShowDialog
(
activity
:
Activity
,
origin
:
String
,
isDelay
:
Boolean
=
false
)
{
// 请求接口判断导医咨询助理按钮是否展示
SearchApi
.
getSearchApi
().
getConsultAssistantRequest
(
origin
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
if
(
it
.
data
)
{
if
(
origin
==
"home_index"
)
{
show
(
activity
,
false
)
}
else
if
(
origin
==
"doctor_list"
)
{
show
(
activity
,
true
)
}
}
}
}
/**
* 展示
* isDelay 是否延迟展示
*/
fun
show
(
activity
:
Activity
,
isDelay
:
Boolean
)
{
if
(
isDelay
&&
!
expertSearchPageHasShown
&&
timer
==
null
)
{
timer
=
Timer
()
timer
!!
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
showDialog
(
activity
)
expertSearchPageHasShown
=
true
}
},
10000
)
}
else
{
showDialog
(
activity
)
}
}
/**
* 展示浮层
*/
fun
showDialog
(
activity
:
Activity
)
{
fun
showDialog
(
activity
:
Activity
)
{
if
(
consultAssistantDialog
==
null
)
{
if
(
consultAssistantDialog
==
null
)
{
consultAssistantDialog
=
ConsultAssistantDialog
(
activity
,
object
:
ConsultAssistantDialog
.
OnConsultAssistantClickListener
{
consultAssistantDialog
=
ConsultAssistantDialog
(
activity
,
object
:
ConsultAssistantDialog
.
OnConsultAssistantClickListener
{
...
@@ -34,12 +91,25 @@ class ConsultAssistantDialogUtils private constructor(){
...
@@ -34,12 +91,25 @@ class ConsultAssistantDialogUtils private constructor(){
consultAssistantDialog
!!
.
show
()
consultAssistantDialog
!!
.
show
()
}
}
fun
hideDialog
()
{
consultAssistantDialog
?.
dismiss
()
/**
consultAssistantDialog
=
null
* 隐藏
*/
fun
hide
()
{
consultAssistantDialog
?.
hide
()
}
/**
* 重置本单例关于专家咨询列表页面得状态
*/
fun
resetStatus
()
{
timer
?.
cancel
()
timer
=
null
expertSearchPageHasShown
=
false
}
}
private
fun
getConsultAssistantUid
(
activity
:
Activity
)
{
private
fun
getConsultAssistantUid
(
activity
:
Activity
)
{
// 请求接口获取咨询助理的uid
SearchApi
.
getSearchApi
().
getConsultAssistantUidRequest
()
SearchApi
.
getSearchApi
().
getConsultAssistantUidRequest
()
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment