Commit ba1bed4e authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent fd3309b6
...@@ -52,7 +52,7 @@ class InsertScreenAdManager { ...@@ -52,7 +52,7 @@ class InsertScreenAdManager {
} }
override fun adClose() { override fun adClose() {
wifiAdStatusListener?.adClose()
} }
}) })
} }
...@@ -76,7 +76,7 @@ class InsertScreenAdManager { ...@@ -76,7 +76,7 @@ class InsertScreenAdManager {
} }
override fun adClose() { override fun adClose() {
wifiAdStatusListener?.adClose()
} }
}) })
} }
......
...@@ -133,7 +133,7 @@ public class AwardPresenter extends BasePresenter<AwardView> { ...@@ -133,7 +133,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
public void reportAddCoinMsg(HashMap<String, Object> vo) { public void reportAddCoinMsg(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.reportAddCoinMsg(vo), .call(loanService.reportAddCoinMsg(vo),
new BaseSubscriber<BaseResponse<Object>>() { new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override @Override
public void onCompleted() { public void onCompleted() {
if (isLinkView()) return; if (isLinkView()) return;
...@@ -145,7 +145,7 @@ public class AwardPresenter extends BasePresenter<AwardView> { ...@@ -145,7 +145,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
} }
@Override @Override
public void onNext(BaseResponse<Object> baseResponse) { public void onNext(BaseResponse<JsonObject> baseResponse) {
if (isLinkView()) return; if (isLinkView()) return;
} }
}); });
......
package com.mints.flowbox.mvp.presenters
import android.app.Activity
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.mvp.model.BaseResponse
import com.mints.flowbox.mvp.views.VideoAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class TzVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mints.flowbox.mvp.presenters; ...@@ -2,6 +2,7 @@ package com.mints.flowbox.mvp.presenters;
import android.app.Activity; import android.app.Activity;
import com.google.gson.JsonObject;
import com.mints.flowbox.MintsApplication; import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.mvp.model.BaseResponse; import com.mints.flowbox.mvp.model.BaseResponse;
import com.mints.flowbox.mvp.views.VideoAdManagerView; import com.mints.flowbox.mvp.views.VideoAdManagerView;
...@@ -30,7 +31,7 @@ public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> { ...@@ -30,7 +31,7 @@ public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> {
subscription = loanService.reportAddCoinMsg(vo) subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler()) .subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() { .subscribe(new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override @Override
public void onCompleted() { public void onCompleted() {
...@@ -42,7 +43,7 @@ public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> { ...@@ -42,7 +43,7 @@ public class YlhVideoAdPresenter extends BasePresenter<VideoAdManagerView> {
} }
@Override @Override
public void onNext(BaseResponse<Object> baseResponse) { public void onNext(BaseResponse<JsonObject> baseResponse) {
} }
}); });
......
...@@ -715,8 +715,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener { ...@@ -715,8 +715,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
val rateBig = BigDecimal("10000") val rateBig = BigDecimal("10000")
val cashStr = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString() val cashStr = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
if (data.gromoreCoin > 0) { if (AppConfig.awardCoin > 0) {
tvAwardContent.text = "${data.gromoreCoin}金币已到账" tvAwardContent.text = "${AppConfig.awardCoin}金币已到账"
tvAwardNext.visibility = View.GONE tvAwardNext.visibility = View.GONE
} }
......
...@@ -126,6 +126,14 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -126,6 +126,14 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
insertScreenAdManager?.setInsertScreenAdStatusListener(object : insertScreenAdManager?.setInsertScreenAdStatusListener(object :
WifiAdStatusListener { WifiAdStatusListener {
override fun adSuccess() { override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
try { try {
if (turnTableData?.surplus!! <= 0) { if (turnTableData?.surplus!! <= 0) {
return return
...@@ -133,7 +141,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -133,7 +141,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
insertScreenAdManager?.onDestroy() insertScreenAdManager?.onDestroy()
if (AppPreferencesManager.get() if (AppPreferencesManager.get()
.getBoolean(Constant.TURNTABLE_SWITCH_BUTTON, false) .getBoolean(Constant.TURNTABLE_SWITCH_BUTTON, false)
) { ) {
clickTurn() clickTurn()
} }
...@@ -142,14 +150,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -142,14 +150,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
e.printStackTrace() e.printStackTrace()
} }
} }
override fun adFail() {
}
override fun adClose() {
}
}) })
switchButton?.isOpened = switchButton?.isOpened =
......
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