Commit e3a47371 by 徐健

导医更新

parent ddff9e01
......@@ -44,7 +44,7 @@ ext {
//第三步 若干
"m-confide" : "0.0.31.10",
"m-consultant" : "0.0.44",
"m-consultant" : "0.0.44.13",
"m-fm" : "0.0.21",
"m-user" : "0.0.37",
......@@ -71,7 +71,7 @@ ext {
"ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11",
"m-audioim" : "0.0.31.11",
"m-audioim" : "0.0.31.12",
//以下 几乎不会动
"router" : "0.0.1",
......
......@@ -163,6 +163,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//频道管理器
private var channelManager : ChannelManager? = null
private var isLeavelChannel:Boolean = false
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
......@@ -932,12 +934,15 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 声网离开频道
*/
private fun leaveChannel() {
if (!isLeavelChannel) {
isLeavelChannel = true
//刷新h5页面
EventBus.getDefault().post(RefreshWebEvent(false))
stopPlaying()
//播放结束音频
playFinishMusic()
}
}
override fun onResume() {
super.onResume()
......
package com.yidianling.consultant.dialog
import android.animation.Animator
import android.animation.ObjectAnimator
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.ViewTreeObserver
import android.view.WindowManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.consultant.R
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
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_
* 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?) {
super.onCreate(savedInstanceState)
......@@ -31,14 +42,55 @@ class ConsultAssistantDialog(context: Context, val consultAssistantClickListener
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()
}
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 {
fun onClickAction() //隐私设置
fun onClickAction()
}
}
\ No newline at end of file
package com.yidianling.consultant.modular.singlton
import android.app.Activity
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.dialog.ConsultAssistantDialog
......@@ -26,7 +29,7 @@ class ConsultAssistantDialogUtils private constructor() {
var expertSearchPageHasShown: Boolean = false // 专家咨询列表fragment页面是否已经展示
var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog
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() {
/**
* 判断是否符合接口展示逻辑
*/
private fun shouldShowDialog(activity: Activity, origin: String, isDelay: Boolean = false, fromActivity: Boolean = false) {
// 请求接口判断导医咨询助理按钮是否展示
SearchApi.getSearchApi().getConsultAssistantRequest(origin)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
if (it.data) {
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)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe {
// if (it.data) {
// if (origin == "home_index") {
// showFromYdlHome(activity)
// } else if (origin == "doctor_list") {
// show(activity, fromActivity)
// }
// }
// }
}
////////////////////////////////////// 首页的展示隐藏逻辑 代码块start ///////////////////////////////////////////////////
......@@ -90,6 +105,10 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantDialogFromHomePage?.setDescHide()
}
consultAssistantDialogFromHomePage?.show()
}
}
......@@ -110,32 +129,16 @@ class ConsultAssistantDialogUtils private constructor() {
fun show(activity: Activity, fromActivity: Boolean = false) {
// 来自于fragment咨询师列表
if (!fromActivity) {
if (!expertSearchPageHasShown && timer == null) {
timer = Timer()
timer!!.schedule(object : TimerTask() {
override fun run() {
Observable.just(1).observeOn(AndroidSchedulers.mainThread())
.subscribe {
if (!expertSearchPageHasShown) {
expertSearchPageHasShown = true
showDialog(activity)
}
}
}, 5000)
} else {
showDialog(activity)
}
}else {// 来自于activity咨询师列表
if (!expertSearchActivityPageHasShown && timer == null) {
timer = Timer()
timer!!.schedule(object : TimerTask() {
override fun run() {
Observable.just(1).observeOn(AndroidSchedulers.mainThread())
.subscribe {
} else {// 来自于activity咨询师列表
if (!expertSearchActivityPageHasShown) {
expertSearchActivityPageHasShown = true
showDialog(activity, true)
}
}
}, 5000)
} else {
showDialog(activity, true)
}
......@@ -165,9 +168,12 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantFragmentDialog?.setDescHide()
}
consultAssistantFragmentDialog?.show()
}
}else {
} else {
if (!activity.isFinishing) {
if (consultAssistantActivityDialog == null) {
consultAssistantActivityDialog = ConsultAssistantDialog(
......@@ -186,6 +192,9 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantActivityDialog?.setDescHide()
}
consultAssistantActivityDialog?.show()
}
}
......@@ -208,8 +217,7 @@ class ConsultAssistantDialogUtils private constructor() {
consultAssistantDialogFromHomePage?.dismiss()
consultAssistantFragmentDialog?.dismiss()
consultAssistantActivityDialog?.dismiss()
timer?.cancel()
timer = null
expertSearchPageHasShown = false
expertSearchActivityPageHasShown = false
consultAssistantDialogFromHomePage = null
......@@ -222,8 +230,7 @@ class ConsultAssistantDialogUtils private constructor() {
*/
fun expertSearchResetStatus() {
consultAssistantActivityDialog?.dismiss()
timer?.cancel()
timer = null
expertSearchActivityPageHasShown = false
consultAssistantActivityDialog = null
}
......@@ -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"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="60dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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
android:id="@+id/consult_assistant"
android:layout_width="66dp"
android:layout_height="68dp"
android:id="@+id/consultant_assistant"
android:layout_width="61dp"
android:layout_height="101dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:scaleType="centerCrop"
android:src="@drawable/consultant_expert_consult_assistant_img"/>
android:src="@drawable/consultant_assistant_dialog_img"
android:paddingBottom="40dp" />
</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