删除修改Activity界面的代码
部分内存泄漏
This commit is contained in:
@@ -39,7 +39,9 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
|
||||
@Override
|
||||
public RecyclerItemVideoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(context).inflate(R.layout.list_video_item_normal, parent, false);
|
||||
return new RecyclerItemVideoHolder(context, v);
|
||||
RecyclerItemVideoHolder recyclerItemVideoHolder = new RecyclerItemVideoHolder(context, v);
|
||||
recyclerItemVideoHolder.setIsRecyclable(false);
|
||||
return recyclerItemVideoHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,6 +49,7 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
|
||||
final TaxiPassengerVideoPlay taxiPassengerVideoPlay = itemDataList.get(position);
|
||||
|
||||
holder.gsyVideoOptionBuilder
|
||||
.setEnlargeImageRes(R.drawable.taxi_p_change_full)
|
||||
.setUrl(taxiPassengerVideoPlay.getUrl())
|
||||
.setCacheWithPlay(true)
|
||||
.setPlayTag(taxiPassengerVideoPlay.getImageUrl()+position)
|
||||
|
||||
@@ -201,8 +201,6 @@ class TaxiPassengerMogoConsultView :RelativeLayout {
|
||||
player.onVideoReset()
|
||||
}
|
||||
}
|
||||
FullVideoUtils.dismissOverlayView()
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.ui.video.FullVideoUtils
|
||||
import com.shuyu.gsyvideoplayer.utils.CommonUtil
|
||||
import com.shuyu.gsyvideoplayer.utils.Debuger
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
@@ -37,6 +36,8 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
private lateinit var tvTitle: TextView
|
||||
private lateinit var layoutBottom: ConstraintLayout
|
||||
|
||||
private var fullVideoPlayer:ConsultVideoPlayer?=null
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
@@ -114,7 +115,14 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
mFullPauseBitmap = null
|
||||
if(mIfCurrentIsFullscreen){
|
||||
FullVideoUtils.dismissOverlayView()
|
||||
clearFullscreenLayout()
|
||||
fullVideoPlayer?.let {
|
||||
clearFullscreenLayout(it)
|
||||
}
|
||||
onVideoReset()
|
||||
if (thumbImageView is ImageView) {
|
||||
(thumbImageView as ImageView).setImageResource(R.drawable.taxi_p_video_holder)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +180,9 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
super.onAutoCompletion()
|
||||
if(mIfCurrentIsFullscreen){
|
||||
FullVideoUtils.dismissOverlayView()
|
||||
clearFullscreenLayout()
|
||||
fullVideoPlayer?.let {
|
||||
clearFullscreenLayout(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,28 +194,6 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存大小和状态
|
||||
*/
|
||||
private fun saveLocationStatus(context: Context, statusBar: Boolean, actionBar: Boolean) {
|
||||
getLocationOnScreen(mListItemRect)
|
||||
if (context is Activity) {
|
||||
val statusBarH = CommonUtil.getStatusBarHeight(context)
|
||||
val actionBerH = CommonUtil.getActionBarHeight(context)
|
||||
val isTranslucent =
|
||||
(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS and context.window.attributes.flags
|
||||
== WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
if (statusBar && !isTranslucent) {
|
||||
mListItemRect[1] = mListItemRect[1] - statusBarH
|
||||
}
|
||||
if (actionBar) {
|
||||
mListItemRect[1] = mListItemRect[1] - actionBerH
|
||||
}
|
||||
}
|
||||
mListItemSize[0] = width
|
||||
mListItemSize[1] = height
|
||||
}
|
||||
|
||||
private fun startWindowFullscreenOwn(context:Context, actionBar:Boolean, statusBar:Boolean){
|
||||
val gsyBaseVideoPlayer = startWindowFullscreen(context, actionBar, statusBar)
|
||||
gsyBaseVideoPlayer?.let {
|
||||
@@ -241,20 +229,10 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
override fun startWindowFullscreen(context:Context, actionBar:Boolean, statusBar:Boolean):GSYBaseVideoPlayer?{
|
||||
mSystemUiVisibility = (context as Activity).window.decorView.systemUiVisibility
|
||||
CommonUtil.hideSupportActionBar(context, actionBar, statusBar)
|
||||
if (mHideKey) {
|
||||
CommonUtil.hideNavKey(context)
|
||||
}
|
||||
mActionBar = actionBar
|
||||
mStatusBar = statusBar
|
||||
mListItemRect = IntArray(2)
|
||||
mListItemSize = IntArray(2)
|
||||
|
||||
if (mTextureViewContainer.childCount > 0) {
|
||||
mTextureViewContainer.removeAllViews()
|
||||
}
|
||||
saveLocationStatus(context, statusBar, actionBar)
|
||||
var hadNewConstructor = true
|
||||
|
||||
//切换时关闭非全屏定时器
|
||||
@@ -281,6 +259,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
)
|
||||
gsyVideoPlayer = constructor.newInstance(mContext, true)
|
||||
}
|
||||
this.fullVideoPlayer = gsyVideoPlayer
|
||||
gsyVideoPlayer.id = fullId
|
||||
gsyVideoPlayer.isIfCurrentIsFullscreen = true
|
||||
gsyVideoPlayer.setVideoAllCallBack(mVideoAllCallBack)
|
||||
@@ -303,7 +282,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
width, height
|
||||
)
|
||||
frameLayout.addView(gsyVideoPlayer, lp)
|
||||
FullVideoUtils.showOverlayView(context,frameLayout)
|
||||
FullVideoUtils.showOverlayView(context as Activity,frameLayout)
|
||||
gsyVideoPlayer.visibility = INVISIBLE
|
||||
frameLayout.visibility = INVISIBLE
|
||||
resolveFullVideoShow(context, gsyVideoPlayer, frameLayout)
|
||||
@@ -381,13 +360,10 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
mVideoAllCallBack.onQuitFullscreen(mOriginUrl, mTitle, this)
|
||||
}
|
||||
mIfCurrentIsFullscreen = false
|
||||
if (mHideKey) {
|
||||
CommonUtil.showNavKey(mContext, mSystemUiVisibility)
|
||||
}
|
||||
CommonUtil.showSupportActionBar(mContext, mActionBar, mStatusBar)
|
||||
if (fullscreenButton != null) {
|
||||
fullscreenButton.setImageResource(enlargeImageRes)
|
||||
}
|
||||
this.fullVideoPlayer = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user