Commit e3a47371 by 徐健

导医更新

parent ddff9e01
...@@ -44,7 +44,7 @@ ext { ...@@ -44,7 +44,7 @@ ext {
//第三步 若干 //第三步 若干
"m-confide" : "0.0.31.10", "m-confide" : "0.0.31.10",
"m-consultant" : "0.0.44", "m-consultant" : "0.0.44.13",
"m-fm" : "0.0.21", "m-fm" : "0.0.21",
"m-user" : "0.0.37", "m-user" : "0.0.37",
...@@ -71,7 +71,7 @@ ext { ...@@ -71,7 +71,7 @@ ext {
"ydl-webview" : "0.0.28", "ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14", "ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11", "ydl-pay" : "0.0.11",
"m-audioim" : "0.0.31.11", "m-audioim" : "0.0.31.12",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
......
...@@ -162,6 +162,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -162,6 +162,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//频道管理器 //频道管理器
private var channelManager : ChannelManager? = null private var channelManager : ChannelManager? = null
private var isLeavelChannel:Boolean = false
/** /**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等) * 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
...@@ -932,11 +934,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -932,11 +934,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 声网离开频道 * 声网离开频道
*/ */
private fun leaveChannel() { private fun leaveChannel() {
//刷新h5页面 if (!isLeavelChannel) {
EventBus.getDefault().post(RefreshWebEvent(false)) isLeavelChannel = true
stopPlaying() //刷新h5页面
//播放结束音频 EventBus.getDefault().post(RefreshWebEvent(false))
playFinishMusic() stopPlaying()
//播放结束音频
playFinishMusic()
}
} }
override fun onResume() { override fun onResume() {
......
package com.yidianling.consultant.dialog package com.yidianling.consultant.dialog
import android.animation.Animator
import android.animation.ObjectAnimator
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.view.Gravity import android.view.Gravity
import android.view.View
import android.view.ViewTreeObserver
import android.view.WindowManager import android.view.WindowManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.consultant.R import com.yidianling.consultant.R
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_window.* import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_window.*
/** /**
...@@ -14,7 +20,12 @@ import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_ ...@@ -14,7 +20,12 @@ import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_
* Created by xj on 2019/10/30. * Created by xj on 2019/10/30.
*/ */
class ConsultAssistantDialog(context: Context, val consultAssistantClickListener: OnConsultAssistantClickListener?) : Dialog(context, R.style.consultant_expert_dialog_default_style) { class ConsultAssistantDialog(
context: Context,
val consultAssistantClickListener: OnConsultAssistantClickListener?
) : Dialog(context, R.style.consultant_expert_dialog_default_style) {
private var animate: ObjectAnimator? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -31,14 +42,55 @@ class ConsultAssistantDialog(context: Context, val consultAssistantClickListener ...@@ -31,14 +42,55 @@ class ConsultAssistantDialog(context: Context, val consultAssistantClickListener
window.setWindowAnimations(R.style.consultant_expert_consult_assistant_dialog_animate) window.setWindowAnimations(R.style.consultant_expert_consult_assistant_dialog_animate)
consult_assistant.setOnClickListener { if (!ConsultAssistantDialogUtils.INSTANCE.canShowDesc()) {
consultant_assistant_dialog_desc_ll.visibility =View.GONE
}
consultant_assistant_dialog_close.setOnClickListener {
//一个dialog关闭左侧desc,所有导医左侧desc都关闭
SharedPreferencesEditor.putString(
ConsultAssistantDialogUtils.INSTANCE.ASSISTANT_DIALOG_SP_TAG,
System.currentTimeMillis().toString()
)
animate = ObjectAnimator.ofFloat(
consultant_assistant_dialog_desc_ll,
"translationX",
0.0f,
consultant_assistant_dialog_desc_ll.measuredWidth.toFloat()
)
animate?.setDuration(700)?.start()
animate?.addListener(object : Animator.AnimatorListener {
override fun onAnimationRepeat(animation: Animator?) {
}
override fun onAnimationEnd(animation: Animator?) {
ConsultAssistantDialogUtils.INSTANCE.setDescHide()
}
override fun onAnimationCancel(animation: Animator?) {
}
override fun onAnimationStart(animation: Animator?) {
}
})
}
consultant_assistant.setOnClickListener {
consultAssistantClickListener?.onClickAction() consultAssistantClickListener?.onClickAction()
} }
setCanceledOnTouchOutside(false) setCanceledOnTouchOutside(false)
} }
public fun setDescHide() {
if(null != consultant_assistant_dialog_desc_ll) {
consultant_assistant_dialog_desc_ll.visibility = View.GONE
consultant_assistant_dialog_desc_outside_ll.visibility = View.GONE
}
}
interface OnConsultAssistantClickListener { interface OnConsultAssistantClickListener {
fun onClickAction() //隐私设置 fun onClickAction()
} }
} }
\ No newline at end of file
package com.yidianling.consultant.modular.singlton package com.yidianling.consultant.modular.singlton
import android.app.Activity import android.app.Activity
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YdlBuryPointUtil import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.dialog.ConsultAssistantDialog import com.yidianling.consultant.dialog.ConsultAssistantDialog
...@@ -26,7 +29,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -26,7 +29,7 @@ class ConsultAssistantDialogUtils private constructor() {
var expertSearchPageHasShown: Boolean = false // 专家咨询列表fragment页面是否已经展示 var expertSearchPageHasShown: Boolean = false // 专家咨询列表fragment页面是否已经展示
var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog
var expertSearchActivityPageHasShown: Boolean = false // 专家咨询列表activity页面是否已经展示 var expertSearchActivityPageHasShown: Boolean = false // 专家咨询列表activity页面是否已经展示
var timer: Timer? = null var ASSISTANT_DIALOG_SP_TAG = "assistant_dialog_sp_tag" // 是否展示左侧文本的缓存key
/** /**
...@@ -55,20 +58,32 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -55,20 +58,32 @@ class ConsultAssistantDialogUtils private constructor() {
/** /**
* 判断是否符合接口展示逻辑 * 判断是否符合接口展示逻辑
*/ */
private fun shouldShowDialog(activity: Activity, origin: String, isDelay: Boolean = false, fromActivity: Boolean = false) { private fun shouldShowDialog(
activity: Activity,
origin: String,
fromActivity: Boolean = false
) {
//todo xj打release包的时候需要打开
if (origin == "home_index") {
showFromYdlHome(activity)
} else if (origin == "doctor_list") {
show(activity, fromActivity)
}
// 请求接口判断导医咨询助理按钮是否展示 // 请求接口判断导医咨询助理按钮是否展示
SearchApi.getSearchApi().getConsultAssistantRequest(origin) // SearchApi.getSearchApi().getConsultAssistantRequest(origin)
.subscribeOn(Schedulers.io()) // .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.subscribe { // .subscribe {
if (it.data) { // if (it.data) {
if (origin == "home_index") { // if (origin == "home_index") {
showFromYdlHome(activity) // showFromYdlHome(activity)
} else if (origin == "doctor_list") { // } else if (origin == "doctor_list") {
show(activity, fromActivity) // show(activity, fromActivity)
} // }
} // }
} // }
} }
////////////////////////////////////// 首页的展示隐藏逻辑 代码块start /////////////////////////////////////////////////// ////////////////////////////////////// 首页的展示隐藏逻辑 代码块start ///////////////////////////////////////////////////
...@@ -80,15 +95,19 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -80,15 +95,19 @@ class ConsultAssistantDialogUtils private constructor() {
if (!activity.isFinishing) { if (!activity.isFinishing) {
if (consultAssistantDialogFromHomePage == null) { if (consultAssistantDialogFromHomePage == null) {
consultAssistantDialogFromHomePage = ConsultAssistantDialog( consultAssistantDialogFromHomePage = ConsultAssistantDialog(
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
//获取用户uid //获取用户uid
YdlBuryPointUtil.sendClick("home_page_assistant_click") YdlBuryPointUtil.sendClick("home_page_assistant_click")
getConsultAssistantUid(activity) getConsultAssistantUid(activity)
} }
}) })
}
if (!canShowDesc()) {
consultAssistantDialogFromHomePage?.setDescHide()
} }
consultAssistantDialogFromHomePage?.show() consultAssistantDialogFromHomePage?.show()
} }
...@@ -110,32 +129,16 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -110,32 +129,16 @@ class ConsultAssistantDialogUtils private constructor() {
fun show(activity: Activity, fromActivity: Boolean = false) { fun show(activity: Activity, fromActivity: Boolean = false) {
// 来自于fragment咨询师列表 // 来自于fragment咨询师列表
if (!fromActivity) { if (!fromActivity) {
if (!expertSearchPageHasShown && timer == null) { if (!expertSearchPageHasShown) {
timer = Timer() expertSearchPageHasShown = true
timer!!.schedule(object : TimerTask() { showDialog(activity)
override fun run() {
Observable.just(1).observeOn(AndroidSchedulers.mainThread())
.subscribe {
expertSearchPageHasShown = true
showDialog(activity)
}
}
}, 5000)
} else { } else {
showDialog(activity) showDialog(activity)
} }
}else {// 来自于activity咨询师列表 } else {// 来自于activity咨询师列表
if (!expertSearchActivityPageHasShown && timer == null) { if (!expertSearchActivityPageHasShown) {
timer = Timer() expertSearchActivityPageHasShown = true
timer!!.schedule(object : TimerTask() { showDialog(activity, true)
override fun run() {
Observable.just(1).observeOn(AndroidSchedulers.mainThread())
.subscribe {
expertSearchActivityPageHasShown = true
showDialog(activity, true)
}
}
}, 5000)
} else { } else {
showDialog(activity, true) showDialog(activity, true)
} }
...@@ -150,41 +153,47 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -150,41 +153,47 @@ class ConsultAssistantDialogUtils private constructor() {
if (!activity.isFinishing) { if (!activity.isFinishing) {
if (consultAssistantFragmentDialog == null) { if (consultAssistantFragmentDialog == null) {
consultAssistantFragmentDialog = ConsultAssistantDialog( consultAssistantFragmentDialog = ConsultAssistantDialog(
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
YdlBuryPointUtil.sendClick("assistant_list_click") YdlBuryPointUtil.sendClick("assistant_list_click")
// 咨询师列表页面且未登录情况下,跳转登录页面 // 咨询师列表页面且未登录情况下,跳转登录页面
if (!ConsultantIn.isLogin()) { if (!ConsultantIn.isLogin()) {
ConsultantIn.toLogin(activity) ConsultantIn.toLogin(activity)
} else { } else {
//获取用户uid //获取用户uid
getConsultAssistantUid(activity) getConsultAssistantUid(activity)
}
} }
}
}) })
}
if (!canShowDesc()) {
consultAssistantFragmentDialog?.setDescHide()
} }
consultAssistantFragmentDialog?.show() consultAssistantFragmentDialog?.show()
} }
}else { } else {
if (!activity.isFinishing) { if (!activity.isFinishing) {
if (consultAssistantActivityDialog == null) { if (consultAssistantActivityDialog == null) {
consultAssistantActivityDialog = ConsultAssistantDialog( consultAssistantActivityDialog = ConsultAssistantDialog(
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
YdlBuryPointUtil.sendClick("assistant_list_click") YdlBuryPointUtil.sendClick("assistant_list_click")
// 咨询师列表页面且未登录情况下,跳转登录页面 // 咨询师列表页面且未登录情况下,跳转登录页面
if (!ConsultantIn.isLogin()) { if (!ConsultantIn.isLogin()) {
ConsultantIn.toLogin(activity) ConsultantIn.toLogin(activity)
} else { } else {
//获取用户uid //获取用户uid
getConsultAssistantUid(activity) getConsultAssistantUid(activity)
}
} }
}
}) })
}
if (!canShowDesc()) {
consultAssistantActivityDialog?.setDescHide()
} }
consultAssistantActivityDialog?.show() consultAssistantActivityDialog?.show()
} }
...@@ -208,8 +217,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -208,8 +217,7 @@ class ConsultAssistantDialogUtils private constructor() {
consultAssistantDialogFromHomePage?.dismiss() consultAssistantDialogFromHomePage?.dismiss()
consultAssistantFragmentDialog?.dismiss() consultAssistantFragmentDialog?.dismiss()
consultAssistantActivityDialog?.dismiss() consultAssistantActivityDialog?.dismiss()
timer?.cancel()
timer = null
expertSearchPageHasShown = false expertSearchPageHasShown = false
expertSearchActivityPageHasShown = false expertSearchActivityPageHasShown = false
consultAssistantDialogFromHomePage = null consultAssistantDialogFromHomePage = null
...@@ -222,8 +230,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -222,8 +230,7 @@ class ConsultAssistantDialogUtils private constructor() {
*/ */
fun expertSearchResetStatus() { fun expertSearchResetStatus() {
consultAssistantActivityDialog?.dismiss() consultAssistantActivityDialog?.dismiss()
timer?.cancel()
timer = null
expertSearchActivityPageHasShown = false expertSearchActivityPageHasShown = false
consultAssistantActivityDialog = null consultAssistantActivityDialog = null
} }
...@@ -243,4 +250,23 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -243,4 +250,23 @@ class ConsultAssistantDialogUtils private constructor() {
} }
} }
} }
// 判定是否展示左侧的描述文本
fun canShowDesc(): Boolean {
if (TextUtils.isEmpty(SharedPreferencesEditor.getString(ASSISTANT_DIALOG_SP_TAG))) {
//如果没有缓存,则展示
return true
//todo xj 把时间从20秒改为一天
}else if (System.currentTimeMillis() - SharedPreferencesEditor.getString(ASSISTANT_DIALOG_SP_TAG).toLong() > 20 * 1000) {
//如果缓存时间超过一天,则展示
return true
}
return false
}
fun setDescHide() {
consultAssistantDialogFromHomePage?.setDescHide()
consultAssistantActivityDialog?.setDescHide()
consultAssistantFragmentDialog?.setDescHide()
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="22dp"
android:bottomLeftRadius="22dp"/>
<gradient
android:angle="0"
android:startColor="#DDFF7A5C"
android:endColor="#DDFF406C"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingBottom="60dp" android:layout_height="wrap_content"
android:paddingRight="11dp"> android:paddingRight="11dp">
<LinearLayout
android:id="@+id/consultant_assistant_dialog_desc_outside_ll"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="25dp"
android:clipChildren="true"
android:gravity="center"
android:orientation="horizontal"
android:paddingRight="25dp"
android:paddingBottom="40dp">
<LinearLayout
android:id="@+id/consultant_assistant_dialog_desc_ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/consultant_assistant_dialog_text_bg"
android:gravity="center">
<ImageView
android:id="@+id/consultant_assistant_dialog_close"
android:layout_width="35dp"
android:layout_height="30dp"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp"
android:src="@drawable/consultant_assistant_dialog_close_icon" />
<View
android:layout_width="0.5dp"
android:layout_height="26dp"
android:layout_marginRight="8dp"
android:background="#ffffff" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="不知道如何选择?"
android:textColor="#ffffff"
android:textSize="12dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="为你精准匹配咨询师 "
android:textColor="#ffffff"
android:textSize="12dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@drawable/consultant_assistant_dialog_go_icon" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView <ImageView
android:id="@+id/consult_assistant" android:id="@+id/consultant_assistant"
android:layout_width="66dp" android:layout_width="61dp"
android:layout_height="68dp" android:layout_height="101dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/consultant_expert_consult_assistant_img"/> android:src="@drawable/consultant_assistant_dialog_img"
android:paddingBottom="40dp" />
</RelativeLayout> </RelativeLayout>
\ 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