Commit bc49fbd7 authored by mengcuiguang's avatar mengcuiguang

优化任务下载

parent 48634236
......@@ -22,7 +22,6 @@ object BxmManager {
private const val APP_ID = "3b08a06c36a04eb7ad31ee31547b9e69"
private const val BUTTON_AD_SPOT_ID = "807020001003"
// private const val BUTTON_AD_SPOT_ID = "807020001004"
private var bdAdvanceButtonAd: BDAdvanceButtonAd? = null
......
......@@ -54,8 +54,8 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
// APP下载回调广播
private var mReceiverBroadcastReceiver: BroadcastReceiver? = null
// 是否刷新按钮状态
private var isRefreshState = false
// 试完时间不足弹窗
private var tryTimeOut = false
companion object {
const val TASK_COIN = "task_coin"
......@@ -114,16 +114,10 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
* 刷新高额任务
*/
private fun refreshDemoTask() {
if (isRefreshState) {
isRefreshState = !isRefreshState
return
}
isRefreshState = !isRefreshState
mTaskAdapter?.let {
if (mFakeTaskList.size == 0) return
val position = it.getPosition()
if (mFakeTaskList.size == 0 || tryTimeOut || mFakeTaskList[position].state == 3) return
val currentPkgName = mFakeTaskList[position].currentPkgName
if (currentPkgName != null) {
......@@ -136,6 +130,7 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
mDownloadProcess?.reportAppActivated()
} else {
if (AppTryPlayManager.getTryPlayIsOK(currentPkgName, 5)) {
tryTimeOut = true
// 试玩时间不足
mFakeTaskList[position].state = 4
it.notifyItemChanged(it.getPosition())
......@@ -171,7 +166,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
}
override fun onRefresh(refreshLayout: RefreshLayout) {
isRefreshState = false
loadData()
}
......@@ -199,8 +193,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
}
override fun onGetDownloadProcess(downloadProcess: DownloadProcess?) {
isRefreshState = false
// 点击之后回调下载数据
mDownloadProcess = downloadProcess
......@@ -252,7 +244,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
// 上报安装完成
mDownloadProcess?.reportInstallSuccess(false)
isRefreshState = false
}
} catch (e: Exception) {
e.printStackTrace()
......@@ -269,6 +260,7 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
when (mFakeTaskList[position].state) {
// 0 立即下载, 1 去试玩, 2 领取奖励
0 -> {
tryTimeOut = false
if (AppUtil.isOpenUsageStats()) {
clickDialog(position)
} else {
......@@ -284,7 +276,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
it.notifyItemChanged(it.getPosition())
} else {
if (AppUtil.checkPackInfo(mContext, currentPkgName)) {
isRefreshState = false
AppTryPlayManager.toTryPlay(currentPkgName)
} else {
......@@ -321,8 +312,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
it.notifyItemChanged(it.getPosition())
} else {
if (AppUtil.checkPackInfo(mContext, currentPkgName)) {
isRefreshState = false
AppTryPlayManager.toTryPlay(currentPkgName)
} else {
showToast("未找到当前APP、可能被卸载,请重试~")
......
......@@ -540,7 +540,7 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, View.OnC
})
cdaa!!.run {
setTitle("提示")
setContent("被邀请人需要登录才能获得贡献值")
setContent("被邀请人成功提现0.5元后发放贡献")
setLeft("取消")
setRight("打开微信")
show()
......
......@@ -1107,7 +1107,7 @@ class MyFragment : BaseFragment(),
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent("被邀请人需要登录才能获得贡献值")
cdaa!!.setContent("被邀请人成功提现0.5元后发放贡献")
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