Commit cbf4e55e by 徐健

导医更新

parent e3a47371
......@@ -44,7 +44,7 @@ ext {
//第三步 若干
"m-confide" : "0.0.31.10",
"m-consultant" : "0.0.44.13",
"m-consultant" : "0.0.44.19",
"m-fm" : "0.0.21",
"m-user" : "0.0.37",
......
......@@ -6,6 +6,7 @@ import android.animation.ObjectAnimator
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.view.Gravity
import android.view.View
import android.view.ViewTreeObserver
......@@ -21,11 +22,12 @@ import kotlinx.android.synthetic.main.consultant_expert_consult_assistant_popup_
*/
class ConsultAssistantDialog(
context: Context,
mContext: Context,
val consultAssistantClickListener: OnConsultAssistantClickListener?
) : Dialog(context, R.style.consultant_expert_dialog_default_style) {
) : Dialog(mContext, R.style.consultant_expert_dialog_default_style) {
private var animate: ObjectAnimator? = null
private var minWidth: Int? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -44,9 +46,14 @@ class ConsultAssistantDialog(
if (!ConsultAssistantDialogUtils.INSTANCE.canShowDesc()) {
consultant_assistant_dialog_desc_ll.visibility =View.GONE
consultant_assistant_dialog_desc_outside_ll.visibility = View.GONE
// refreshDialogLayout()
}
consultant_assistant_dialog_close.setOnClickListener {
if (minWidth == null) {
minWidth = (consultant_assistant.measuredWidth * 1.5).toInt()
}
//一个dialog关闭左侧desc,所有导医左侧desc都关闭
SharedPreferencesEditor.putString(
ConsultAssistantDialogUtils.INSTANCE.ASSISTANT_DIALOG_SP_TAG,
......@@ -59,13 +66,19 @@ class ConsultAssistantDialog(
consultant_assistant_dialog_desc_ll.measuredWidth.toFloat()
)
animate?.setDuration(700)?.start()
animate?.setDuration(900)?.start()
animate?.addListener(object : Animator.AnimatorListener {
override fun onAnimationRepeat(animation: Animator?) {
}
override fun onAnimationEnd(animation: Animator?) {
ConsultAssistantDialogUtils.INSTANCE.setDescHide()
hide()
// show()
Handler().postDelayed({
show()
}, 10)
}
override fun onAnimationCancel(animation: Animator?) {
......@@ -87,7 +100,23 @@ class ConsultAssistantDialog(
if(null != consultant_assistant_dialog_desc_ll) {
consultant_assistant_dialog_desc_ll.visibility = View.GONE
consultant_assistant_dialog_desc_outside_ll.visibility = View.GONE
refreshDialogLayout()
}
}
// 刷新dialog布局,减小拦截点击区域
fun refreshDialogLayout() {
val params = window.attributes
if (minWidth == null) {
minWidth = (consultant_assistant.measuredWidth * 1.5).toInt()
}
params.width = minWidth!!
params.height = WindowManager.LayoutParams.WRAP_CONTENT
params.gravity = Gravity.RIGHT + Gravity.BOTTOM
params.verticalMargin = 0.07f
params.horizontalMargin = 0.01f
window.setWindowAnimations(0)
window.attributes = params
}
interface OnConsultAssistantClickListener {
......
......@@ -105,10 +105,6 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantDialogFromHomePage?.setDescHide()
}
consultAssistantDialogFromHomePage?.show()
}
}
......@@ -168,9 +164,6 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantFragmentDialog?.setDescHide()
}
consultAssistantFragmentDialog?.show()
}
} else {
......@@ -192,9 +185,6 @@ class ConsultAssistantDialogUtils private constructor() {
})
}
if (!canShowDesc()) {
consultAssistantActivityDialog?.setDescHide()
}
consultAssistantActivityDialog?.show()
}
}
......
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