Commit 26d3ffac authored by jyx's avatar jyx

代码优化

parent b626982e
...@@ -79,6 +79,7 @@ class TaskPresenter : BasePresenter<TaskView>() { ...@@ -79,6 +79,7 @@ class TaskPresenter : BasePresenter<TaskView>() {
view.getCpdModelSuc(data) view.getCpdModelSuc(data)
} }
} else { } else {
view.getCpdModelFail()
view.showToast(response.message) view.showToast(response.message)
} }
} }
......
...@@ -6,4 +6,6 @@ interface TaskView : BaseView { ...@@ -6,4 +6,6 @@ interface TaskView : BaseView {
fun getShCpdTimeSuc(time: Int, CPD: Int, CPD_SYD: Int) fun getShCpdTimeSuc(time: Int, CPD: Int, CPD_SYD: Int)
fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) fun getCpdModelSuc(dataBean: CpdModelBean.DataBean)
fun getCpdModelFail()
} }
\ No newline at end of file
...@@ -46,8 +46,7 @@ public interface CpdService { ...@@ -46,8 +46,7 @@ public interface CpdService {
class Factory { class Factory {
private Factory() { private Factory() { }
}
private static CpdService sCpdService; private static CpdService sCpdService;
......
...@@ -167,7 +167,9 @@ class TaskActivity : BaseActivity(), TaskView, ...@@ -167,7 +167,9 @@ class TaskActivity : BaseActivity(), TaskView,
mFakeTaskList.add(tzTaskBean) mFakeTaskList.add(tzTaskBean)
} }
// 多拉取的广告 LogUtil.d(TAG_LOG, "CPD -> getCpdModelSuc")
// 多拉取的CPD广告
if (cpdLoadCountTime++ == cpdMax - 1) { if (cpdLoadCountTime++ == cpdMax - 1) {
hideLoading() hideLoading()
srl_task.finishRefresh() srl_task.finishRefresh()
...@@ -187,6 +189,13 @@ class TaskActivity : BaseActivity(), TaskView, ...@@ -187,6 +189,13 @@ class TaskActivity : BaseActivity(), TaskView,
} }
} }
override fun getCpdModelFail() {
if (cpdLoadCountTime == cpdMax - 1) {
hideLoading()
srl_task.finishRefresh()
}
}
override fun onRefresh(refreshLayout: RefreshLayout) { override fun onRefresh(refreshLayout: RefreshLayout) {
loadData() loadData()
} }
...@@ -343,8 +352,8 @@ class TaskActivity : BaseActivity(), TaskView, ...@@ -343,8 +352,8 @@ class TaskActivity : BaseActivity(), TaskView,
if (mFakeTaskList[position].isShCpd) { if (mFakeTaskList[position].isShCpd) {
taskDialog = TaskDialog(this) taskDialog = TaskDialog(this)
taskDialog?.setData(mFakeTaskList[position].coralAd, needUseTime, mCoin)
taskDialog?.show() taskDialog?.show()
taskDialog?.setData(mFakeTaskList[position].coralAd, needUseTime, mCoin)
} else { } else {
taskCpdDialog = TaskCpdDialog(this, object : DialogListener() { taskCpdDialog = TaskCpdDialog(this, object : DialogListener() {
override fun onClick(v: View?) { override fun onClick(v: View?) {
......
...@@ -14,8 +14,7 @@ import com.tz.sdk.core.ui.ADContainer ...@@ -14,8 +14,7 @@ import com.tz.sdk.core.ui.ADContainer
/** /**
* 提示弹框 * 提示弹框
*/ */
class TaskDialog(context: Context) : class TaskDialog(context: Context) : Dialog(context, R.style.dialog) {
Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams private val lp: WindowManager.LayoutParams
private val tvTitle: TextView private val tvTitle: TextView
private val tvText1: TextView private val tvText1: TextView
......
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