Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev

This commit is contained in:
kehaoyuan@ghzhushou.com
2020-03-09 15:08:18 +08:00
3 changed files with 0 additions and 127 deletions

View File

@ -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")

View File

@ -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()
}

View File

@ -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<Boolean>()
fun voteVideo() {
RetrofitManager.getInstance(getApplication())
.api.voteVideo(videoDetail!!.id)
.subscribeOn(Schedulers.io())
.subscribe(object : BiResponse<ResponseBody>() {
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<ResponseBody>() {
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<ResponseBody>() {
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<ResponseBody>() {
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)
}
})
}
}