Commit 2c8070d1 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 61cd15b1
......@@ -385,12 +385,13 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
videoAdingManager.setVideoAdingListener(null)
videoAdingManager.onDestory()
awardPresenter.detachView()
if (mReceiverBroadcastReceiver != null) {
mContext.stopService(Intent(context, AppInstallService::class.java))
mContext.unregisterReceiver(mReceiverBroadcastReceiver)
}
awardPresenter.detachView()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
......@@ -634,6 +635,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private fun refreshHighTask(highCoin: Int) {
if (mCurrentPkg == null) {
// 用户点击激励视频但并未下载安装
// 超级翻倍领取状态 0-去下载 1-去试玩 2-试玩时间不足 3-领取奖励 4-放弃试玩
//(mReceiverBroadcastReceiver != null && superTaskStatus == 0) 表示 点击超级翻倍去下载
//(mReceiverBroadcastReceiver == null && superTaskStatus == 4) 表示 普通任务未下载
if ((mReceiverBroadcastReceiver != null && superTaskStatus == 0) ||
(mReceiverBroadcastReceiver == null && superTaskStatus == 4)) {
......
......@@ -22,7 +22,7 @@ import kotlinx.android.synthetic.main.header_layout.*
*/
class TaskCpdActivity : BaseActivity(), View.OnClickListener {
private lateinit var cdaa: CustomDialogAsApple
private var cdaa: CustomDialogAsApple? = null
override fun getContentViewLayoutID() = R.layout.activity_task_cpd
......@@ -39,6 +39,12 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
initListener()
}
override fun onDestroy() {
super.onDestroy()
cdaa = null
}
override fun onBackPressed() {
backDialog()
}
......@@ -56,11 +62,11 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
private fun initViewAndData() {
val tabs: MutableList<String> = ArrayList()
val fragments: MutableList<Fragment> = ArrayList()
tabs.add("试玩")
tabs.add("每日精选")
fragments.add(TaskCpdFragment())
if (AppConfig.useAppCpdModelShow) {
tabs.add("点击")
tabs.add("获取更多金币")
fragments.add(TaskCpdHistoryFragment())
xtTaskCpd.visibility = View.VISIBLE
} else {
......@@ -79,10 +85,10 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
}
private fun backDialog() {
cdaa = CustomDialogAsApple(context, object : DialogListener() {
cdaa = CustomDialogAsApple(this, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa.isShowing) {
cdaa.dismiss()
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_right -> {
......@@ -91,11 +97,11 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
}
}
})
cdaa.setTitle("提示")
cdaa.setContent("退出当前页面将会重置当前任务状态")
cdaa.setLeft("取消")
cdaa.setRight("确定")
cdaa.show()
cdaa!!.setTitle("提示")
cdaa!!.setContent("退出当前页面将会重置当前任务状态")
cdaa!!.setLeft("取消")
cdaa!!.setRight("确定")
cdaa!!.show()
}
}
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