Commit 70b918eb authored by jyx's avatar jyx

代码优化

parent 6f7538c5
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -144,15 +144,15 @@ class SplashActivity : BaseActivity() {
private fun goToMainActivity() {
// val vipEnter = AppPreferencesManager.get().getBoolean(Constant.IS_FIRST_VIP_BTN, false)
// if ((UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) || !vipEnter) {
if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// 匹配用户 且 不是vip
val bundle = Bundle()
bundle.putBoolean(VipActivity.IS_GUIDE, true)
readyGoThenKill(VipActivity::class.java, bundle)
} else {
// if (UserManager.getInstance().newFlag && !UserManager.getInstance().vipFlag) {
//// AppPreferencesManager.get().put(Constant.IS_FIRST_VIP_BTN, true)
// // 匹配用户 且 不是vip
// val bundle = Bundle()
// bundle.putBoolean(VipActivity.IS_GUIDE, true)
// readyGoThenKill(VipActivity::class.java, bundle)
// } else {
readyGoThenKill(MainActivity::class.java)
}
// }
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
......
......@@ -82,8 +82,8 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView {
datum.topTabsReamrk = TimeHelp.format(datum.seeUpdateTime * 1000)
datas.add(datum)
}
mWatchRecordAdapter?.setNewInstance(datas)
// mWatchRecordAdapter?.notifyDataSetChanged()
// mWatchRecordAdapter?.setNewInstance(datas)
mWatchRecordAdapter?.notifyDataSetChanged()
}
override fun getHistoryFail() {
......
......@@ -31,6 +31,7 @@ import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter
import com.mints.wisdomclean.ui.widgets.DialogListener
import com.mints.wisdomclean.ui.widgets.VideoEpisodeDialog
import com.mints.wisdomclean.ui.widgets.VipCountDialog
import com.mints.wisdomclean.utils.LogUtil
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.drama_activity_api_detail.episode_tv
import kotlinx.android.synthetic.main.drama_activity_api_detail.fm_bottom
......@@ -93,9 +94,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private var mode = DPDramaDetailConfig.SPECIFIC_DETAIL
private val isFromCard by lazy { intent?.getBooleanExtra(IS_FROM_CARD, false) ?: false }
private val fromGid by lazy { intent?.getLongExtra(FROM_GID, -1L) }
private var mVedioBean: VedioBean? = null
override fun getBundleExtras(extras: Bundle?) {
......@@ -106,8 +104,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
mVedioBean = Gson().fromJson(json, VedioBean::class.java)
freeSet = mVedioBean!!.unlockIndex
lockSet = 2
// lockSet = if (mVedioBean!!.adGiveVedioNum == 0) 1 else mVedioBean!!.adGiveVedioNum
lockSet = if (mVedioBean!!.adGiveVedioNum == 0) 1 else mVedioBean!!.adGiveVedioNum
hideLeftTopTips = true
mode = DPDramaDetailConfig.SPECIFIC_DETAIL
enableInfiniteScroll = false
......@@ -138,6 +135,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
it.index = mVedioBean!!.seeIndex
mInitUnlockIndex = mVedioBean!!.unlockIndex
mUnlockIndexMap[it.id] = mInitUnlockIndex
mHasUnlockIndexMap[it.id] = arrayListOf(mInitUnlockIndex)
title_tv.text = it.title
if (mVedioBean!!.completeStatus == 0) {
episode_tv.text = String.format("共%d集 已完结", it.total)
......@@ -197,8 +195,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
.hideLeftTopTips(hideLeftTopTips, null)
.showCellularToast(true)
.hideMore(hideMore)
.freeSet(freeSet)
.lockSet(lockSet)
.listener(dramaListener)
.adListener(dramaAdListener)
.setCustomReport(enableCustomReport) { context, id ->
......@@ -208,7 +204,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
.id(drama.id)
.index(drama.index)
// .currentDuration(currentDuration)
.fromCard(isFromCard, fromGid.toString())
)
}
}
......@@ -286,16 +281,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override fun onDPPageChange(position: Int, map: MutableMap<String, Any>?) {
super.onDPPageChange(position, map)
Log.d(TAG, "onDPPageChange:" + map?.toString())
info_tv.text = String.format("第%d集", position + 1)
dialog?.setCurrentIndex(position)
if (mUnlockIndexMap[drama!!.id]!! > position) {
blockView?.visibility = View.GONE
}
mVedioBean!!.seeIndex = position + 1
LocalVedioManager.commitVedio(mVedioBean!!)
showVipCountDialog(position)
}
override fun onDPVideoPlay(map: MutableMap<String, Any>?) {
......@@ -359,9 +344,19 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
val hasUnlockList = mHasUnlockIndexMap[drama.id] ?: mutableListOf()
Log.d(
TAG,
"isNeedBlock: index = $index" + " " + unlockIndex + "s" + drama.id + mHasUnlockIndexMap
"isNeedBlock: index = $index" + " " + unlockIndex + "s" + drama.id + mHasUnlockIndexMap +
" --- " + (index > unlockIndex && hasUnlockList.contains(index).not())
)
info_tv.text = String.format("第%d集", index)
dialog?.setCurrentIndex(index)
if (mUnlockIndexMap[drama.id]!! > index) {
blockView?.visibility = View.GONE
}
mVedioBean!!.seeIndex = index
LocalVedioManager.commitVedio(mVedioBean!!)
showVipCountDialog(index - 1)
return index > unlockIndex && hasUnlockList.contains(index).not()
}
......@@ -416,8 +411,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
hasUnlockList.add(widget.currentDramaIndex + lockSet)
mHasUnlockIndexMap[drama.id] = hasUnlockList
}
mInitUnlockIndex = mUnlockIndexMap[drama.id]!! + lockSet
mUnlockIndexMap[drama.id] =
mUnlockIndexMap[drama.id]!! + lockSet
mVedioBean!!.unlockIndex = mInitUnlockIndex
blockView?.visibility = View.GONE
callback?.onDramaRewardArrived() // 解锁当前集
......@@ -445,7 +442,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
mInitUnlockIndex = mUnlockIndexMap[drama.id]!! + lockSet
mUnlockIndexMap[drama.id] = mUnlockIndexMap[drama.id]!! + lockSet
mVedioBean!!.unlockIndex = mInitUnlockIndex
blockView?.visibility = View.GONE
callback?.onDramaRewardArrived() // 解锁当前集
}
......@@ -497,27 +494,21 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private fun showEpisodeDialog() {
if (mVedioBean == null) return
if (dialog != null && !dialog!!.isShowing) {
dialog!!.setCurrentIndex(lastIndex - 1)
dialog!!.show()
} else {
dialog = VideoEpisodeDialog(this, mVedioBean, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
}
})
dialog!!.setOnEpisodeClickListener(this)
dialog!!.setCurrentIndex(lastIndex - 1)
dialog?.show()
}
dialog = VideoEpisodeDialog(this, mVedioBean, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
}
})
dialog?.setOnEpisodeClickListener(this)
dialog?.setCurrentIndex(mVedioBean!!.seeIndex - 1)
dialog?.show()
}
override fun onEpisodeClick(position: Int) {
dialog?.dismiss()
if (position > mInitUnlockIndex) {
if (position + 1 > mInitUnlockIndex) {
dpWidget?.let { widget ->
lastIndex = mInitUnlockIndex + 1
widget.currentDramaIndex = mInitUnlockIndex + 1
}
return
......
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