[m2]
[3.0.0] [隐藏转向灯、添加伪圆角]
@@ -30,10 +30,6 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
private var videoRelativeLayout: RelativeLayout? = null
|
||||
private var cacheImage: ImageView? = null
|
||||
private var connerTopLeft: ImageView? = null
|
||||
private var connerTopRight: ImageView? = null
|
||||
private var connerBottomLeft: ImageView? = null
|
||||
private var connerBottomRight: ImageView? = null
|
||||
|
||||
private var videoViewPlayer: AdvanceGSYVideoPlayer? = null
|
||||
private var gsyVideoOptionBuilder: GSYVideoOptionBuilder? = null
|
||||
@@ -44,7 +40,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
private var mVideoDirPath: String? = ""
|
||||
|
||||
init {
|
||||
mVideoDirPath = context.filesDir.absolutePath+ File.separator + "video" + File.separator
|
||||
mVideoDirPath = context.filesDir.absolutePath + File.separator + "video" + File.separator
|
||||
// mVideoDirPath = Config.downLoadPath
|
||||
initView()
|
||||
}
|
||||
@@ -63,7 +59,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
private fun initVideoView() {
|
||||
videoRelativeLayout = RelativeLayout(context)
|
||||
val outLayout = LayoutParams(-1, -1)
|
||||
addView(videoRelativeLayout,outLayout)
|
||||
addView(videoRelativeLayout, outLayout)
|
||||
|
||||
if (videoViewPlayer === null) {
|
||||
//视频播放控件
|
||||
@@ -78,49 +74,15 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
layoutParams.addRule(ALIGN_PARENT_BOTTOM)
|
||||
|
||||
videoRelativeLayout?.addView(videoViewPlayer, layoutParams)
|
||||
|
||||
val imageSize = AutoSizeUtils.dp2px(context, 25f)
|
||||
if(connerTopLeft==null){
|
||||
connerTopLeft = ImageView(context)
|
||||
connerTopLeft?.setImageResource(R.drawable.m2_video_top_left)
|
||||
}
|
||||
val layoutParentTopLeft = LayoutParams(imageSize, imageSize)
|
||||
layoutParentTopLeft.addRule(ALIGN_PARENT_TOP)
|
||||
layoutParentTopLeft.addRule(ALIGN_PARENT_LEFT)
|
||||
videoRelativeLayout?.addView(connerTopLeft, layoutParentTopLeft)
|
||||
if(connerTopRight==null){
|
||||
connerTopRight = ImageView(context)
|
||||
connerTopRight?.setImageResource(R.drawable.m2_video_top_right)
|
||||
}
|
||||
val layoutParentTopRight = LayoutParams(imageSize, imageSize)
|
||||
layoutParentTopRight.addRule(ALIGN_PARENT_TOP)
|
||||
layoutParentTopRight.addRule(ALIGN_PARENT_RIGHT)
|
||||
videoRelativeLayout?.addView(connerTopRight, layoutParentTopRight)
|
||||
if(connerBottomLeft==null){
|
||||
connerBottomLeft = ImageView(context)
|
||||
connerBottomLeft?.setImageResource(R.drawable.m2_video_bottom_left)
|
||||
}
|
||||
val layoutParentBottomLeft = LayoutParams(imageSize, imageSize)
|
||||
layoutParentBottomLeft.addRule(ALIGN_PARENT_BOTTOM)
|
||||
layoutParentBottomLeft.addRule(ALIGN_PARENT_LEFT)
|
||||
videoRelativeLayout?.addView(connerBottomLeft, layoutParentBottomLeft)
|
||||
if(connerBottomRight==null){
|
||||
connerBottomRight = ImageView(context)
|
||||
connerBottomRight?.setImageResource(R.drawable.m2_video_bottom_right)
|
||||
}
|
||||
val layoutParentBottomRight = LayoutParams(imageSize, imageSize)
|
||||
layoutParentBottomRight.addRule(ALIGN_PARENT_RIGHT)
|
||||
layoutParentBottomRight.addRule(ALIGN_PARENT_BOTTOM)
|
||||
videoRelativeLayout?.addView(connerBottomRight, layoutParentBottomRight)
|
||||
}
|
||||
|
||||
fun setVideoPath(path: String,cacheImageUrl: String) {
|
||||
fun setVideoPath(path: String, cacheImageUrl: String) {
|
||||
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v
|
||||
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4
|
||||
this.fileNetPath = path
|
||||
this.cacheImageUrl = cacheImageUrl
|
||||
val pathList = path.split("/")
|
||||
if (pathList.isNotEmpty()){
|
||||
if (pathList.isNotEmpty()) {
|
||||
this.downloadVideoName = pathList[pathList.size - 1]
|
||||
}
|
||||
}
|
||||
@@ -129,7 +91,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
// BitmapHelper.getVideoThumbnail(path) /*获取第一帧图*
|
||||
// OCHThreadPoolManager.getsInstance().execute {
|
||||
// var bitmap = BitmapHelper.getVideoThumbnail(fileNetPath)
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setVideoPath")
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setVideoPath")
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// Logger.d(ImageAndVideoRotation.TAG, "bitmap加载")
|
||||
cacheImage?.setImageResource(R.drawable.m2_p_video_holder)
|
||||
@@ -150,9 +112,10 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
// }
|
||||
}
|
||||
|
||||
fun clearLocalErrorVideo(){
|
||||
fun clearLocalErrorVideo() {
|
||||
if (downloadVideoName.isNotEmpty()
|
||||
&& FileUtils.isFileExists(mVideoDirPath + downloadVideoName)){
|
||||
&& FileUtils.isFileExists(mVideoDirPath + downloadVideoName)
|
||||
) {
|
||||
FileUtils.delete(mVideoDirPath + downloadVideoName)
|
||||
}
|
||||
}
|
||||
@@ -178,28 +141,30 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setVideo")
|
||||
mOnCompletionListener = onCompletionListener
|
||||
//判断是否已经下载
|
||||
if (downloadVideoName.isNotEmpty()){
|
||||
Logger.d(ImageAndVideoRotation.TAG,
|
||||
if (downloadVideoName.isNotEmpty()) {
|
||||
Logger.d(
|
||||
ImageAndVideoRotation.TAG,
|
||||
"video local url = $mVideoDirPath$downloadVideoName"
|
||||
)
|
||||
if (FileUtils.isFileExists(mVideoDirPath+downloadVideoName)){
|
||||
if (FileUtils.isFileExists(mVideoDirPath + downloadVideoName)) {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "have cache startPlay")
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath+downloadVideoName)).toString())
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath + downloadVideoName)).toString())
|
||||
return
|
||||
}
|
||||
startDownLoadVideo()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startDownLoadVideo(){
|
||||
private fun startDownLoadVideo() {
|
||||
//下载视频, 下载成功后再播放
|
||||
Logger.d(ImageAndVideoRotation.TAG, "startDownLoadVideo")
|
||||
FileUtils.createFileDir(mVideoDirPath)
|
||||
DownloadUtils.downLoad(context,fileNetPath,mVideoDirPath
|
||||
,downloadVideoName,5,downListener)
|
||||
DownloadUtils.downLoad(
|
||||
context, fileNetPath, mVideoDirPath, downloadVideoName, 5, downListener
|
||||
)
|
||||
}
|
||||
|
||||
fun startPlay(localVideoPath: String?){
|
||||
fun startPlay(localVideoPath: String?) {
|
||||
if (localVideoPath === "") return
|
||||
try {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "startPlay")
|
||||
@@ -215,12 +180,12 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
videoViewPlayer?.isFocusableInTouchMode = false
|
||||
videoViewPlayer?.setVideoAllCallBack(mOnCompletionListener)
|
||||
videoViewPlayer?.startPlayLogic()
|
||||
}catch (e: Exception){
|
||||
} catch (e: Exception) {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "startPlay e = ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
fun onVideoReset(){
|
||||
fun onVideoReset() {
|
||||
videoViewPlayer?.onVideoReset()
|
||||
mOnCompletionListener = null
|
||||
}
|
||||
@@ -237,7 +202,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private val downListener = object : IDownload{
|
||||
private val downListener = object : IDownload {
|
||||
override fun onStart(url: String?) {
|
||||
setCacheImageViewVisible()
|
||||
Logger.d(ImageAndVideoRotation.TAG, "download-onStart")
|
||||
@@ -257,21 +222,23 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
override fun onFinished(url: String?, threadBean: ThreadBean?) {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "download-onFinished = $url")
|
||||
if (url.equals(fileNetPath)){ //发现下载工具在断网又连网后,已完成的任务又都下载,跳转播放出现问题
|
||||
if (url.equals(fileNetPath)) { //发现下载工具在断网又连网后,已完成的任务又都下载,跳转播放出现问题
|
||||
//下载完成
|
||||
ThreadUtils.runOnUiThread {
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath+downloadVideoName)).toString())
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath + downloadVideoName)).toString())
|
||||
}
|
||||
}else{//如果当前文件不存在再次去下载当前的
|
||||
Logger.d(ImageAndVideoRotation.TAG, "download-onFinished = not current" +
|
||||
",currentUrl = $fileNetPath ")
|
||||
if (FileUtils.isFileExists(mVideoDirPath+downloadVideoName)){
|
||||
} else {//如果当前文件不存在再次去下载当前的
|
||||
Logger.d(
|
||||
ImageAndVideoRotation.TAG, "download-onFinished = not current" +
|
||||
",currentUrl = $fileNetPath "
|
||||
)
|
||||
if (FileUtils.isFileExists(mVideoDirPath + downloadVideoName)) {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "have download startPlay")
|
||||
ThreadUtils.runOnUiThread {
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath+downloadVideoName)).toString())
|
||||
startPlay(Uri.fromFile(File(mVideoDirPath + downloadVideoName)).toString())
|
||||
}
|
||||
return
|
||||
}else{
|
||||
} else {
|
||||
startDownLoadVideo()
|
||||
}
|
||||
}
|
||||
@@ -281,7 +248,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
Logger.d(ImageAndVideoRotation.TAG, "download-onError-$errorMsg")
|
||||
//出错再次下载
|
||||
if (errorMsg != null) {
|
||||
if (errorMsg.startsWith("initFailed")){
|
||||
if (errorMsg.startsWith("initFailed")) {
|
||||
startDownLoadVideo()
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 924 B |
|
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 920 B |
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 549 B After Width: | Height: | Size: 894 B |
@@ -2,5 +2,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_24" />
|
||||
<solid android:color="@color/shuttle_color_b9e7c0"/>
|
||||
<solid android:color="@color/shuttle_color_aeedb8"/>
|
||||
</shape>
|
||||
@@ -45,7 +45,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/iv_line_name_container"
|
||||
android:layout_width="@dimen/dp_661"
|
||||
android:layout_height="@dimen/dp_95"
|
||||
android:layout_height="@dimen/dp_92"
|
||||
android:src="@drawable/shuttle_p_line_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -223,7 +223,8 @@
|
||||
android:background="@drawable/bg_driving_arrived_notice"
|
||||
android:gravity="center"
|
||||
android:text="@string/m2_p_arrived_station_title"
|
||||
android:textColor="@color/shuttle_color_1f860d"
|
||||
android:textColor="@color/shuttle_color_34A61F"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:visibility="gone"
|
||||
@@ -285,15 +286,15 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<!-- 转向灯 IMoGoChassisLamplightListener-->
|
||||
<com.mogo.och.bus.passenger.ui.widget.M2TurnLightView
|
||||
android:id="@+id/turn_light_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_12"
|
||||
app:day_light_mode="true"
|
||||
app:layout_constraintLeft_toRightOf="@+id/auto_tv"
|
||||
app:layout_constraintTop_toTopOf="@+id/auto_tv"
|
||||
app:visible="false" />
|
||||
<!-- <com.mogo.och.bus.passenger.ui.widget.M2TurnLightView-->
|
||||
<!-- android:id="@+id/turn_light_view"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="@dimen/dp_12"-->
|
||||
<!-- app:day_light_mode="true"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/auto_tv"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@+id/auto_tv"-->
|
||||
<!-- app:visible="false" />-->
|
||||
|
||||
<!-- 红绿灯-->
|
||||
<!-- <com.mogo.och.bus.passenger.ui.widget.M2PTrafficLightView-->
|
||||
|
||||
@@ -85,6 +85,16 @@
|
||||
|
||||
<!-- 图片或视频广告-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/video_fragment_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="572.5dp"
|
||||
android:layout_marginBottom="@dimen/dp_35"
|
||||
android:layout_marginEnd="@dimen/dp_35"
|
||||
android:layout_marginStart="@dimen/dp_35"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/video_fragment"
|
||||
android:layout_width="match_parent"
|
||||
@@ -94,6 +104,35 @@
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/m2_video_top_left"
|
||||
app:layout_constraintTop_toTopOf="@+id/video_fragment_bottom"
|
||||
app:layout_constraintStart_toStartOf="@+id/video_fragment_bottom"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/m2_video_top_right"
|
||||
app:layout_constraintTop_toTopOf="@+id/video_fragment_bottom"
|
||||
app:layout_constraintEnd_toEndOf="@+id/video_fragment_bottom"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/m2_video_bottom_left"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_fragment_bottom"
|
||||
app:layout_constraintStart_toStartOf="@+id/video_fragment_bottom"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/m2_video_bottom_right"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_fragment_bottom"
|
||||
app:layout_constraintEnd_toEndOf="@+id/video_fragment_bottom"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<!-- 16 9 -->
|
||||
<!-- 1000 562.5 -->
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -16,7 +16,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_50" />
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
|
||||
<!--魔方连接状态 蓝牙-->
|
||||
<com.mogo.och.bus.passenger.ui.widget.M2BlueToothView
|
||||
@@ -53,7 +53,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:textColor="@color/m2_power_tv_color"
|
||||
android:layout_marginRight="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_40"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/m2_status_bar_logo"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_width="@dimen/dp_96"
|
||||
android:layout_height="@dimen/dp_28"/>
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_25"/>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
<color name="shuttle_color_6617417B">#6617417B</color>
|
||||
<color name="shuttle_color_17417B">#17417B</color>
|
||||
<color name="shuttle_color_2d3e5f">#2D3E5F</color>
|
||||
<color name="shuttle_color_1f860d">#1F860D</color>
|
||||
<color name="shuttle_color_b9e7c0">#B9E7C0</color>
|
||||
<color name="shuttle_color_34A61F">#34A61F</color>
|
||||
<color name="shuttle_color_aeedb8">#AEEDB8</color>
|
||||
<color name="shuttle_color_43cefe">#43CEFE</color>
|
||||
<color name="shuttle_color_1466fb">#1466FB</color>
|
||||
<color name="shuttle_color_7094ad">#7094AD</color>
|
||||
|
||||