diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 22d04a33fd..ad82747b49 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,7 +4,7 @@
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt
index 4dfdd36da2..e5a20d66a8 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt
@@ -10,6 +10,7 @@ import com.mogo.service.IMogoServiceApis
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
+import com.mogo.eagle.core.utilcode.util.SharedPrefs
import com.mogo.utils.logger.Logger
/**
@@ -36,6 +37,7 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() {
"https://dataservice-1255510688.cos.ap-beijing.myqcloud.com/carImg/yycp_NoticeDETAIL_location.png",
"https://vd2.bdstatic.com/mda-mk1347dzxdmcre0y/sc/cae_h264/1635819498112313003/mda-mk1347dzxdmcre0y.mp4?v_from_s=hkapp-haokan-tucheng&auth_key=1635837585-0-0-5295f6658c7711ba7b4d3ef478a7fbaa&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=",
2)
+ SharedPrefs.getInstance(context).putInt("videoType", 1)
} catch (e: Exception) {
e.printStackTrace()
}
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 6b5276545a..bc1f61d8b8 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,7 @@ 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.utilcode.util.SharedPrefs;
/**
* @author liujing
@@ -34,6 +35,7 @@ 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();
}
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
index affa7097f3..9ff0e10414 100644
--- 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
@@ -15,6 +15,7 @@ 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
@@ -65,6 +66,9 @@ class NoticeFloatView constructor(
}
pushCheckDialog!!.showCheckDialog(it)
}
+
+ //弹框消失
+ hide()
}
}
@@ -122,6 +126,7 @@ class NoticeFloatView constructor(
init {
inflateView(R.layout.notice_push_top_banner)
+ SharedPrefs.getInstance(context).putInt("videoType", 1) //大的播放器
}
private var topViewStatusListener = object : IMogoTopViewStatusListener {
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java
index fc4a79601c..33dea04eaa 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java
@@ -17,11 +17,13 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
import com.mogo.eagle.core.function.hmi.R;
+import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer;
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.imageloader.MogoImageView;
import com.mogo.utils.BitmapHelper;
+import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView;
@@ -130,6 +132,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
});
close = findViewById(R.id.notice_traffic_dialog_close);
close.setOnClickListener(v -> {
+ releasePlayer();
dismiss();
});
if (mPushData.getType() == 1) {
@@ -324,6 +327,14 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
}
+ private void releasePlayer() {
+ try {
+ GSYVideoManager.releaseAllVideos();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
@Override
public void dismiss() {
super.dismiss();
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml
index a56e389fa6..0644514014 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml
@@ -75,6 +75,7 @@
android:background="@drawable/notice_connect"
android:gravity="center"
android:text="连接"
+ android:visibility="gone"
android:textColor="#FFF"
android:textSize="@dimen/dp_42"
app:layout_constraintBottom_toBottomOf="@+id/video_player"
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt
new file mode 100644
index 0000000000..8cd0ceca6e
--- /dev/null
+++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt
@@ -0,0 +1,217 @@
+package com.mogo.eagle.core.widget.media.video
+
+import android.content.Context
+import android.util.AttributeSet
+import android.util.Log
+import android.view.Surface
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
+import com.mogo.eagle.core.utilcode.mogo.logger.Logger
+import com.mogo.eagle.core.utilcode.util.SharedPrefs
+import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
+import com.mogo.eagle.core.widget.R
+import com.shuyu.gsyvideoplayer.GSYVideoManager
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
+
+/**
+ * @author lixiaopeng
+ * @since 2021/11/3
+ *
+ * 视频播放器,ui定制
+ */
+class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer {
+
+ companion object {
+ const val PLAY_EVT_PLAY_LOADING = 1000
+ const val PLAY_EVT_PLAY_BEGIN = 2000
+ const val PLAY_EVT_PLAY_ERROR = 3000
+ }
+
+ private var playListener: PlayListener? = null
+ private lateinit var start: ImageView
+ private lateinit var coverImage: ImageView
+ private lateinit var fullscreen: ImageView
+ private lateinit var currentTimeTextView: TextView
+ private lateinit var totalTimeTextView: TextView
+
+ interface PlayListener {
+ fun onPlayEvent(event: Int)
+ }
+
+ constructor(context: Context?) : super(context)
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
+ constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
+
+ override fun init(context: Context) {
+ super.init(context)
+ start = findViewById(R.id.start)
+ coverImage = findViewById(R.id.thumbImage)
+ fullscreen = findViewById(R.id.fullscreen)
+ currentTimeTextView = findViewById(R.id.current)
+ totalTimeTextView = findViewById(R.id.total)
+
+ if (mThumbImageViewLayout != null
+ && (mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)
+ ) {
+ mThumbImageViewLayout.visibility = View.VISIBLE
+ }
+ }
+
+ override fun getLayoutId(): Int {
+ return R.layout.item_notice_video_small
+ }
+
+ override fun getGSYVideoManager(): GSYVideoViewBridge {
+ GSYVideoManager.instance().initContext(context.applicationContext)
+ return GSYVideoManager.instance()
+ }
+
+ override fun updateStartImage() {
+ when (mCurrentState) {
+ GSYVideoView.CURRENT_STATE_PLAYING ->
+ start.setImageResource(R.drawable.notice_video_pause)
+ GSYVideoView.CURRENT_STATE_ERROR ->
+ start.setImageResource(R.drawable.notice_video_pause)
+ else -> start.setImageResource(R.drawable.notice_video_play)
+ }
+ }
+
+ override fun setProgressAndTime(
+ progress: Int,
+ secProgress: Int,
+ currentTime: Int,
+ totalTime: Int,
+ forceChange: Boolean
+ ) {
+ super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
+ mBottomContainer?.visibility = View.VISIBLE
+ mProgressBar?.visibility = View.VISIBLE
+ start?.visibility = View.VISIBLE
+ fullscreen?.visibility = View.GONE
+ //时间显示
+ currentTimeTextView?.text = TimeTransformUtils.stringForTime(currentTime)
+ totalTimeTextView?.text = TimeTransformUtils.stringForTime(totalTime)
+
+ if (progress != 0) {
+ mProgressBar?.progress = progress
+ }
+ }
+
+ fun setPlayListener(listener: PlayListener) {
+ this.playListener = listener
+ }
+
+ override fun changeUiToCompleteShow() {
+ super.changeUiToCompleteShow()
+ }
+
+ override fun hideAllWidget() {
+ super.hideAllWidget()
+ mBottomContainer?.visibility = View.VISIBLE
+ mProgressBar?.visibility = View.VISIBLE
+ start?.visibility = View.VISIBLE
+ start.setImageResource(R.drawable.notice_video_pause)
+ }
+
+ override fun changeUiToPrepareingClear() {
+ super.changeUiToPrepareingClear()
+ mBottomContainer?.visibility = View.INVISIBLE
+ mProgressBar?.visibility = View.GONE
+ }
+
+ override fun changeUiToPlayingBufferingClear() {
+ super.changeUiToPlayingBufferingClear()
+ mBottomContainer?.visibility = View.INVISIBLE
+ mProgressBar?.visibility = View.GONE
+
+ }
+
+ override fun changeUiToClear() {
+ super.changeUiToClear()
+ }
+
+ override fun changeUiToCompleteClear() {
+ super.changeUiToCompleteClear()
+ mBottomContainer?.visibility = View.INVISIBLE
+ mProgressBar?.visibility = View.GONE
+ }
+
+ override fun onAutoCompletion() {
+ super.onAutoCompletion()
+ }
+
+ override fun showWifiDialog() {
+ //直接播放,不显示WIFI对话框
+ startPlayLogic()
+ }
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ mProgressBar?.progress = 0
+ mFullPauseBitmap = null
+ }
+
+ override fun onClick(v: View?) {
+ super.onClick(v)
+ }
+
+ override fun onCompletion() {
+ Logger.d("liyz", "onCompletion ------> ")
+ mBottomContainer?.visibility = View.VISIBLE
+ mProgressBar?.visibility = View.VISIBLE
+ start?.visibility = View.VISIBLE
+ start.setImageResource(R.drawable.notice_video_play)
+
+ isPostBufferUpdate = false
+ }
+
+ override fun onSurfaceUpdated(surface: Surface) {
+ super.onSurfaceUpdated(surface)
+ if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
+ mThumbImageViewLayout.visibility = View.INVISIBLE
+ }
+ }
+
+ override fun onPrepared() {
+ super.onPrepared()
+ playListener?.onPlayEvent(PLAY_EVT_PLAY_LOADING)
+ }
+
+ private var isPostBufferUpdate = false
+
+ override fun onBufferingUpdate(percent: Int) {
+ super.onBufferingUpdate(percent)
+ if (!isPostBufferUpdate && percent == 0) {
+ isPostBufferUpdate = true
+ playListener?.onPlayEvent(PLAY_EVT_PLAY_BEGIN)
+ }
+ }
+
+ override fun onError(what: Int, extra: Int) {
+ super.onError(what, extra)
+ playListener?.onPlayEvent(PLAY_EVT_PLAY_ERROR)
+ isPostBufferUpdate = false
+ }
+
+ override fun setViewShowState(view: View?, visibility: Int) {
+ if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
+ return
+ }
+ super.setViewShowState(view, visibility)
+ }
+
+ override fun onSurfaceAvailable(surface: Surface) {
+ super.onSurfaceAvailable(surface)
+ mProgressBar?.visibility = View.GONE
+ if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
+ if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
+ mThumbImageViewLayout.visibility = View.INVISIBLE
+ }
+ }
+ }
+}
+
diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt
index 82d187ce86..725ef4b17e 100644
--- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt
+++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt
@@ -8,6 +8,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
+import com.mogo.eagle.core.utilcode.util.SharedPrefs
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
import com.mogo.eagle.core.widget.R
import com.shuyu.gsyvideoplayer.GSYVideoManager
@@ -61,7 +62,14 @@ class NoticeSimpleVideoPlayer : StandardGSYVideoPlayer {
}
override fun getLayoutId(): Int {
- return R.layout.item_notice_video
+ Log.d("liyz", "NoticeSimpleVideoPlayer --- getLayoutId type = " + SharedPrefs.getInstance(context).getInt("videoType", 0))
+ if (SharedPrefs.getInstance(context).getInt("videoType", 0) == 1) { //大播放器
+ return R.layout.item_notice_video
+ }
+
+ return R.layout.item_notice_video_small
+
+// return R.layout.item_notice_video
}
override fun getGSYVideoManager(): GSYVideoViewBridge {
diff --git a/core/mogo-core-res/src/main/res/layout/item_notice_video.xml b/core/mogo-core-res/src/main/res/layout/item_notice_video.xml
index f907999474..8d504b8a52 100644
--- a/core/mogo-core-res/src/main/res/layout/item_notice_video.xml
+++ b/core/mogo-core-res/src/main/res/layout/item_notice_video.xml
@@ -14,14 +14,8 @@
-
-
-
-
-
-
+ android:layout_height="match_parent">
+
@@ -54,16 +48,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
- android:layout_marginRight="30px"
+ android:layout_marginRight="@dimen/notice_current_time_margin"
android:layout_marginBottom="5px"
android:gravity="center_vertical"
android:text="02:23"
android:textColor="@android:color/white"
- android:textSize="26px" />
+ android:textSize="@dimen/time_textsize" />
+ android:textSize="@dimen/time_textsize" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml
index f5230e9e49..17ef05908d 100644
--- a/core/mogo-core-res/src/main/res/values/dimens.xml
+++ b/core/mogo-core-res/src/main/res/values/dimens.xml
@@ -40,6 +40,21 @@
35px
38px
+
+ 52px
+ 56px
+ 50px
+ 30px
+ 990px
+ 60px
+ 56px
+ 26px
+ 20px
+ 52px
+ 35px
+ 26
+ 15px
+ 600px
\ No newline at end of file
diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/SharedPrefs.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/SharedPrefs.java
new file mode 100644
index 0000000000..e614aca9a9
--- /dev/null
+++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/SharedPrefs.java
@@ -0,0 +1,157 @@
+package com.mogo.eagle.core.utilcode.util;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import androidx.annotation.NonNull;
+
+import java.util.Set;
+
+/**
+ * 通用sp处理类
+ */
+public class SharedPrefs {
+
+ private static final String File_Name = "app_shared_pref";
+ private static SharedPrefs sInstance;
+ private static SharedPreferences sSharedPrefs;
+
+ public synchronized static SharedPrefs getInstance( @NonNull Context context ) {
+ if ( sInstance == null ) {
+ try {
+ sInstance = new SharedPrefs( context.getApplicationContext() );
+ } catch ( Exception e ) {
+ sInstance = new SharedPrefs();
+ }
+ }
+ return sInstance;
+ }
+
+ private SharedPrefs() {
+
+ }
+
+ private SharedPrefs(Context context ) {
+ try {
+ sSharedPrefs = context.getSharedPreferences( File_Name, Context.MODE_PRIVATE );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public void putString( String key, String value ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putString( key, value );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public String getString( String tag ) {
+ try {
+ return sSharedPrefs.getString( tag, "" );
+ } catch ( Exception e ) {
+ return "";
+ }
+ }
+
+ public String getString( String tag, String defVal ) {
+ try {
+ return sSharedPrefs.getString( tag, defVal );
+ } catch ( Exception e ) {
+ return "";
+ }
+ }
+
+ public boolean getBoolean( String key, boolean defaultValue ) {
+ try {
+ return sSharedPrefs.getBoolean( key, defaultValue );
+ } catch ( Exception e ) {
+ return defaultValue;
+ }
+ }
+
+ public long getLong( String key, long defaultValue ) {
+ try {
+ return sSharedPrefs.getLong( key, defaultValue );
+ } catch ( Exception e ) {
+ return defaultValue;
+ }
+ }
+
+ public float getFloat( String key, float defaultValue ) {
+ try {
+ return sSharedPrefs.getFloat( key, defaultValue );
+ } catch ( Exception e ) {
+ return defaultValue;
+ }
+ }
+
+ public int getInt( String key, int value ) {
+ try {
+ return sSharedPrefs.getInt( key, value );
+ } catch ( Exception e ) {
+ return value;
+ }
+ }
+
+ public void putBoolean( String key, boolean value ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putBoolean( key, value );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void putLong( String key, long value ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putLong( key, value );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void putInt( String key, int value ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putInt( key, value );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void putFloat( String key, float value ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putFloat( key, value );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void remove( String key ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.remove( key );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void putStringSet( String key, Set< String > values ) {
+ try {
+ SharedPreferences.Editor editor = sSharedPrefs.edit();
+ editor.putStringSet( key, values );
+ editor.apply();
+ } catch ( Exception e ) {
+ }
+ }
+
+ public Set getStringSet( String key ) {
+ return sSharedPrefs.getStringSet( key, null );
+ }
+
+}
\ No newline at end of file