Merge remote-tracking branch 'origin/dev_MogoAP_eagle-1030_211020_8.0.14' into dev_MogoAP_eagle-1030_211020_8.0.14
@@ -243,7 +243,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
.setTag(tag)
|
||||
.setLayout(it2)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(5000)
|
||||
.setCountDownTime(60000)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.addWarningStatusListener(null)
|
||||
|
||||
@@ -54,7 +54,7 @@ public class NoticeBannerView extends ConstraintLayout {
|
||||
mPushData = pushData;
|
||||
noticePushTitle.setText(pushData.getMsg());
|
||||
noticePushContent.setText(pushData.getContent());
|
||||
if (pushData.getIsVideo()) {
|
||||
if (pushData.getType() == 1) {
|
||||
iconImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iconImageView.setVisibility(View.INVISIBLE);
|
||||
|
||||
@@ -1,32 +1,28 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
import com.mogo.utils.BitmapHelper
|
||||
import com.mogo.utils.glide.GlideApp
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener
|
||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.util.*
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
|
||||
|
||||
/**
|
||||
* 点击查看对话框,需要做接口的请求
|
||||
*
|
||||
* @brief 点击查看对话框
|
||||
* @author lixiaopeng
|
||||
*/
|
||||
class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
@@ -35,9 +31,11 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
private var pushCheckTitle: TextView? = null
|
||||
private var pushCheckContent: TextView? = null
|
||||
private var pushImageView: ImageView? = null
|
||||
private var pushVideo: SimpleVideoPlayer? = null
|
||||
private var pushVideo: NoticeSimpleVideoPlayer? = null
|
||||
private val gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
// private var mLoading: ProgressBar? = null
|
||||
private var playImageView: ImageView? = null
|
||||
private var thumbnailImageView: ImageView? = null
|
||||
private var mVideoUrl: String = ""
|
||||
|
||||
init {
|
||||
setContentView(R.layout.notice_dialog_check_with_accessory)
|
||||
@@ -47,19 +45,28 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
pushCheckContent = findViewById(R.id.module_push_dialog_bottom_title)
|
||||
pushImageView = findViewById(R.id.notice_image)
|
||||
pushVideo = findViewById(R.id.notice_video_layout)
|
||||
// mLoading = findViewById(R.id.loading)
|
||||
// mLoading!!.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.notice_video_progressbar_loading_color), PorterDuff.Mode.MULTIPLY)
|
||||
playImageView = findViewById(R.id.notice_video_play)
|
||||
thumbnailImageView = findViewById(R.id.thumbnail_image)
|
||||
|
||||
pushCheckClose?.setOnClickListener {
|
||||
stopLive()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
playImageView!!.setOnClickListener {
|
||||
if (pushVideo!!.currentState == GSYVideoView.CURRENT_STATE_PAUSE) { /*播放中*/
|
||||
resume()
|
||||
} else {
|
||||
pause()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示详情页面
|
||||
*/
|
||||
fun showCheckDialog(noticeNormal: NoticeNormalData) {
|
||||
Logger.d("liyz", "------1--------")
|
||||
if (isShowing || noticeNormal == null) {
|
||||
return
|
||||
}
|
||||
@@ -72,18 +79,17 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
pushCheckContent?.text = noticeNormal.content
|
||||
|
||||
if (!TextUtils.isEmpty(noticeNormal.imageUrl) && noticeNormal.fileType == 1) {
|
||||
Logger.d("liyz", "------2--------")
|
||||
pushVideo?.visibility = View.GONE
|
||||
pushImageView?.visibility = View.VISIBLE
|
||||
pushImageView?.let { GlideApp.with(context!!).load(noticeNormal.imageUrl).into(it) }
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(noticeNormal.videoUrl) && noticeNormal.fileType == 2) {
|
||||
Logger.d("liyz", "------3--------")
|
||||
pushImageView?.visibility = View.GONE
|
||||
pushVideo?.visibility = View.VISIBLE
|
||||
//加载视频播放
|
||||
playLiveVideo(noticeNormal.videoUrl)
|
||||
playVideo(noticeNormal.videoUrl)
|
||||
mVideoUrl = noticeNormal.videoUrl
|
||||
}
|
||||
|
||||
show()
|
||||
@@ -91,26 +97,19 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
|
||||
/**
|
||||
* 播放直播流,且开始心跳
|
||||
* 播放视频
|
||||
*/
|
||||
private fun playLiveVideo(videoUrl: String) {
|
||||
// pushVideo?.setPlayListener(object : PlayListener {
|
||||
// override fun onPlayEvent(event: Int) {
|
||||
// Logger.d("liyz", "event ----- $event")
|
||||
// if (event == SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING) {
|
||||
//// mLoading!!.visibility = View.VISIBLE
|
||||
// } else if (event == SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN) {
|
||||
//// mLoading!!.visibility = View.GONE
|
||||
// } else if (event < 0) {
|
||||
// stopLive()
|
||||
//// mLoading!!.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(pushVideo)
|
||||
pushVideo!!.startButton.performClick()
|
||||
private fun playVideo(videoUrl: String) {
|
||||
try {
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(pushVideo)
|
||||
pushVideo!!.startButton.performClick()
|
||||
playImageView!!.visibility = View.GONE
|
||||
thumbnailImageView!!.visibility = View.GONE
|
||||
startVideoCallBack(videoUrl)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun stopLive() {
|
||||
@@ -121,7 +120,78 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context) {
|
||||
}
|
||||
}
|
||||
|
||||
//播放完成的回调 TODO
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
private fun pause() {
|
||||
playImageView!!.visibility = View.VISIBLE
|
||||
playImageView!!.setImageResource(R.drawable.notice_video_play)
|
||||
thumbnailImageView!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续
|
||||
*/
|
||||
private fun resume() {
|
||||
playImageView!!.visibility = View.VISIBLE
|
||||
playImageView!!.setImageResource(R.drawable.notice_video_pause)
|
||||
thumbnailImageView!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放结束后
|
||||
*/
|
||||
private fun complete(firstbitmap: Bitmap, path: String) {
|
||||
thumbnailImageView!!.visibility = View.VISIBLE
|
||||
thumbnailImageView!!.setImageBitmap(firstbitmap)
|
||||
playImageView!!.setImageResource(R.drawable.notice_video_play)
|
||||
playImageView!!.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun startVideoCallBack(path: String) {
|
||||
Thread(Runnable {
|
||||
val firstBitmap = BitmapHelper.getVideoThumbnail(path) /*获取第一帧图*/
|
||||
pushVideo!!.setVideoAllCallBack(object : VideoAllCallBack {
|
||||
override fun onAutoComplete(url: String, vararg objects: Any) {
|
||||
complete(firstBitmap, path)
|
||||
}
|
||||
|
||||
override fun onClickResume(url: String, vararg objects: Any) {
|
||||
thumbnailImageView!!.visibility = View.GONE
|
||||
playImageView!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onClickStop(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onClickStop")
|
||||
}
|
||||
|
||||
override fun onStartPrepared(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onStartPrepared")
|
||||
}
|
||||
|
||||
override fun onPrepared(url: String, vararg objects: Any) {}
|
||||
override fun onClickStartIcon(url: String, vararg objects: Any) {}
|
||||
override fun onClickStartError(url: String, vararg objects: Any) {}
|
||||
override fun onClickStopFullscreen(url: String, vararg objects: Any) {}
|
||||
override fun onClickResumeFullscreen(url: String, vararg objects: Any) {}
|
||||
override fun onClickSeekbar(url: String, vararg objects: Any) {}
|
||||
override fun onClickSeekbarFullscreen(url: String, vararg objects: Any) {}
|
||||
override fun onEnterFullscreen(url: String, vararg objects: Any) {}
|
||||
override fun onQuitFullscreen(url: String, vararg objects: Any) {}
|
||||
override fun onQuitSmallWidget(url: String, vararg objects: Any) {}
|
||||
override fun onEnterSmallWidget(url: String, vararg objects: Any) {}
|
||||
override fun onTouchScreenSeekVolume(url: String, vararg objects: Any) {}
|
||||
override fun onTouchScreenSeekPosition(url: String, vararg objects: Any) {}
|
||||
override fun onTouchScreenSeekLight(url: String, vararg objects: Any) {}
|
||||
override fun onPlayError(url: String, vararg objects: Any) {}
|
||||
override fun onClickStartThumb(url: String, vararg objects: Any) {}
|
||||
override fun onClickBlank(url: String, vararg objects: Any) {}
|
||||
override fun onClickBlankFullscreen(url: String, vararg objects: Any) {
|
||||
Log.d(TAG, "onClickBlankFullscreen")
|
||||
}
|
||||
})
|
||||
}).start()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,47 +5,57 @@ import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
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.SimpleVideoPlayer;
|
||||
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.module.common.view.SpacesItemDecoration;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.BitmapHelper;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @description 交警类型弹框
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
private String TAG = "AINotice";
|
||||
private Context mContext;
|
||||
private RecyclerView mRecyclerView;
|
||||
private SimpleVideoPlayer mVideoPlayer;
|
||||
private NoticeSimpleVideoPlayer mVideoPlayer;
|
||||
private NoticeTrafficStylePushData mPushData;
|
||||
private ImageView close;
|
||||
private ImageView playImageView;
|
||||
private ImageView thumbnailImage;
|
||||
private MogoImageView thumbnailImage;
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private Bitmap firstBitmap;
|
||||
private TextView accept;//接受
|
||||
private TextView refuse;//拒绝
|
||||
|
||||
|
||||
public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mPushData = pushData;
|
||||
mPushData.setPoiImgUrl("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=");
|
||||
mPushData.setIsVideo(true);
|
||||
//图片
|
||||
String image = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F201609%2F26%2F20160926081306_GM2tv.thumb.1000_0.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1638511084&t=92def7498b526dcba3fceda17c43fcb8";
|
||||
String video = "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=";
|
||||
mPushData.setPoiImgUrl(video);
|
||||
mPushData.setType(1);
|
||||
mPushData.setInfoId("905543067497902080");
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -55,13 +65,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.notice_dialog_traffic_police);
|
||||
mVideoPlayer = findViewById(R.id.video_player);
|
||||
thumbnailImage = findViewById(R.id.thumbnail_image);
|
||||
playImageView = this.findViewById(R.id.window_video_play);
|
||||
close = findViewById(R.id.notice_traffic_dialog_close);
|
||||
close.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
playerShow();
|
||||
//网格绘制
|
||||
try {
|
||||
mRecyclerView = findViewById(R.id.traffic_info_recyclerView);
|
||||
@@ -78,6 +82,67 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
NoticeTrafficAdapter adapter = new NoticeTrafficAdapter(mContext);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
|
||||
accept = findViewById(R.id.accept_traffic);
|
||||
refuse = findViewById(R.id.refuse_traffic);
|
||||
accept.setOnClickListener(v -> {
|
||||
feedBackTraffic(1);
|
||||
});
|
||||
refuse.setOnClickListener(v -> {
|
||||
feedBackTraffic(0);
|
||||
});
|
||||
//重新连接
|
||||
findViewById(R.id.notice_connect).setOnClickListener(v -> {
|
||||
requestTrafficInfo();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i 是否接受交通事故任务
|
||||
* 0不接收 1接受
|
||||
*/
|
||||
private void feedBackTraffic(int i) {
|
||||
CallerNoticeManager.getNoticeProvider().feedBackNoticeTraffic(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交通事故详情
|
||||
*/
|
||||
private void requestTrafficInfo() {
|
||||
Log.d(TAG, "requestTrafficInfo");
|
||||
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), new NoticeNetCallBack() {
|
||||
@Override
|
||||
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
|
||||
Log.d(TAG, "交通事故详情::" + trafficInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据推送消息渲染顶部图片/视频
|
||||
* type 0图片 1视频
|
||||
*/
|
||||
private void playerShow() {
|
||||
mVideoPlayer = findViewById(R.id.video_player);
|
||||
thumbnailImage = findViewById(R.id.thumbnail_image);
|
||||
playImageView = this.findViewById(R.id.notice_start);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
startLive();
|
||||
});
|
||||
close = findViewById(R.id.notice_traffic_dialog_close);
|
||||
close.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
if (mPushData.getType() == 1) {
|
||||
firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取视频第一帧图*/
|
||||
complete(firstBitmap);
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(mPushData.getPoiImgUrl(),
|
||||
thumbnailImage);
|
||||
thumbnailImage.setImageBitmap(firstBitmap);
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
playImageView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mVideoPlayer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -88,7 +153,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
}
|
||||
}
|
||||
});
|
||||
// startLive();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +174,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
* 继续
|
||||
*/
|
||||
private void resume() {
|
||||
playImageView.setImageResource(R.drawable.video_pause);
|
||||
playImageView.setImageResource(R.drawable.notice_video_pause);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -117,10 +182,10 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
/**
|
||||
* 播放结束后
|
||||
*/
|
||||
private void complete(Bitmap firstbitmap, String path) {
|
||||
private void complete(Bitmap firstbitmap) {
|
||||
thumbnailImage.setVisibility(View.VISIBLE);
|
||||
thumbnailImage.setImageBitmap(firstbitmap);
|
||||
playImageView.setImageResource(R.drawable.video_play);
|
||||
playImageView.setImageResource(R.drawable.notice_video_play);
|
||||
playImageView.setVisibility(View.VISIBLE);
|
||||
playImageView.setOnClickListener(v -> {
|
||||
startLive();
|
||||
@@ -130,12 +195,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 视频播放
|
||||
*/
|
||||
private void startLive() {
|
||||
if (mPushData != null && mPushData.getIsVideo() == true) {
|
||||
if (mPushData != null) {
|
||||
try {
|
||||
Log.d(TAG, "交警事故开始播放视频startLive");
|
||||
String videoUrl = mPushData.getPoiImgUrl();
|
||||
@@ -144,22 +208,22 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
|
||||
mVideoPlayer.getStartButton().performClick();
|
||||
thumbnailImage.setVisibility(View.GONE);
|
||||
playImageView.setVisibility(View.GONE);
|
||||
startVideoCallBack(videoUrl);
|
||||
liveCallBack();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startVideoCallBack(String path) {
|
||||
private void liveCallBack() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(path);/*获取第一帧图*/
|
||||
Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/
|
||||
mVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() {
|
||||
@Override
|
||||
public void onAutoComplete(String url, Object... objects) {
|
||||
complete(firstBitmap, path);
|
||||
complete(firstBitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
|
After Width: | Height: | Size: 426 KiB |
@@ -38,6 +38,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_150"
|
||||
android:layout_marginRight="@dimen/dp_150"
|
||||
android:layout_marginBottom="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
@@ -63,7 +64,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_push_dialog_acc_title" />
|
||||
|
||||
<!--中间视频-->
|
||||
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
<com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer
|
||||
android:id="@+id/notice_video_layout"
|
||||
android:layout_width="@dimen/module_push_dialog_check_acc_image_width"
|
||||
android:layout_height="@dimen/module_push_dialog_check_acc_image__height"
|
||||
@@ -71,20 +72,39 @@
|
||||
android:layout_marginTop="@dimen/dp_52"
|
||||
android:layout_marginRight="@dimen/dp_150"
|
||||
android:gravity="center"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_push_dialog_bottom_title"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_push_dialog_acc_title" />
|
||||
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/loading"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
<!--缩略图-->
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/thumbnail_image"
|
||||
android:layout_width="@dimen/module_push_dialog_check_acc_image_width"
|
||||
android:layout_height="@dimen/module_push_dialog_check_acc_image__height"
|
||||
android:layout_marginLeft="@dimen/dp_200"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_200"
|
||||
android:background="@drawable/notice_unsuccess_image"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--播放按钮-->
|
||||
<ImageView
|
||||
android:id="@+id/notice_video_play"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent" />
|
||||
android:src="@drawable/video_play"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!--加载失败默认图-->
|
||||
<ImageView
|
||||
|
||||
@@ -31,14 +31,13 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!--图/视频-->
|
||||
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
<com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer
|
||||
android:id="@+id/video_player"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/notice_traffic_acc_image_height"
|
||||
android:layout_marginLeft="@dimen/dp_200"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_200"
|
||||
android:src="@drawable/notice_unsuccess_image"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_push_dialog_bottom_title"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -47,25 +46,40 @@
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/thumbnail_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/notice_traffic_acc_image_height"
|
||||
android:layout_marginLeft="@dimen/dp_200"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_200"
|
||||
android:background="@drawable/notice_unsuccess_image"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/notice_unsuccess_traffic"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/video_player"
|
||||
app:layout_constraintEnd_toEndOf="@id/video_player"
|
||||
app:layout_constraintStart_toStartOf="@id/video_player"
|
||||
app:layout_constraintTop_toTopOf="@id/video_player" />
|
||||
<!--播放按钮-->
|
||||
<ImageView
|
||||
android:id="@+id/window_video_play"
|
||||
android:id="@+id/notice_start"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/video_play"
|
||||
android:visibility="gone" />
|
||||
android:src="@drawable/notice_video_play"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/video_player"
|
||||
app:layout_constraintLeft_toLeftOf="@id/video_player"
|
||||
app:layout_constraintRight_toRightOf="@id/video_player"
|
||||
app:layout_constraintTop_toTopOf="@id/video_player" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notice_connect"
|
||||
android:layout_width="@dimen/dp_310"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:background="@drawable/notice_connect"
|
||||
android:gravity="center"
|
||||
android:text="连接"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_player"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
<!--事故来源等事故详情-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/traffic_info_recyclerView"
|
||||
@@ -77,8 +91,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/traffic_top_line"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/back_image" />
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
<!--分割线-->
|
||||
<ImageView
|
||||
android:id="@+id/traffic_top_line"
|
||||
@@ -99,6 +112,7 @@
|
||||
|
||||
<!--接受 拒绝-->
|
||||
<TextView
|
||||
android:id="@+id/accept_traffic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
@@ -112,6 +126,7 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/traffic_top_line" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/refuse_traffic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.util.Log;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider;
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.function.notice.network.NoticeNetWorkManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,4 +39,15 @@ public class NoticeProvider implements IMoGoNoticeProvider {
|
||||
mContext = context;
|
||||
NoticeSocketManager.getInstance().registerSocketMessageListener(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedBackNoticeTraffic(String infoId, String sn, int accept) {
|
||||
NoticeNetWorkManager.getInstance().sendAccidentAcceptStatus(infoId, sn, accept);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
|
||||
NoticeNetWorkManager.getInstance().requestAccidentInfo(infoId, sn, callBack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ class NoticeSocketManager {
|
||||
Log.d(TAG, "registerSocketMessage");
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
registerOnMessageListener(301001, mNoticeMessageListener);
|
||||
registerOnMessageListener(301001, mtrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
registerOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
|
||||
public void unRegisterSocketMessageListener() {
|
||||
if (mNoticeMessageListener != null) {
|
||||
if (mtrafficNoticeListener != null) {
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(301001, mNoticeMessageListener);
|
||||
unregisterOnMessageListener(301001, mtrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class NoticeSocketManager {
|
||||
/**
|
||||
* 交警类型公告弹窗
|
||||
*/
|
||||
private IMogoOnMessageListener<NoticeTrafficStylePushData> mNoticeMessageListener = new IMogoOnMessageListener<NoticeTrafficStylePushData>() {
|
||||
private IMogoOnMessageListener<NoticeTrafficStylePushData> mtrafficNoticeListener = new IMogoOnMessageListener<NoticeTrafficStylePushData>() {
|
||||
|
||||
@Override
|
||||
public Class<NoticeTrafficStylePushData> target() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -26,11 +27,11 @@ public interface NoticeApiService {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
|
||||
Observable<BaseData> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
|
||||
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
|
||||
|
||||
|
||||
/**
|
||||
* 获取道路事故详情
|
||||
* 反馈对道路事件的操作
|
||||
*
|
||||
* @param accidentParameters 请求数据(infoID事故ID;sn;status接受状态 0否 1是)
|
||||
* @return {@link BaseData}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.mogo.cloud.network.RetrofitFactory;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -46,10 +48,11 @@ public class NoticeNetWorkManager {
|
||||
/**
|
||||
* 获取事故详细信息
|
||||
*
|
||||
* @param infoId 事故id
|
||||
* @param sn
|
||||
* @param infoId 事故id
|
||||
* @param sn 车机sn
|
||||
* @param callBack 回调
|
||||
*/
|
||||
public void requestAccidentInfo(String infoId, String sn) {
|
||||
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
@@ -57,15 +60,17 @@ public class NoticeNetWorkManager {
|
||||
mNoticeApiService.getAccidentInfo(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseData>() {
|
||||
.subscribe(new Observer<NoticeTrafficStyleInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseData baseData) {
|
||||
|
||||
public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) {
|
||||
if (noticeTrafficStyleInfo != null) {
|
||||
callBack.callBackWithResult(noticeTrafficStyleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,12 +92,11 @@ public class NoticeNetWorkManager {
|
||||
* @param sn
|
||||
* @param status 是否接受 0否 1是
|
||||
*/
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, String status) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, int status) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", infoId);
|
||||
map.put("status", status);
|
||||
map.put("status", String.valueOf(status));
|
||||
mNoticeApiService.sendAcceptStatus(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -129,7 +133,6 @@ public class NoticeNetWorkManager {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", dbId);
|
||||
|
||||
mNoticeApiService.getNoticeDetail(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -158,5 +161,4 @@ public class NoticeNetWorkManager {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
package com.mogo.eagle.core.data.notice;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 交通事故任务详情数据bean
|
||||
* @description 交通事故任务详情数据
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
public class NoticeTrafficStyleInfo implements Serializable {
|
||||
public class NoticeTrafficStyleInfo extends BaseData {
|
||||
private String infoId;//事故id
|
||||
private String poiType;//事故类型
|
||||
private long dataCreateTime;//事故发生时间
|
||||
private long dataHandleTime;//事故处理时间
|
||||
private String operaStatus;//事故状态
|
||||
private String operaStatus;//事故处理状态
|
||||
private String troubleReasonName;//事故原因
|
||||
private String uploadAddress;//事故地点
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
@@ -63,15 +66,24 @@ public class NoticeTrafficStyleInfo implements Serializable {
|
||||
this.troubleReasonName = troubleReasonName;
|
||||
}
|
||||
|
||||
public String getUploadAddress() {
|
||||
return uploadAddress;
|
||||
}
|
||||
|
||||
public void setUploadAddress(String uploadAddress) {
|
||||
this.uploadAddress = uploadAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NoticeTrafficInfo{" +
|
||||
return "NoticeTrafficStyleInfo{" +
|
||||
"infoId='" + infoId + '\'' +
|
||||
", poiType='" + poiType + '\'' +
|
||||
", dataCreateTime=" + dataCreateTime +
|
||||
", dataHandleTime=" + dataHandleTime +
|
||||
", operaStatus='" + operaStatus + '\'' +
|
||||
", troubleReasonName='" + troubleReasonName + '\'' +
|
||||
", uploadAddress='" + uploadAddress + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
package com.mogo.eagle.core.data.notice;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 交警任务公告推送消息体
|
||||
* 接口 http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=66917469
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public class NoticeTrafficStylePushData {
|
||||
public class NoticeTrafficStylePushData implements Serializable {
|
||||
private String msg;
|
||||
private String infoId;
|
||||
private String poiImgUrl;
|
||||
private String title;
|
||||
private boolean isVideo;
|
||||
private int type;
|
||||
private String content;
|
||||
|
||||
public String getMsg() {
|
||||
@@ -46,12 +48,12 @@ public class NoticeTrafficStylePushData {
|
||||
this.poiImgUrl = poiImgUrl;
|
||||
}
|
||||
|
||||
public boolean getIsVideo() {
|
||||
return isVideo;
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setIsVideo(boolean isVideo) {
|
||||
this.isVideo = isVideo;
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
@@ -69,7 +71,7 @@ public class NoticeTrafficStylePushData {
|
||||
", infoId='" + infoId + '\'' +
|
||||
", poiImgUrl='" + poiImgUrl + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", isVideo=" + isVideo +
|
||||
", type=" + type +
|
||||
", content='" + content + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 云公告监听者
|
||||
* @description
|
||||
* @since: 10/27/21
|
||||
*/
|
||||
public interface IMoGoNoticeProvider extends IMoGoFunctionServerProvider {
|
||||
|
||||
|
||||
void feedBackNoticeTraffic(String infoId, String sn, int accept);
|
||||
void requestAccidentInfo(String infoId, String sn,NoticeNetCallBack callBack);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.eagle.core.function.api.notice;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 网络请求回调
|
||||
* @since: 11/3/21
|
||||
*/
|
||||
public interface NoticeNetCallBack {
|
||||
void callBackWithResult(NoticeTrafficStyleInfo trafficInfo);
|
||||
}
|
||||
@@ -10,9 +10,7 @@ import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_AI_NOTICE
|
||||
*/
|
||||
public class CallerNoticeManager extends CallerBase {
|
||||
|
||||
private static IMoGoNoticeProvider getNoticeProvider() {
|
||||
public static IMoGoNoticeProvider getNoticeProvider() {
|
||||
return getApiInstance(IMoGoNoticeProvider.class, PATH_AI_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
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.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 NoticeSimpleVideoPlayer : 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
|
||||
}
|
||||
|
||||
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()
|
||||
Log.d("liyz", "changeUiToCompleteShow ------> ")
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun hideAllWidget() {
|
||||
super.hideAllWidget()
|
||||
Log.d("liyz", "hideAllWidget ------> ")
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
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()
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteClear() {
|
||||
super.changeUiToCompleteClear()
|
||||
mBottomContainer?.visibility = View.INVISIBLE
|
||||
mProgressBar?.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
super.onAutoCompletion()
|
||||
mProgressBar?.progress = 0
|
||||
}
|
||||
|
||||
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() {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 315 B |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
BIN
core/mogo-core-res/src/main/res/drawable/notice_video_pause.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
core/mogo-core-res/src/main/res/drawable/notice_video_play.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
27
core/mogo-core-res/src/main/res/drawable/seekbar_style.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#80ffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- <item android:id="@android:id/secondaryProgress">-->
|
||||
<!-- <clip>-->
|
||||
<!-- <shape>-->
|
||||
<!-- <solid android:color="#ff51495e" />-->
|
||||
<!-- </shape>-->
|
||||
<!-- </clip>-->
|
||||
<!-- </item>-->
|
||||
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#53C7F8"
|
||||
android:startColor="#2972EE" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
112
core/mogo-core-res/src/main/res/layout/item_notice_video.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_video_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/surface_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<!-- android:layout_alignParentStart="true"-->
|
||||
<!-- android:layout_alignParentLeft="true"-->
|
||||
<!-- android:layout_alignParentTop="true"-->
|
||||
<!-- android:layout_alignParentEnd="true"-->
|
||||
<!-- android:layout_alignParentRight="true"-->
|
||||
<!-- android:layout_alignParentBottom="true"-->
|
||||
<ImageView
|
||||
android:id="@+id/thumbImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!--局部播放器-->
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="20px"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="52px"
|
||||
android:layout_height="52px"
|
||||
android:layout_marginLeft="56px"
|
||||
android:layout_marginRight="50px"
|
||||
android:src="@drawable/notice_video_pause"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginRight="30px"
|
||||
android:layout_marginBottom="5px"
|
||||
android:gravity="center_vertical"
|
||||
android:text="02:23"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="26px" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="990px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@null"
|
||||
android:max="100"
|
||||
android:maxHeight="8px"
|
||||
android:minHeight="8px"
|
||||
android:thumb="@drawable/notice_player_ic_circle_nor"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginLeft="30px"
|
||||
android:layout_marginBottom="5px"
|
||||
android:text="08:66"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="26px" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="60px"
|
||||
android:layout_height="60px"
|
||||
android:scaleType="centerInside" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/start"-->
|
||||
<!-- android:layout_width="100px"-->
|
||||
<!-- android:layout_height="100px"-->
|
||||
<!-- android:layout_centerHorizontal="true"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- android:layout_gravity="center_vertical"-->
|
||||
<!-- android:visibility="gone" />-->
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="56px"
|
||||
android:layout_height="56px"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateTint="#256BFF"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.eagle.core.utilcode.util;
|
||||
|
||||
import java.util.Formatter;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* author: lixiaopeng
|
||||
* desc : 时间转换
|
||||
*/
|
||||
public final class TimeTransformUtils {
|
||||
|
||||
public static String stringForTime(int timeMs) {
|
||||
if (timeMs <= 0 || timeMs >= 24 * 60 * 60 * 1000) {
|
||||
return "00:00";
|
||||
}
|
||||
int totalSeconds = timeMs / 1000;
|
||||
int seconds = totalSeconds % 60;
|
||||
int minutes = (totalSeconds / 60) % 60;
|
||||
int hours = totalSeconds / 3600;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
Formatter mFormatter = new Formatter(stringBuilder, Locale.getDefault());
|
||||
if (hours > 0) {
|
||||
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
|
||||
} else {
|
||||
return mFormatter.format("%02d:%02d", minutes, seconds).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -24,17 +26,21 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class RequestOptions {
|
||||
/**
|
||||
* Private constructor with some default initialization.
|
||||
*/
|
||||
private RequestOptions( @CallerType Object caller ) {
|
||||
public RequestOptions(@CallerType Object caller) {
|
||||
this.caller = caller;
|
||||
this.context = Util.getContext( caller );
|
||||
this.parameter = Collections.emptyMap();
|
||||
|
||||