[8.0.0]
[fea] [视频图片广告]
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
package com.mogo.och.unmanned.passenger.ui.video
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.mogo.eagle.core.function.main.MainMoGoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
@@ -21,13 +26,13 @@ import com.mogo.och.common.module.wigets.media.MediaItem
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayLogger
|
||||
import com.mogo.och.unmanned.passenger.bean.TaxiPassengerVideoPlay
|
||||
import com.mogo.och.unmanned.passenger.ui.video.RecyclerVideoAdapterNew.OnThumbImageClilckListener
|
||||
import com.mogo.och.unmanned.passenger.ui.video.layoutmanage.CarouselLayoutManager
|
||||
import com.mogo.och.unmanned.passenger.widget.ConsultVideoPlayer
|
||||
import com.mogo.och.unmanned.taxi.passenger.R
|
||||
import com.mogo.skin.utils.SkinResources
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_mogo_video_layout.view.image_item_player
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_mogo_video_layout.view.infoVideoPlaylist
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_mogo_video_layout.view.tv_playing_title
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_mogo_video_layout.view.video_item_player
|
||||
@@ -59,6 +64,9 @@ internal class InfoVideoView @JvmOverloads constructor(
|
||||
|
||||
private var currentMediaIndex = 0
|
||||
|
||||
var placeholderDrawable: Drawable = SkinResources.getInstance().getDrawable(R.drawable.taxi_p_road_video_bg)
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxt_u_p_mogo_video_layout, this, true)
|
||||
initView()
|
||||
@@ -127,7 +135,6 @@ internal class InfoVideoView @JvmOverloads constructor(
|
||||
private fun updateMediaListDataAndView(newList: MutableList<TaxiPassengerVideoPlay>) {
|
||||
mediaList.clear()
|
||||
mediaList.addAll(newList)
|
||||
mediaList.addAll(newList)
|
||||
UiThreadHandler.post {
|
||||
updateData()
|
||||
infoVideoPlaylist.adapter?.notifyDataSetChanged()
|
||||
@@ -197,7 +204,22 @@ internal class InfoVideoView @JvmOverloads constructor(
|
||||
if (mediaList.isNotEmpty() && currentMediaIndex < mediaList.size) {
|
||||
currentMedia = mediaList[currentMediaIndex]
|
||||
tv_playing_title.text = currentMedia?.title
|
||||
video_item_player.setData(currentMedia!!)
|
||||
currentMedia?.let {
|
||||
if(it.type==MediaItem.MEDIA_TYPE_IMAGE) {
|
||||
video_item_player.onVideoReset()
|
||||
video_item_player.visibility = View.GONE
|
||||
image_item_player.visibility = View.VISIBLE
|
||||
Glide.with(context)
|
||||
.load(it.url)
|
||||
.apply(RequestOptions()
|
||||
.transform(CenterCrop(),RoundedCorners(12)).placeholder(placeholderDrawable))
|
||||
.into(image_item_player)
|
||||
}else{
|
||||
video_item_player.visibility = View.VISIBLE
|
||||
image_item_player.visibility = View.GONE
|
||||
video_item_player.setData(currentMedia!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -568,10 +568,11 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
fun setData(currentMedia: TaxiPassengerVideoPlay) {
|
||||
|
||||
setFileType(currentMedia.type)
|
||||
if(gsyVideoOptionBuilder==null){
|
||||
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
}
|
||||
|
||||
gsyVideoOptionBuilder
|
||||
?.setEnlargeImageRes(R.drawable.taxt_u_p_change_full)
|
||||
?.setUrl(currentMedia.url)
|
||||
@@ -580,9 +581,6 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
?.setThumbPlay(false)
|
||||
?.setStartAfterPrepared(currentMedia.type == MediaItem.MEDIA_TYPE_VIDEO)
|
||||
?.build(this)
|
||||
setFileType(currentMedia.type)
|
||||
|
||||
coverImage
|
||||
|
||||
Glide.with(context)
|
||||
.load(currentMedia.imageUrl)
|
||||
|
||||
@@ -31,6 +31,16 @@
|
||||
android:layout_width="@dimen/dp_1920"
|
||||
android:layout_height="1080dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image_item_player"
|
||||
android:layout_gravity="center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_261"
|
||||
android:layout_width="@dimen/dp_1920"
|
||||
android:layout_height="1080dp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/infoVideoPlaylist"
|
||||
android:layout_width="@dimen/dp_410"
|
||||
|
||||
Reference in New Issue
Block a user