diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 92845955ea..2ae8c4c315 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -21,7 +21,6 @@ import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView -import com.mogo.eagle.core.function.hmi.ui.notice.NoticeFloatView import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView import com.mogo.module.common.enums.EventTypeEnum diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java index 0228e80e54..bbd1bb68f5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java @@ -14,6 +14,8 @@ import androidx.constraintlayout.widget.ConstraintLayout; import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.hmi.R; +import com.mogo.eagle.core.function.hmi.WaringConst; +import com.mogo.eagle.core.function.hmi.notification.WarningFloat; import com.mogo.eagle.core.utilcode.util.SharedPrefs; /** @@ -72,6 +74,7 @@ public class NoticeBannerView extends ConstraintLayout { noticeBannerCheck.setOnClickListener(v -> { mNoticeTrafficDialog = new NoticeTrafficDialog(mContext, mPushData); mNoticeTrafficDialog.show(); + WarningFloat.dismiss(WaringConst.MODULE_NAME); }); } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt deleted file mode 100644 index cf9b45d759..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeFloatView.kt +++ /dev/null @@ -1,267 +0,0 @@ -package com.mogo.eagle.core.function.hmi.ui.notice - -import android.content.Context -import android.os.Handler -import android.os.Looper -import android.util.Log -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.ImageView -import android.widget.TextView -import androidx.annotation.LayoutRes -import com.mogo.commons.context.ContextHolderUtil -import com.mogo.eagle.core.data.notice.NoticeNormalData -import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.function.hmi.ui.utils.getApis -import com.mogo.eagle.core.function.hmi.ui.utils.gone -import com.mogo.eagle.core.function.hmi.ui.utils.visible -import com.mogo.eagle.core.utilcode.util.SharedPrefs -import com.mogo.service.windowview.IMogoTopViewManager -import com.mogo.service.windowview.IMogoTopViewStatusListener -import com.mogo.utils.glide.GlideApp -import com.mogo.utils.glide.GlideRoundedCornersTransform - -/** - * 云公告弹框view - * 未来可能删除,这种是老的实现方式 - */ -class NoticeFloatView constructor( - private val context: Context -) { - companion object { - const val TYPE_TOP_VIEW = 1 - const val TYPE_WINDOW_MANAGER = 2 - const val TAG: String = "FloatView.kt" - } - - interface PushViewController { - fun show(bean: NoticeNormalData?) - fun hide() - fun inflateView(@LayoutRes layoutId: Int) - } - - abstract inner class PushView(context: Context) : FrameLayout(context), - PushViewController { - private lateinit var titleIconContainer: View - private lateinit var pushTitle: TextView - private lateinit var pushImage: ImageView - private lateinit var pushContent: TextView - private lateinit var pushCheck: TextView - private var pushData: NoticeNormalData? = null - private lateinit var playIcon: ImageView - - override fun inflateView(layoutId: Int) { - LayoutInflater.from(context).inflate(layoutId, this, true) - pushTitle = findViewById(R.id.notice_push_title) - pushCheck = findViewById(R.id.notice_push_banner_check) - pushImage = findViewById(R.id.notice_push_style_image) //图片 - playIcon = findViewById(R.id.notice_push_icon_video) //视频指示图 - pushContent = findViewById(R.id.notice_push_content) - titleIconContainer = findViewById(R.id.module_push_app_icon_title) - - //查看结果 - pushCheck.setOnClickListener { - pushData?.let { - if (pushCheckDialog == null) { - pushCheckDialog = NoticeCheckDialog(ContextHolderUtil.getContext()) - } - pushCheckDialog!!.showCheckDialog(it) - } - - //弹框消失 - hide() - } - } - - open fun setBean(bean: NoticeNormalData) { - pushData = bean - - if (bean.fileType == 2) { - playIcon.visibility = View.VISIBLE - } else { - playIcon.visibility = View.GONE - } - - // title - pushTitle.text = bean.title - - val params = pushImage.layoutParams - params.width = getImgWidth() - params.height = getImgHeight() - pushImage.layoutParams = params - pushImage.visible() - GlideApp.with(this).load(bean.imageUrl).optionalTransform(GlideRoundedCornersTransform(30f, GlideRoundedCornersTransform.CornerType.LEFT)).into(pushImage) - - // content - if (bean.content.isEmpty()) { - pushContent.gone() - } else { - pushContent.text = bean.content - pushContent.visible() - } - - // 产品侧需要重新梳理,tts暂时不播报 -// if (bean.tts.isNotEmpty()) { -// AIAssist.getInstance(context).speakTTSVoice(bean.tts) -// } - } - - abstract fun getImgWidth(): Int - abstract fun getImgHeight(): Int - abstract fun getQrImgWidth(): Int - abstract fun getQrImgHeight(): Int - - override fun show(bean: NoticeNormalData?) { - isAddWindow = true - uiHandler.removeCallbacks(delayClosePush) - } - - override fun hide() { - isAddWindow = false - } - } - - - open inner class PushViewInTopView(context: Context) : PushView(context) { - private val mTopViewManager: IMogoTopViewManager = getApis(context).topViewManager - - init { - inflateView(R.layout.notice_push_top_banner) - } - - private var topViewStatusListener = object : IMogoTopViewStatusListener { - override fun onViewRemoved(view: View?) { - isAddWindow = false - } - - override fun onViewAdded(view: View?) { - - } - - override fun beforeViewRemoveAnim(view: View?) { - } - - override fun beforeViewAddAnim(view: View?) { - } - } - - override fun show(bean: NoticeNormalData?) { - super.show(bean) - mLastVisibleType = TYPE_TOP_VIEW - mTopViewManager.addView(this, topViewStatusListener) - setBean(bean!!) - } - - override fun hide() { - super.hide() - mTopViewManager.removeView(this) - } - - override fun getImgWidth(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width) - - override fun getImgHeight(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - - override fun getQrImgWidth(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - - override fun getQrImgHeight(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - } - - private var pushCheckDialog: NoticeCheckDialog? = null - private val delayClosePush: Runnable - private var isAddWindow = false - private val uiHandler = Handler(Looper.getMainLooper()) - - private var currentBean: NoticeNormalData? = null - private var mLastVisibleType = -1 - private var pushViewController: PushViewController? = null - - init { - delayClosePush = Runnable { - hide() - } - } - - - fun pushBeanChanged(bean: NoticeNormalData?) { - uiHandler.post { - uiHandler.removeCallbacks(delayClosePush) - if (bean == null) { - hide() - } else { - show(bean) - } - currentBean = bean - } - } - - private fun show(bean: NoticeNormalData) { - if (isAddWindow) { - if (getApis(context).statusManagerApi.isMainPageOnResume) { - if (mLastVisibleType != TYPE_TOP_VIEW) { - hide() - (pushViewController as View).postDelayed({ - show(bean) - }, 750L) - } else { - showByTopView(bean) - } - } else { - if (mLastVisibleType != TYPE_WINDOW_MANAGER) { - hide() - (pushViewController as View).postDelayed({ - show(bean) - }, 750L) - } else { - showByWindowManager(bean) - } - } - startClosePush() - } else { - if (getApis(context).statusManagerApi.isMainPageOnResume) { - showByTopView(bean) - startClosePush() - } else { - showByWindowManager(bean) - } - } - } - - private fun showByTopView(bean: NoticeNormalData) { - if (pushViewController !is PushViewInTopView) { - pushViewController = PushViewInTopView(context) - } - pushViewController?.show(bean) - } - - private fun showByWindowManager(bean: NoticeNormalData?) { -// if (pushViewController !is PushViewInWindowView) { -// pushViewController = PushViewInWindowView(context) -// } -// pushViewController?.show(bean) - } - - private fun startClosePush() { - uiHandler.removeCallbacks(delayClosePush) - uiHandler.postDelayed( - delayClosePush, - 10000L - ) - } - - private fun hide() { - if (!isAddWindow) { - return - } - try { - pushViewController?.hide() - } catch (e: Exception) { - e.printStackTrace() - } - } - -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java index ae9e3ee3f5..6eaa3c603b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java @@ -15,6 +15,8 @@ import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.hmi.R; +import com.mogo.eagle.core.function.hmi.WaringConst; +import com.mogo.eagle.core.function.hmi.notification.WarningFloat; import com.mogo.eagle.core.utilcode.util.SharedPrefs; import com.mogo.utils.glide.GlideApp; import com.mogo.utils.glide.GlideRoundedCornersTransform; @@ -79,6 +81,8 @@ public class NoticeNormalBannerView extends ConstraintLayout { pushCheckDialog = new NoticeCheckDialog(mContext); } pushCheckDialog.showCheckDialog(mPushData); + + WarningFloat.dismiss(WaringConst.MODULE_NAME); }); } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_push_item.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_push_item.xml deleted file mode 100644 index 93ba3700da..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_module_push_item.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml index 2175f06619..98f89b3107 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml @@ -33,132 +33,5 @@ 580px 588px 1066px - - - 16px - 352px - 32px - 32px - 16.5px - 12px - 20px - 18px - 210px - 13px - 15px - 18px - 320px - 180px - 16px - 320px - 160px - 9px - 20px - 0px - 48px - 10px - 14px - 50px - 20px - 20px - 90px - 5px - 84px - 38px - 36px - 100px - 64px - 24px - 16px - 44px - 2px - 20px - 27px - 16px - 64px - 8px - 16px - - 22px - 27px - 14px - 1.5px - 24px - 10px - 8px - 560px - 194px - 266px - 178px - 8px - 12px - 16px - 6px - 19px - 30px - 16px - 8px - 17px - 19px - 16px - 11px - 6px - 18px - 10px - 17px - 10px - 8px - 242px - 270px - 374px - 24px - 19px - 8px - 328px - 164px - 15px - 150px - 20px - 0px - 310px - 350px - 60px - 2px - 2px - 8px - 28px - 16px - 16px - 12px - 5px - 118px - 86px - 8px - - - 34px - 567px - 120px - - 2px - 120px - 30px - 55px - 42px - 208px - - 1200px - 763px - 32px - 107px - 107px - 40px - 54px - 56px - 1000px - 33px - 43px - 20px - - + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index 5934a76b6d..36a70d0ea6 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -66,7 +66,6 @@ class NoticeSocketManager { CallerHmiManager.INSTANCE.showNormalBanner(obj); } - }; /**