修改弹框新实现
This commit is contained in:
@@ -22,6 +22,7 @@ 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
|
||||
import com.mogo.utils.logger.Logger
|
||||
@@ -294,14 +295,51 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var floatView: NoticeFloatView? = null
|
||||
|
||||
override fun showNoticeNormalData(normalData: NoticeNormalData) {
|
||||
if (floatView == null) {
|
||||
floatView = this.context?.let { NoticeFloatView(it) }
|
||||
activity.let {
|
||||
val noticeBannerView = this.context?.let { it1 -> NoticeNormalBannerView(it1) }
|
||||
noticeBannerView?.setPushData(normalData)
|
||||
mWarningFloat = it?.let { it1 ->
|
||||
noticeBannerView?.let { it2 ->
|
||||
WarningFloat.with(it1)
|
||||
.setTag(tag)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(10000)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(null)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
// AIAssist.getInstance(activity)
|
||||
// .speakTTSVoice("")
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
floatView?.pushBeanChanged(normalData)
|
||||
}
|
||||
|
||||
private fun showCameraList(cameraList: List<CameraEntity>?) {
|
||||
|
||||
@@ -35,7 +35,6 @@ public class NoticeBannerView extends ConstraintLayout {
|
||||
public NoticeBannerView(@NonNull Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
SharedPrefs.getInstance(context).putInt("videoType", 2); //小的视频播放ui
|
||||
LayoutInflater.from(context).inflate(R.layout.notice_push_top_banner, this);
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.utils.glide.GlideRoundedCornersTransform
|
||||
|
||||
/**
|
||||
* 云公告弹框view
|
||||
* 未来可能删除,这种是老的实现方式
|
||||
*/
|
||||
class NoticeFloatView constructor(
|
||||
private val context: Context
|
||||
@@ -127,7 +128,6 @@ class NoticeFloatView constructor(
|
||||
|
||||
init {
|
||||
inflateView(R.layout.notice_push_top_banner)
|
||||
SharedPrefs.getInstance(context).putInt("videoType", 1) //大的播放器
|
||||
}
|
||||
|
||||
private var topViewStatusListener = object : IMogoTopViewStatusListener {
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
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.utilcode.util.SharedPrefs;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.glide.GlideRoundedCornersTransform;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 云公告顶部弹框
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
public class NoticeNormalBannerView extends ConstraintLayout {
|
||||
private ImageView styleImageView;
|
||||
private ImageView iconImageView;
|
||||
private TextView noticePushTitle;
|
||||
private TextView noticePushContent;
|
||||
private TextView noticeBannerCheck;
|
||||
private NoticeCheckDialog pushCheckDialog;
|
||||
private Context mContext;
|
||||
private NoticeNormalData mPushData;
|
||||
|
||||
public NoticeNormalBannerView(@NonNull Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.notice_push_top_banner, this);
|
||||
initView();
|
||||
}
|
||||
|
||||
public NoticeNormalBannerView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoticeNormalBannerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public NoticeNormalBannerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
public void setPushData(NoticeNormalData pushData) {
|
||||
mPushData = pushData;
|
||||
noticePushTitle.setText(pushData.getTitle());
|
||||
noticePushContent.setText(pushData.getContent());
|
||||
if (pushData.getFileType() == 1) { //1 是图片, 2 是视频
|
||||
iconImageView.setVisibility(View.GONE);
|
||||
} else {
|
||||
iconImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
GlideApp.with(this).load(pushData.getImageUrl()).optionalTransform(new GlideRoundedCornersTransform(30f, GlideRoundedCornersTransform.CornerType.LEFT)).into(styleImageView);
|
||||
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
styleImageView = findViewById(R.id.notice_push_style_image);
|
||||
iconImageView = findViewById(R.id.notice_push_icon_video);
|
||||
noticePushTitle = findViewById(R.id.notice_push_title);
|
||||
noticePushContent = findViewById(R.id.notice_push_content);
|
||||
noticeBannerCheck = findViewById(R.id.notice_push_banner_check);
|
||||
|
||||
noticeBannerCheck.setOnClickListener(v -> {
|
||||
if (pushCheckDialog == null) {
|
||||
pushCheckDialog = new NoticeCheckDialog(mContext);
|
||||
}
|
||||
pushCheckDialog.showCheckDialog(mPushData);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user