diff --git a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailActivity.kt index 4b92162650..e4d97e59db 100644 --- a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailActivity.kt @@ -50,21 +50,6 @@ class VideoDetailActivity : BaseActivity() { return super.dispatchTouchEvent(ev) } - /*override fun onPause() { - if (isPauseVideo) { - CustomManager.onPause("detail_$uuid") - } - super.onPause() - }*/ - - /*override fun onResume() { - if (isPauseVideo) { - CustomManager.onResume("detail_$uuid") - } else { - isPauseVideo = true - } - super.onResume() - }*/ override fun onDestroy() { CustomManager.releaseAllVideos("detail_$uuid") diff --git a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt index 3ccb9913ce..21f9ea9d51 100644 --- a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailContainerFragment.kt @@ -213,10 +213,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener { video?.let { ExoCacheManager.cancel(video.url) - val proxy = CustomProxyCacheManager.getProxy(requireContext(), null) - val client = proxy.getClients(video.url) - runOnIoThread { client.closeSource() } - val titleAndId = StringUtils.combineTwoString(video.title, video.id) video.videoIsMuted = false if (isNext) { @@ -520,13 +516,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener { guideRl.visibility = View.GONE } SPUtils.setBoolean(Constants.SP_SHOW_SLIDE_GUIDE, true) - - /* val proxy = CustomProxyCacheManager.getProxy(requireContext(), null) - runOnIoThread { - proxy.allClients.forEach { - it.value.closeSource() - } - }*/ super.onPause() ExoCacheManager.cancelAll() } diff --git a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailViewModel.kt deleted file mode 100644 index d153e2c9f9..0000000000 --- a/app/src/main/java/com/gh/gamecenter/video/detail/VideoDetailViewModel.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.gh.gamecenter.video.detail - -import android.annotation.SuppressLint -import android.app.Application -import androidx.lifecycle.AndroidViewModel -import androidx.lifecycle.MutableLiveData -import com.gh.gamecenter.entity.VideoEntity -import com.gh.gamecenter.manager.UserManager -import com.gh.gamecenter.retrofit.BiResponse -import com.gh.gamecenter.retrofit.RetrofitManager -import com.lightgame.utils.Utils -import io.reactivex.schedulers.Schedulers -import okhttp3.ResponseBody - -@SuppressLint("CheckResult") -class VideoDetailViewModel(application: Application) : AndroidViewModel(application) { - - var showComment = false - var videoDetail: VideoEntity? = null - - var needToUpdateVideoInfo = MutableLiveData() - - fun voteVideo() { - RetrofitManager.getInstance(getApplication()) - .api.voteVideo(videoDetail!!.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - videoDetail?.let { - it.vote++ - it.me.isVoted = true - } - needToUpdateVideoInfo.postValue(true) - } - - override fun onFailure(exception: Exception) { - super.onFailure(exception) - Utils.toast(getApplication(), exception.localizedMessage) - } - }) - } - - fun undoVoteVideo() { - RetrofitManager.getInstance(getApplication()) - .api.undoVoteVideo(videoDetail!!.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - videoDetail?.let { - it.vote-- - it.me.isVoted = false - } - needToUpdateVideoInfo.postValue(true) - } - - override fun onFailure(exception: Exception) { - super.onFailure(exception) - Utils.toast(getApplication(), exception.localizedMessage) - } - }) - } - - - fun collectVideo() { - RetrofitManager.getInstance(getApplication()) - .api.collectVideo(UserManager.getInstance().userId, videoDetail!!.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - videoDetail!!.me.isVideoFavorite = true - needToUpdateVideoInfo.postValue(true) - Utils.toast(getApplication(), "收藏成功") - } - - override fun onFailure(exception: Exception) { - super.onFailure(exception) - Utils.toast(getApplication(), exception.localizedMessage) - } - }) - } - - fun undoCollectVideo() { - RetrofitManager.getInstance(getApplication()) - .api.undoCollectVideo(UserManager.getInstance().userId, videoDetail!!.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - videoDetail!!.me.isVideoFavorite = false - needToUpdateVideoInfo.postValue(true) - Utils.toast(getApplication(), "取消收藏") - } - - override fun onFailure(exception: Exception) { - super.onFailure(exception) - Utils.toast(getApplication(), exception.localizedMessage) - } - }) - } - - -} \ No newline at end of file