From bb1c075225587618cc218ff99c8102d4c2b22bb8 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 19 Nov 2021 12:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9home=E9=94=AE=EF=BC=8Cdialog?= =?UTF-8?q?=E4=B8=8D=E6=B6=88=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/hmi/ui/notice/NoticeCheckDialog.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt index 467e6c1e12..b97bed7717 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt @@ -7,9 +7,11 @@ import android.util.Log import android.view.View import android.widget.ImageView import android.widget.TextView +import androidx.lifecycle.LifecycleObserver import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer +import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.dialog.BaseFloatDialog import com.mogo.service.IMogoServiceApis import com.mogo.service.statusmanager.IMogoStatusChangedListener @@ -25,7 +27,7 @@ import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack * @brief 点击查看对话框 * @author lixiaopeng */ -class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { +class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver{ private val TAG = "NoticeCheckDialog" private var pushCheckClose: ImageView? = null @@ -39,7 +41,7 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { private var mVideoUrl: String = "" private var playErrorImageView: ImageView? = null private var connectTextView: TextView? = null - private val mServiceApis: IMogoServiceApis? = null + private var mServiceApis: IMogoServiceApis? = null private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue -> if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) { dismiss() @@ -49,6 +51,7 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { init { setContentView(R.layout.notice_dialog_check_with_accessory) setCanceledOnTouchOutside(true) + pushCheckClose = findViewById(R.id.module_push_dialog_close) pushCheckTitle = findViewById(R.id.module_push_dialog_acc_title) pushCheckContent = findViewById(R.id.module_push_dialog_bottom_title) @@ -88,11 +91,9 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) { pushVideo!!.visibility = View.VISIBLE playVideo(mVideoUrl) } - mServiceApis?.statusManagerApi?.registerStatusChangedListener( - TAG, - StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, - statusChangedListenerForCheckNotice - ) + + mServiceApis = MogoApisHandler.getInstance().apis + mServiceApis?.getStatusManagerApi()?.registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice) }