Commit bc49fbd7 authored by mengcuiguang's avatar mengcuiguang

优化任务下载

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