opt dialog

This commit is contained in:
lixiaopeng
2021-11-10 11:14:42 +08:00
parent 77f55180e6
commit f02fdc876f
7 changed files with 8 additions and 486 deletions

View File

@@ -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

View File

@@ -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);
});
}

View File

@@ -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()
}
}
}

View File

@@ -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);
});
}

View File

@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/module_push_ui_height"
android:layout_marginTop="@dimen/module_push_ui_margin_top"
android:background="@drawable/notice_item_background">
<com.mogo.eagle.core.function.hmi.ui.notice.roundimage.RoundedImageView
android:id="@+id/module_push_image"
android:layout_width="@dimen/module_push_ui_image_width"
android:layout_height="@dimen/module_push_ui_image_height"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:riv_corner_radius_bottom_left="@dimen/module_push_ui_image_corner"
app:riv_corner_radius_top_left="@dimen/module_push_ui_image_corner" />
<LinearLayout
android:id="@+id/module_push_app_icon_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_push_ui_app_icon_leftMargin"
android:layout_marginTop="@dimen/module_push_ui_app_icon_topMargin"
android:gravity="center_vertical"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/module_push_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginTop="@dimen/module_push_ui_app_icon_goneTopMargin">
<TextView
android:id="@+id/module_push_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical|left"
android:maxWidth="@dimen/module_push_title_mix_width"
android:maxLength="25"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="@dimen/module_push_ui_title_textSize"
app:layout_constrainedWidth="true"
tools:text="官方公告" />
<TextView
android:id="@+id/module_push_content"
android:layout_width="@dimen/module_push_ui_content_width"
android:layout_height="@dimen/module_push_ui_content_height"
android:ellipsize="end"
android:layout_marginTop="@dimen/module_push_ui_content_topMargin"
android:gravity="top|left"
android:maxLines="2"
android:text="这是测试数据,当前测试数据是为了查看换行的显示效果,如果最多3行呢,怎么显示的呢"
android:textColor="@android:color/white"
android:textSize="@dimen/module_push_ui_title_text_size" />
</LinearLayout>
<View
android:id="@+id/module_push_line"
android:layout_width="@dimen/module_push_line_width"
android:layout_height="@dimen/module_push_line_height"
android:layout_marginLeft="@dimen/dp_100"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/module_push_app_icon_title"
app:layout_constraintTop_toTopOf="parent" />
<!-- android:background="@color/module_push_item_line_color"-->
<TextView
android:id="@+id/module_push_check"
android:layout_width="@dimen/module_push_check_width"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/module_push_check_margin"
android:layout_marginBottom="@dimen/module_push_check_margin"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/motice_push_check"
android:textSize="@dimen/module_push_check_text_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_push_line"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- android:textColor="@color/module_push_check_color"-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -33,132 +33,5 @@
<dimen name="dp_580">580px</dimen>
<dimen name="dp_588">588px</dimen>
<dimen name="dp_1066">1066px</dimen>
<!--old-->
<dimen name="module_push_margin_top">16px</dimen>
<dimen name="module_push_size">352px</dimen>
<dimen name="module_push_margin_start">32px</dimen>
<dimen name="module_push_app_icon_size">32px</dimen>
<dimen name="module_push_app_icon_margin_start">16.5px</dimen>
<dimen name="module_push_title_margin_start">12px</dimen>
<dimen name="module_push_title_margin_top">20px</dimen>
<dimen name="module_push_title_text_size">18px</dimen>
<dimen name="module_push_title_mix_width">210px</dimen>
<dimen name="module_push_timer_margin_end">13px</dimen>
<dimen name="module_push_timer_text_size">15px</dimen>
<dimen name="module_push_timer_margin_top">18px</dimen>
<dimen name="module_push_image_width">320px</dimen>
<dimen name="module_push_image_height">180px</dimen>
<dimen name="module_push_image_margin_top">16px</dimen>
<dimen name="module_push_content_only_width">320px</dimen>
<dimen name="module_push_content_only_height">160px</dimen>
<dimen name="module_push_content_only_line_space">9px</dimen>
<dimen name="module_push_content_only_padding">20px</dimen>
<dimen name="module_push_button_width">0px</dimen>
<dimen name="module_push_button_height">48px</dimen>
<dimen name="module_push_button_margin_top">10px</dimen>
<dimen name="module_push_button_margin_bottom">14px</dimen>
<dimen name="module_push_activity_title_margin_top">50px</dimen>
<dimen name="module_push_activity_title_text_size">20px</dimen>
<dimen name="module_push_activity_close_margin_top">20px</dimen>
<dimen name="module_push_activity_close_margin_end">90px</dimen>
<dimen name="module_push_activity_close_padding">5px</dimen>
<dimen name="module_push_activity_recycler_view_margin_top">84px</dimen>
<dimen name="module_push_activity_not_data_text_size">38px</dimen>
<dimen name="module_push_activity_clear_margin_bottom">36px</dimen>
<dimen name="module_push_message_item_height">100px</dimen>
<dimen name="module_push_message_app_icon_size">64px</dimen>
<dimen name="module_push_message_margin_start">24px</dimen>
<dimen name="module_push_item_title_margin_top">16px</dimen>
<dimen name="module_push_item_title_gone_margin_bottom">44px</dimen>
<dimen name="module_push_item_title_margin_bottom">2px</dimen>
<dimen name="module_push_item_content_margin_end">20px</dimen>
<dimen name="module_push_item_content_margin_bottom">27px</dimen>
<dimen name="module_push_item_content_text_size">16px</dimen>
<dimen name="module_push_message_item_image_size">64px</dimen>
<dimen name="module_push_message_item_image_margin_end">8px</dimen>
<dimen name="module_push_massage_time_text_size">16px</dimen>
<dimen name="module_push_image_margin_bottom">22px</dimen>
<dimen name="module_push_button_radius">27px</dimen>
<dimen name="module_push_timer_inner_radius">14px</dimen>
<dimen name="module_push_timer_thickness">1.5px</dimen>
<dimen name="module_push_clear_bg_radius">24px</dimen>
<dimen name="module_push_image_radius">10px</dimen>
<dimen name="module_push_item_image_radius">8px</dimen>
<dimen name="module_push_item_content_width">560px</dimen>
<dimen name="module_push_ui_height">194px</dimen>
<dimen name="module_push_ui_image_width">266px</dimen>
<dimen name="module_push_ui_image_height">178px</dimen>
<dimen name="module_push_ui_image_marLeft">8px</dimen>
<dimen name="module_push_ui_app_icon_leftMargin">12px</dimen>
<dimen name="module_push_ui_app_icon_topMargin">16px</dimen>
<dimen name="module_push_ui_content_topMargin">6px</dimen>
<dimen name="module_push_ui_app_icon_goneTopMargin">19px</dimen>
<dimen name="module_push_ui_app_icon_size">30px</dimen>
<dimen name="module_push_ui_title_textSize">16px</dimen>
<dimen name="module_push_ui_decrease_timer_corner">8px</dimen>
<dimen name="module_push_progress_bar_frame_marginTop">17px</dimen>
<dimen name="module_push_progress_bar_frame_marginEnd">19px</dimen>
<dimen name="module_push_ui_timer_textSize">16px</dimen>
<dimen name="module_push_progress_bar_frame_padding">11px</dimen>
<dimen name="module_push_ui_content_marginTop">6px</dimen>
<dimen name="module_push_ui_title_text_size">18px</dimen>
<dimen name="module_push_ui_button_radius">10px</dimen>
<dimen name="module_push_ui_bkg_corner">17px</dimen>
<dimen name="module_push_button_right_marLeft">10px</dimen>
<dimen name="module_push_ui_image_corner">8px</dimen>
<dimen name="module_push_button_maxWidth">242px</dimen>
<dimen name="module_push_ui_height_vertical">270px</dimen>
<dimen name="module_push_ui_width_vertical">374px</dimen>
<dimen name="module_push_ui_app_icon_leftMargin_vertical">24px</dimen>
<dimen name="module_push_ui_app_icon_topMargin_vertical">19px</dimen>
<dimen name="module_push_image_marginTop_vertical">8px</dimen>
<dimen name="module_push_ui_image_width_vertical">328px</dimen>
<dimen name="module_push_ui_image_height_vertical">164px</dimen>
<dimen name="module_push_ui_content_marginTop_vertical">15px</dimen>
<dimen name="module_push_image_qr_size_vertical">150px</dimen>
<dimen name="module_push_window_x">20px</dimen>
<dimen name="module_push_window_y">0px</dimen>
<dimen name="module_push_item_minHeight_vertical">310px</dimen>
<dimen name="module_push_item_maxHeight_vertical">350px</dimen>
<dimen name="module_push_content_paddingBottom_vertical">60px</dimen>
<dimen name="module_push_panel_marginTop">2px</dimen>
<dimen name="module_push_panel_marginBottom">2px</dimen>
<dimen name="module_push_panel_marginRight">8px</dimen>
<dimen name="module_push_panel_paddingLeft">28px</dimen>
<dimen name="module_push_panel_paddingBottom">16px</dimen>
<dimen name="module_push_panel_corner">16px</dimen>
<dimen name="module_push_panel_item_corner">12px</dimen>
<dimen name="module_push_item_time_textSize">5px</dimen>
<dimen name="module_push_item_image_width">118px</dimen>
<dimen name="module_push_item_image_height">86px</dimen>
<dimen name="module_push_panel_bkg_padding">8px</dimen>
<dimen name="module_push_ui_content_marginBottom">34px</dimen>
<dimen name="module_push_ui_content_width">567px</dimen>
<dimen name="module_push_ui_content_height">120px</dimen>
<dimen name="module_push_line_width">2px</dimen>
<dimen name="module_push_line_height">120px</dimen>
<dimen name="module_push_line_margin_left">30px</dimen>
<dimen name="module_push_check_margin">55px</dimen>
<dimen name="module_push_check_text_size">42px</dimen>
<dimen name="module_push_check_width">208px</dimen>
<dimen name="module_push_dialog_check_width">1200px</dimen>
<dimen name="module_push_dialog_check_height">763px</dimen>
<dimen name="module_push_dialog_check_bg_corner">32px</dimen>
<dimen name="module_push_dialog_close_width">107px</dimen>
<dimen name="module_push_dialog_close_height">107px</dimen>
<dimen name="module_push_dialog_close_margin">40px</dimen>
<dimen name="module_push_dialog_title_margin">54px</dimen>
<dimen name="module_push_dialog_title_size">56px</dimen>
<dimen name="module_push_dialog_content_width">1000px</dimen>
<dimen name="module_push_dialog_content_margin_top">33px</dimen>
<dimen name="module_push_dialog_content_size">43px</dimen>
<dimen name="module_push_ui_margin_top">20px</dimen>
</resources>

View File

@@ -66,7 +66,6 @@ class NoticeSocketManager {
CallerHmiManager.INSTANCE.showNormalBanner(obj);
}
};
/**