Commit 9867c328 authored by jyx's avatar jyx

代码优化

parent 44865996
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" /> <bytecodeTargetLevel target="11" />
</component> </component>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -34,11 +34,6 @@ object Constant { ...@@ -34,11 +34,6 @@ object Constant {
const val FRAGMENT_CLICK_TWO = 1 const val FRAGMENT_CLICK_TWO = 1
const val FRAGMENT_CLICK_THREE = 2 const val FRAGMENT_CLICK_THREE = 2
const val VIP_REQUEST_CODE = 0x111
// 协议地址 // 协议地址
var REGISTER_URL = "http://mints-web.mints-id.com/agreements/helivideo/yhxy.html"//注册协议 var REGISTER_URL = "http://mints-web.mints-id.com/agreements/helivideo/yhxy.html"//注册协议
var PRIVACY_URL = "http://mints-web.mints-id.com/agreements/helivideo/syzc.html"//隐私协议 var PRIVACY_URL = "http://mints-web.mints-id.com/agreements/helivideo/syzc.html"//隐私协议
......
package com.xinfu.helivideo.video package com.xinfu.helivideo.video
import android.app.Dialog import android.app.Dialog
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
...@@ -31,7 +30,9 @@ import com.xinfu.library.utils.nodoubleclick.AntiShake ...@@ -31,7 +30,9 @@ import com.xinfu.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_tx_video.* import kotlinx.android.synthetic.main.activity_tx_video.*
class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener { VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
private var mVipFlag = UserManager.getInstance().vipFlag
var videos = ArrayList<VedioEpisodeBean>() var videos = ArrayList<VedioEpisodeBean>()
...@@ -73,6 +74,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -73,6 +74,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
super_short_video_view.resume() super_short_video_view.resume()
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态
isPlayNext = false
playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
}
} }
override fun onPause() { override fun onPause() {
...@@ -89,9 +97,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -89,9 +97,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun initView() { private fun initView() {
episode_tv.text = String.format( episode_tv.text = String.format(
"共%d集 %s", "共%d集 %s",
mVedioBean?.vedioTotal, mVedioBean?.vedioTotal,
if (mVedioBean?.completeStatus == 0) "已完结" else "更新中" if (mVedioBean?.completeStatus == 0) "已完结" else "更新中"
) )
super_short_video_view.setOnCustomChildClickListener(this) super_short_video_view.setOnCustomChildClickListener(this)
...@@ -238,18 +246,18 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -238,18 +246,18 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// 看广告解锁 // 看广告解锁
val carrierType = Constant.CARRIERTYPE_TX_VEDIO val carrierType = Constant.CARRIERTYPE_TX_VEDIO
AdManager.instance.showAd(this, carrierType, AdManager.instance.showAd(this, carrierType,
object : AdStatusListener { object : AdStatusListener {
var canFail = false var canFail = false
override fun adSuccess() { override fun adSuccess() {
canFail = true canFail = true
} }
override fun adFail() { override fun adFail() {
if (canFail) return if (canFail) return
NoPreAdManager.loadVideoAd( NoPreAdManager.loadVideoAd(
this@TxVideoActivity, this@TxVideoActivity,
carrierType, object : AdStatusListener { carrierType, object : AdStatusListener {
override fun adFail() { override fun adFail() {
showToast("广告太火爆了,请稍候再试") showToast("广告太火爆了,请稍候再试")
} }
...@@ -264,16 +272,16 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -264,16 +272,16 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
} }
}) })
} }
override fun adClose(vo: HashMap<String, Any>?) { override fun adClose(vo: HashMap<String, Any>?) {
vo?.let { vo?.let {
vo["vedioId"] = mVedioBean!!.vedioId vo["vedioId"] = mVedioBean!!.vedioId
videoPresenter.unlock(vo) videoPresenter.unlock(vo)
}
} }
}
}) })
} }
R.id.vip -> { R.id.vip -> {
...@@ -281,7 +289,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -281,7 +289,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val bundle = Bundle() val bundle = Bundle()
bundle.putString(VipActivity.VEDIO_ID, mVedioBean!!.vedioId.toString()) bundle.putString(VipActivity.VEDIO_ID, mVedioBean!!.vedioId.toString())
bundle.putString(VipActivity.THIRD_ID, mVedioBean!!.thirdId) bundle.putString(VipActivity.THIRD_ID, mVedioBean!!.thirdId)
readyGoForResult(VipActivity::class.java, Constant.VIP_REQUEST_CODE, bundle) readyGo(VipActivity::class.java, bundle)
} }
else -> {} else -> {}
...@@ -296,25 +304,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -296,25 +304,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
VipCountDialog(this, mVedioBean!!, tipList) VipCountDialog(this, mVedioBean!!, tipList)
.setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss { .setOnDialogDismiss(object : VipCountDialog.OnDialogDismiss {
override fun onDialogDismiss() {} override fun onDialogDismiss() {}
}) })
.show() .show()
} }
private fun getPosition() = super_short_video_view.currentPosition private fun getPosition() = super_short_video_view.currentPosition
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constant.VIP_REQUEST_CODE) {
if (UserManager.getInstance().vipFlag) {
// 重置状态
isPlayNext = false
playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
}
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment